Skip to content

StockFlow

Preview on the public Rust client. The analytic ships in the engine and is reachable today through the Python wheel and the TypeScript / Node addon; a per-analytic builder on the public Rust thin client (kairos::Client) is tracked on the roadmap. The output tick schema below is stable.

What it computes

Stock-side counterpart of OptionFlow: per-bucket buy / sell / mid volume plus dollar value with side classification. Stocks have no contract multiplier; the per-trade dollar value is price × size.

Methodology

Lee & Ready (1991), as documented at /methodology/lee-ready.

Inputs

  • Stock TradeTick.
  • The pre-trade NBBO snapshot for the same symbol.

Output schema (StockFlowTick)

Mirrors OptionFlowTick; stock dollar value is reported in the buy_value / sell_value / mid_value columns (price × size, no contract multiplier). The field / type / description table below is regenerated from the StockFlowTick Rust source by docs-site/scripts/inject-doc-tables.ts on every npm run docs:build. Do not hand-edit between the sentinels.

FieldTypeDescription
contractContractResolved contract metadata. Subscribers identify the security by (symbol, expiration, right, strike) on this field — the wire-level contract id is engine-internal and is not surfaced here.
datei32Trading-session date in YYYYMMDD form.
timeframeTimeframeBucket period this snapshot covers.
bucket_start_msi64Inclusive start of the bucket in milliseconds since midnight.
bucket_end_msi64Exclusive end of the bucket in milliseconds since midnight.
closedbooltrue if the bucket is closed; false for an intra-bucket partial snapshot.
countu32Total trade count in the bucket.
total_volumeu64Total volume in the bucket (shares).
total_valuef64Total dollar value in the bucket (USD).
buy_volumeu64Buyer-initiated volume (shares).
sell_volumeu64Seller-initiated volume (shares).
mid_volumeu64Mid-classified volume (shares).
buy_valuef64Buyer-initiated dollar value (USD).
sell_valuef64Seller-initiated dollar value (USD).
mid_valuef64Mid-classified dollar value (USD).
net_flowf64Net flow: buy_value − sell_value.
tick_rule_resolved_buysu32At-mid prints resolved by the tick-rule fallback to buy.
tick_rule_resolved_sellsu32At-mid prints resolved by the tick-rule fallback to sell.
tick_rule_unresolvedu32At-mid prints that fell through to the tick-rule fallback and could not be resolved (no prior different price). Stays in mid_* totals.

Configuration (StockFlowRequest)

Regenerated from the StockFlowRequest Rust source — see the note above.

FieldTypeDescription
contractsSecurityFilterContracts the subscription tracks. Stocks only — the analytic ignores option / index / rate ticks via the [thetadatadx::SecType] gate on the dispatch path. Typically a [SecurityFilter::Symbols] entry naming the equity tickers.
timeframeTimeframeBucket period. Defaults to [Timeframe::S1] (one-second buckets), the canonical intraday flow cadence.
emitEmitPolicyWhether the analytic emits one tick per closed bucket ([EmitPolicy::OnClose]) or after every admitted trade ([EmitPolicy::OnEveryTick]).
conditionsConditionPolicyTrade-condition admission policy.
venuesExchangeFilterExchange / venue admission policy.
classificationSideClassificationSide-classification policy applied to every admitted trade.
reference_quote_labelQuoteLabelQuote-cycle position cached as the Lee-Ready reference NBBO. Defaults to [QuoteLabel::PreTrade] per Lee & Ready (1991) §II.B.

Operational characteristics

Same shape as OptionFlow: O(1) per-tick update, Neumaier-summed running totals, replay-deterministic.

Example

Preview. This analytic ships in the engine and is reachable today through the Python wheel and the TypeScript / Node addon. A per-analytic builder on the public Rust thin client (kairos::Client) is tracked on the roadmap — bare-string symbol filters passed to the analytic accessor will match the other analytics already exposed there. The output tick rows are stable and documented above.

Proprietary. All rights reserved.