Appearance
Aggressor Intensity
Family: Flow surveillance
What it computes
Emits AggressorIntensityTick ticks carrying buy_rate, sell_rate, aggressor_rate, buy_events_in_window, sell_events_in_window off stock trade tape.
Available on the live, historical, and replay drives.
Methodology
Lee-Ready (1991) aggressor-rate streaming aggregator; buyer / seller / total classified rate over a rolling time window.
See the methodology overview for the citation index.
Inputs
Stock trade tape.
Key outputs
Buy_rate, sell_rate, aggressor_rate, buy_events_in_window, sell_events_in_window. The full field set is in the tick table below.
Output schema (AggressorIntensityTick)
The field / type / description table below is regenerated from the AggressorIntensityTick 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 |
|---|---|---|
symbol | Arc<str> | Underlying symbol (interned). |
date | i32 | Trading-session date (YYYYMMDD). |
ms_of_day | i32 | Milliseconds since midnight at emission time. |
buy_rate | f64 | Buyer-initiated prints per second over the rolling window. |
sell_rate | f64 | Seller-initiated prints per second over the rolling window. |
aggressor_rate | f64 | Total classified (non-zero-tick) prints per second — the buy_rate + sell_rate aggressor cadence. |
buy_events_in_window | i32 | Number of buyer-initiated prints currently inside the window. |
sell_events_in_window | i32 | Number of seller-initiated prints currently inside the window. |
Configuration (AggressorIntensityParams)
Regenerated from the AggressorIntensityParams Rust source — see the note above.
| Field | Type | Description |
|---|---|---|
contracts | SecurityFilter | Contracts the subscription tracks. Stock-only — the analytic silently ignores option / index trades at the on_tick entry point. |
conditions | ConditionPolicy | Trade-condition admission policy applied to every trade print. |
venues | ExchangeFilter | Exchange / venue admission policy. |
window_ms | i32 | Rolling-window length in milliseconds. Defaults to [DEFAULT_WINDOW_MS] (1_000 ms). |
min_emit_interval_ms | i32 | Minimum interval between consecutive emissions per symbol, in milliseconds. Defaults to [DEFAULT_MIN_EMIT_INTERVAL_MS] (1_000 ms). Set to 0 to surface every admission. |
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().aggressor_intensity(["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()
.aggressorIntensity(["QQQ"])
.onEvent((tick) => {
console.log(tick);
});Rust
rust
// Cargo.toml:
// kairos = "0.1"
use kairos::{Client, AggressorIntensityRow};
# fn run() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::connect(("me@example.com", "secret"))?;
let sub = client
.live()
.aggressor_intensity(["QQQ"])
.on_event(|row: &AggressorIntensityRow| {
println!("buy_rate={} sell_rate={}", row.buy_rate, row.sell_rate)
})?;
// ... later ...
sub.unsubscribe();
# Ok(())
# }