Appearance
Closing Auction Imbalance
Family: Flow surveillance
What it computes
Emits ClosingAuctionImbalanceTick ticks carrying window_start_ms, window_end_ms, buy_volume, sell_volume, total_volume, imbalance, n_prints off stock trade tape.
Available on the live, historical, and replay drives.
Methodology
Lee-Ready (1991) signed-volume imbalance over the pre-close auction window.
See the methodology overview for the citation index.
Inputs
Stock trade tape.
Key outputs
Window_start_ms, window_end_ms, buy_volume, sell_volume, total_volume, imbalance, n_prints. The full field set is in the tick table below.
Output schema (ClosingAuctionImbalanceTick)
The field / type / description table below is regenerated from the ClosingAuctionImbalanceTick 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 — the first post-close admission (or watermark) timestamp that triggered the seal. |
window_start_ms | i32 | Window-start boundary (ms-of-day) — session_close_ms_of_day − window_ms. |
window_end_ms | i32 | Window-close boundary (ms-of-day). |
buy_volume | i64 | Buyer-initiated share volume over the window. |
sell_volume | i64 | Seller-initiated share volume over the window. |
total_volume | i64 | Total classified share volume over the window — buy_volume + sell_volume. Indeterminate (zero-tick / first print) volume is excluded. |
imbalance | f64 | Signed-flow imbalance ratio (buy_volume − sell_volume) / total_volume. NaN when total_volume == 0. |
n_prints | i32 | Number of classified prints contributing to the imbalance. |
Configuration (ClosingAuctionImbalanceParams)
Regenerated from the ClosingAuctionImbalanceParams 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. |
venues | ExchangeFilter | Exchange / venue admission policy. |
window_ms | i32 | Length of the closing auction window in milliseconds. Defaults to [DEFAULT_WINDOW_MS] (300_000 ms — five minutes). |
session_close_ms_of_day | i32 | Session-close boundary in milliseconds-of-day. Defaults to [DEFAULT_SESSION_CLOSE_MS] (57_600_000 — 16:00:00 ET). |
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().closing_auction_imbalance(["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()
.closingAuctionImbalance(["QQQ"])
.onEvent((tick) => {
console.log(tick);
});Rust
rust
// Cargo.toml:
// kairos = "0.1"
use kairos::{Client, ClosingAuctionImbalanceRow};
# fn run() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::connect(("me@example.com", "secret"))?;
let sub = client
.live()
.closing_auction_imbalance(["QQQ"])
.on_event(|row: &ClosingAuctionImbalanceRow| {
println!("imbalance={} total_volume={}", row.imbalance, row.total_volume)
})?;
// ... later ...
sub.unsubscribe();
# Ok(())
# }