BinanceCandles
Turns Binance SPOT kline frames into closed OHLCV candles, published as
world-scoped market data on the candle topics of the openspec
pubsub-topics spec ("OHLCV candle"). Built on Virtufin.MarketData.DevKit,
which owns the candle contract.
| Property | Value |
|---|---|
| Project | Virtufin.Worker.BinanceCandles |
| Base class | Virtufin.MarketData.DevKit.MarketDataWorkerBase |
| Engine | application/x-dotnet-dll |
| Input topic | act.exchange.binance.kline (raw frames from WebSocketManager) |
| Output topic | <world>.exchange.binance.ohlcv.candle.<interval>.<PAIR> |
| ce-type | com.virtufin.exchange.binance.ohlcv.candle |
Behaviour
- Closed candles only. A kline is published when Binance marks it closed
(
k.x == true). Open klines, SUBSCRIBE acks and any other frame are skipped without an error event. - Once per window. The worker remembers the last published window start per (pair, interval), so a redelivered or replayed frame is dropped.
- Envelope.
exchange=binance,marketworld,marketuniverse,clocktype, andeventtime=ce-time= the candle's close time (T); no scenario extensions. - Payload.
{ symbol, interval, open, high, low, close, volume, windowStart, windowEnd }; see the market-data-devkit's contracts page.
Config (CreateWorker config, as extension attributes)
| Key | Default | Meaning |
|---|---|---|
currencypairs |
every pair | Comma-separated allowlist, e.g. BTCUSDT,ETHUSDT |
intervals |
every interval | Comma-separated allowlist, e.g. 1s,1m |
world |
act |
act or hyp.<name> (topic prefix and marketworld) |
venue |
binance |
Topic segment and exchange |
marketuniverse |
ALL |
marketuniverse extension |
clocktype |
wall for act, else historical |
clocktype extension |
Deploy
- Kline feed (WebSocketManager, no worker):
scripts/start_kline_feed.py --pairs BTCUSDT ETHUSDT --intervals 1s 1m. This connects towss://stream.binance.com:9443/stream, subscribes to<pair>@kline_<interval>and publishes the frames toact.exchange.binance.kline. - Worker:
scripts/create_worker.py(one instance for all pairs and intervals), then start it. - Consume: subscribe to e.g.
act.exchange.binance.ohlcv.candle.1m.BTCUSDT; decode withCandleJson.TryDecode.
Binance publishes the in-progress kline about once a second (1s klines
every second) and the closing frame once, so a 1m subscription yields one
candle per minute per pair.