csvToBars(...)csvToBarsStreaming(...)
Both now enforce:
- ISO8601 date input (date-only or ISO datetime forms).
- Chronological order (strictly increasing by date).
- Required OHLCV fields.
Use BKCSVColumnMapping when your input headers differ from defaults.
let mapping = BKCSVColumnMapping(
date: "Date",
open: "Open",
high: "High",
low: "Low",
close: "Close",
volume: "Volume"
)
let bars = try csvToBars(csv, reverse: false, columnMapping: mapping)CSV parsing reports BKCSVParsingError with explicit cases, including:
missingHeadermissingRequiredColumninvalidISO8601DatemalformedRowinvalidNumericnonChronologicalDate
This is designed for UI-friendly error presentation and recovery hints.
Simulation drivers consume BKRawCsvProvider. You can inject any market data backend.
Built-ins:
BKCustomCsvProviderfor custom async loader closures.BKCachedCsvProviderfor in-memory cache wrapping any provider.AlphaVantageClientas an optional vendor adapter.
AlphaVantageClient supports:
- Retry policy (
AlphaVantageRetryPolicy) - Optional request rate limiting (
BKRequestRateLimiter) - CSV response retrieval compatible with parser pipeline
BKCachedCsvProvider wraps any BKRawCsvProvider and offers:
- In-memory CSV cache
- Hit/miss metrics (
BKCsvCacheStats) - Metrics reporting stream (
BKCacheMetricsReporter)