Appearance
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.
| Field | Type | Description |
|---|---|---|
contract | Contract | Resolved 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. |
date | i32 | Trading-session date of the bar boundary (YYYYMMDD). |
ms_of_day | i32 | Millisecond-of-day at which the snapshot was emitted — equal to bar_start_ms + bar_size_ms for closed bars. |
cumulative_buy_volume | f64 | Cumulative buyer-aggressor share volume from session open through the bar boundary. |
cumulative_sell_volume | f64 | Cumulative seller-aggressor share volume from session open through the bar boundary. |
cvd | f64 | Signed 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_bar | f64 | Net 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_ms | i32 | Bar 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.
| Field | Type | Description |
|---|---|---|
contracts | SecurityFilter | Contracts the subscription tracks. Stock contracts only; option / index / rate ticks are rejected at the dispatch gate. |
bar_size_ms | i32 | Bar-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). |
conditions | ConditionPolicy | Trade-condition admission policy. |
venues | ExchangeFilter | Exchange / 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(())
# }