Skip to content

Opening Auction Imbalance

Family: Flow surveillance

What it computes

Emits OpeningAuctionImbalanceTick 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 (buy_volume − sell_volume) / total_volume over the post-open 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 (OpeningAuctionImbalanceTick)

The field / type / description table below is regenerated from the OpeningAuctionImbalanceTick Rust source by docs-site/scripts/inject-doc-tables.ts on every npm run docs:build. Do not hand-edit between the sentinels.

FieldTypeDescription
symbolArc<str>Underlying symbol (interned).
datei32Trading-session date (YYYYMMDD).
ms_of_dayi32Milliseconds since midnight at emission time — the first post-window admission timestamp that triggered the seal.
window_start_msi32Window-start boundary (ms-of-day).
window_end_msi32Window-close boundary (ms-of-day) — window_start_ms + window_ms.
buy_volumei64Buyer-initiated share volume over the window.
sell_volumei64Seller-initiated share volume over the window.
total_volumei64Total classified share volume over the window — buy_volume + sell_volume. Indeterminate (zero-tick / first print) volume is excluded.
imbalancef64Signed-flow imbalance ratio (buy_volume − sell_volume) / total_volume. NaN when total_volume == 0.
n_printsi32Number of classified prints contributing to the imbalance.

Configuration (OpeningAuctionImbalanceParams)

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

FieldTypeDescription
contractsSecurityFilterContracts the subscription tracks. Stock-only — the analytic silently ignores option / index trades at the on_tick entry point.
conditionsConditionPolicyTrade-condition admission policy.
venuesExchangeFilterExchange / venue admission policy.
window_msi32Length of the opening auction window in milliseconds. Defaults to [DEFAULT_WINDOW_MS] (300_000 ms — five minutes).
session_open_ms_of_dayi32Session-open boundary in milliseconds-of-day. Defaults to [DEFAULT_SESSION_OPEN_MS] (34_200_000 — 09:30: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().opening_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()
  .openingAuctionImbalance(["QQQ"])
  .onEvent((tick) => {
    console.log(tick);
  });

Rust

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

use kairos::{Client, OpeningAuctionImbalanceRow};

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

let sub = client
    .live()
    .opening_auction_imbalance(["QQQ"])
    .on_event(|row: &OpeningAuctionImbalanceRow| println!("buy_volume={}", row.buy_volume))?;

// ... later, to stop delivery ...
sub.unsubscribe();
# Ok(())
# }

Proprietary. All rights reserved.