Appearance
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.
| Field | Type | Description |
|---|---|---|
symbol | Arc<str> | Underlying symbol (interned). |
date | i32 | Trading-session date (YYYYMMDD) at emission time. |
ms_of_day | i32 | Milliseconds since midnight at emission time. |
pin | f64 | Probability 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. |
alpha | f64 | Mean session-level imbalance share `mean( |
mu | f64 | Mean session-level unconditional informed-arrival proxy `mean( |
epsilon_b | f64 | Mean session-level uninformed-buy proxy mean(min(B, S)). |
epsilon_s | f64 | Mean 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_count | i32 | Cumulative admitted buy prints in the active (open) session. |
sells_count | i32 | Cumulative admitted sell prints in the active (open) session. |
sessions_observed | i32 | Number 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.
| Field | Type | Description |
|---|---|---|
contracts | SecurityFilter | Contracts 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. |
conditions | ConditionPolicy | Trade-condition admission policy applied to every print. |
venues | ExchangeFilter | Exchange / venue admission policy. |
lookback_sessions | i32 | Number of completed sessions to fit the moment estimator against. Defaults to [DEFAULT_LOOKBACK_SESSIONS] (60). |
min_emit_interval_ms | i32 | Minimum 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(())
# }