Skip to content

TradeFlow

Per-pair trade flow over a time window: how many units traded, how much quote currency that was worth, and how many trades there were — over the trades whose time is inside the last windowseconds.

  • Input: the canonical public trade tape of any venue (com.virtufin.exchange.<venue>.trade.executed, from BinanceTrades/AlpacaTrades). One deployment can cover both venues' tapes.
  • Value: { "units": 3.5, "notional": 262175.42, "quote": "USDT", "trades": 1204, "windowseconds": 60 }. units is the base asset's size, notional is price × units in the pair's quote currency (USDT, USD, ...), trades counts them.
  • Indicator: two of lib's TimeWindowSum folds — one over a trade's size, one over its notional — which also yields the count, so the three values always describe the same window.
  • Pair: the tape event's subject (currency_pair/<PAIR>); one indicator is kept per pair.
  • Pacing. Trades are the highest-rate input in the system, so deploy with publishintervalms (e.g. 250) and saveintervalms: the fold happens on every trade, the announcement and the state write coalesce (latest wins).
Property Value
Project Virtufin.Worker.TradeFlow
Base class Virtufin.Indicator.DevKit.IndicatorWorkerBase
Engine application/x-dotnet-dll
Input trade tape events, e.g. act.exchange.binance.trade.executed.BTC_USDT
Output sc.<scenarioid>.indicator.<indicatorname>.changed.<PAIR>
State sc.<scenarioid>.indicator.<indicatorname>.<PAIR>

Config (CreateWorker config)

Key Required Meaning
scenarioid yes The scenario the indicator belongs to (topic and state key)
indicatorname yes Topic and state-key segment, e.g. tradeflow
windowseconds no Window length in seconds (default 60)
publishintervalms no Least time between two changed events of one pair; 0 = every trade. Latest wins
saveintervalms no Least time between two state writes of one pair; 0 = inline save

Other events on the subscribed topics are skipped. One indicator is kept per pair; deploy one worker per window (and venue, if you want separate windows).