Skip to content

CVD

Family: Microstructure

What it computes

Emits CvdTick ticks carrying cumulative_buy / sell, cvd, delta_bar off trade tape.

Available on the live, historical, and replay drives.

Methodology

Cumulative volume delta + Lee-Ready.

See the methodology overview for the citation index.

Inputs

Trade tape.

Key outputs

Cumulative_buy / sell, cvd, delta_bar. The full field set is in the tick table below.

Output schema (CvdTick)

The field / type / description table below is regenerated from the CvdTick 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. CVD is a stock analytic, so expiration, right, and strike will always be None on emitted ticks.
datei32Trading-session date of the bar boundary (YYYYMMDD).
ms_of_dayi32Millisecond-of-day at which the snapshot was emitted — equal to bar_start_ms + bar_size_ms for closed bars.
cumulative_buy_volumef64Cumulative buyer-aggressor share volume from session open through the bar boundary.
cumulative_sell_volumef64Cumulative seller-aggressor share volume from session open through the bar boundary.
cvdf64Signed cumulative volume delta: cumulative_buy_volume − cumulative_sell_volume. Positive values indicate net buy-side aggression; negative values indicate net sell-side aggression.
delta_last_barf64Net buy-minus-sell volume printed inside the just-closed bar, i.e. (cumulative_buy − cumulative_sell) at the bar boundary minus the same quantity at the previous emission.
bar_start_msi32Bar boundary in millisecond-of-day form. Always an integer multiple of the spec's bar_size_ms.

Configuration (CvdParams)

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

FieldTypeDescription
contractsSecurityFilterContracts the subscription tracks. Stock contracts only; option / index / rate ticks are rejected at the dispatch gate.
bar_size_msi32Bar-emission cadence in milliseconds. CVD snapshots emit at integer multiples of bar_size_ms past midnight. Defaults to 60_000 (one-minute bars), the standard cadence for algorithmic-trading CVD feeds; production deployments may override (e.g. 5_000 for sub-minute monitoring, 300_000 for five-minute swing dashboards).
conditionsConditionPolicyTrade-condition admission policy.
venuesExchangeFilterExchange / venue admission policy.

Example

Python

python
import kairos_thetadata as kt

client = kt.Client.connect(kt.Credentials.from_env())

def on_event(row):
    print(row)

sub = client.live().cvd(["QQQ"]).on_event(on_event)
sub.wait(timeout_seconds=60.0)

TypeScript

typescript
import { Client, Credentials } from "kairos-thetadata";

const client = await Client.connect(Credentials.fromEnv());

await client
  .live()
  .cvd(["QQQ"])
  .onEvent((tick) => {
    console.log(tick);
  });

Rust

rust
// Cargo.toml:
//   kairos = "0.1"

use kairos::{Client, CvdRow};

# fn run() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::connect(("me@example.com", "secret"))?;

let sub = client
    .live()
    .cvd(["QQQ"])
    .on_event(|row: &CvdRow| {
        println!("cvd={} delta_last_bar={}", row.cvd, row.delta_last_bar)
    })?;
// ... later ...
sub.unsubscribe();
# Ok(())
# }

Proprietary. All rights reserved.