Skip to content

PIN Classic

Family: Microstructure

What it computes

Emits PinClassicTick ticks carrying pin, α, μ, ε_b off trade tape.

Available on the live, historical, and replay drives.

Methodology

Easley-López de Prado-O'Hara (2012) moment-proxy estimator PIN = μ̂/(μ̂ + 2ε̂) (EKOP 1996 tradition).

See the methodology overview for the citation index.

Inputs

Trade tape.

Key outputs

Pin, α, μ, ε_b. The full field set is in the tick table below.

Output schema (PinClassicTick)

The field / type / description table below is regenerated from the PinClassicTick 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) at emission time.
ms_of_dayi32Milliseconds since midnight at emission time.
pinf64Probability of Informed Trading on (α × μ) / (α × μ + 2 × εb) — the structural fraction of session volume attributable to informed traders under the EHO (1996) model. Rows are published only once at least one session has sealed and the ratio denominator is positive, so this field is always defined.
alphaf64Mean session-level imbalance share `mean(
muf64Mean session-level unconditional informed-arrival proxy `mean(
epsilon_bf64Mean session-level uninformed-buy proxy mean(min(B, S)).
epsilon_sf64Mean session-level uninformed-sell proxy mean(min(B, S)). Under the EHO bad-news / good-news symmetry εb and εs collapse to the same moment; the analytic surfaces both so consumers can audit the symmetry assumption against custom per-side overrides.
buys_counti32Cumulative admitted buy prints in the active (open) session.
sells_counti32Cumulative admitted sell prints in the active (open) session.
sessions_observedi32Number of completed sessions currently inside the lookback window. The open session is excluded — it contributes only when it seals on a date rollover.

Configuration (PinClassicParams)

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

FieldTypeDescription
contractsSecurityFilterContracts the subscription tracks. PIN runs off the stock trade tape with the NBBO providing the Lee-Ready signing context — the filter must resolve to stock contracts.
conditionsConditionPolicyTrade-condition admission policy applied to every print.
venuesExchangeFilterExchange / venue admission policy.
lookback_sessionsi32Number of completed sessions to fit the moment estimator against. Defaults to [DEFAULT_LOOKBACK_SESSIONS] (60).
min_emit_interval_msi32Minimum interval between consecutive emissions per symbol, in milliseconds. Defaults to [DEFAULT_MIN_EMIT_INTERVAL_MS] (60_000 ms). Set to 0 to surface every admitted print.

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().pin_classic(["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()
  .pinClassic(["QQQ"])
  .onEvent((tick) => {
    console.log(tick);
  });

Rust

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

use kairos::{Client, PinClassicRow};

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

let sub = client
    .live()
    .pin_classic(["QQQ"])
    .on_event(|row: &PinClassicRow| println!("pin={} alpha={}", row.pin, row.alpha))?;

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

Proprietary. All rights reserved.