Expand description
§wickra-backtest-data
Loaders that turn market-history files into the Candle stream the
wickra_backtest_core engine consumes. CSV (time,open,high,low,close[,volume]),
JSON Lines (one Candle object per line) and a JSON array are supported,
dispatched by file extension; Apache Parquet is supported behind the
parquet feature. Candles can also be resampled to a coarser timeframe by a
fixed bar count or a timestamp interval.
Functions§
- fetch_
klines binance - Fetch historical candles from the Binance REST API
(
GET /api/v3/klines).intervalis a Binance interval such as1m,1hor1d;limitis the number of bars (Binance caps this at 1000). Requires thebinancefeature. - load_
candles - Load candles from a file, choosing the parser by extension
(
.jsonl/.ndjson→ JSON Lines,.json→ JSON array,.parquet→ Parquet when theparquetfeature is on, anything else → CSV). - load_
parquet parquet - Load candles from an Apache Parquet file with columns
time, open, high, low, close[, volume](matched case-insensitively). Integer or floating-point columns are both accepted. - parse_
binance_ klines - Parse a Binance
GET /api/v3/klinesresponse (a JSON array of kline arrays) into candles. Each kline is[openTime_ms, "open", "high", "low", "close", "volume", …]where the OHLCV fields are JSON strings; the open time is milliseconds since epoch and is converted to seconds. This is always available (no HTTP dependency) so the parser can be tested offline. - parse_
csv - Parse CSV with columns
time,open,high,low,close[,volume]. A non-numeric first row is treated as a header and skipped. - parse_
json_ array - Parse a JSON array of
Candleobjects. - parse_
jsonl - Parse JSON Lines: one
Candleobject per non-empty line. - resample_
by_ count - Resample candles into fixed groups of
count(e.g. five 1-minute bars into one 5-minute bar). A trailing partial group is aggregated as-is.countmust be non-zero. - resample_
by_ interval - Resample candles by a timestamp
interval: candles whosetimefalls in the samefloor(time / interval)bucket are aggregated, and the bucket adopts the floored start time. Input must be time-ordered;intervalmust be non-zero. - to_kagi
- Transform candles into Kagi segments (
wickra-core’sKagiBars, fixedreversalamount on closes), each emitted as a synthetic candle (open= segment start,close= segment end).reversalmust be positive. - to_pnf
- Transform candles into Point-and-Figure columns (
wickra-core’sPointAndFigureBars, fixedbox_sizeand N-boxreversalon closes), each emitted as a synthetic candle. A rising (X) column opens at its low and closes at its high; a falling (O) column opens high and closes low.box_sizemust be positive andreversalnon-zero. - to_
renko - Transform candles into Renko bricks (
wickra-core’sRenkoBars, fixedbox_sizeon closes), each emitted as a synthetic candle (open/close= the brick edges, sequential timestamps). Backtest a strategy on price-driven Renko bars instead of time bars.box_sizemust be positive.