Appearance
Box Spread Arb Residual
Family: Stat-arb
What it computes
Emits BoxSpreadArbResidualTick ticks carrying tenor_years, pairs_used, max_abs_residual, per_pair (strike_low, strike_high, box_cost, discounted_payoff, residual_value) off chain snapshot.
Available on the live and replay drives. The historical drive fails closed with KAIROS_ERR_HISTORICAL_UNWIRED until the relevant cache is hydrated externally.
Methodology
Stoll (1969) / Hull (2018) four-leg European box-spread residual (C(K1) − P(K1)) − (C(K2) − P(K2)) − (K2 − K1) · e^{-rT} at every adjacent shared call+put strike pair — companion to box_spread (which solves implied funding).
See the methodology overview for the citation index.
Inputs
Chain snapshot.
Key outputs
Tenor_years, pairs_used, max_abs_residual, per_pair (strike_low, strike_high, box_cost, discounted_payoff, residual_value). The full field set is in the tick table below.
Output schema (BoxSpreadArbResidualTick)
The field / type / description table below is regenerated from the BoxSpreadArbResidualTick 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. |
expiration | i32 | Expiration YYYYMMDD anchoring the box residuals. |
tenor_years | f64 | Tenor in calendar years used in the discounting factor. |
pairs_used | i32 | Count of adjacent box-spread pairs the residual sweep admitted. |
max_abs_residual | f64 | Maximum absolute residual across the admitted pairs — the chain's worst-case box-spread mispricing magnitude. |
per_pair | Vec<BoxResidualPoint> | Per-pair residual points. |
Configuration (BoxSpreadArbResidualParams)
Regenerated from the BoxSpreadArbResidualParams Rust source — see the note above.
| Field | Type | Description |
|---|---|---|
contracts | SecurityFilter | Underlying symbols the subscription tracks. |
conditions | ConditionPolicy | Trade-condition admission policy. |
venues | ExchangeFilter | Exchange / venue admission policy. |
daily_close | Arc<DailyCloseCache> | Boot-time hydrated daily-close history. Placeholder slot. |
min_strikes | i32 | Minimum number of shared call+put strikes for the box residual sweep. Defaults to [DEFAULT_MIN_STRIKES] (2). |
target_expiration | i32 | Target expiration YYYYMMDD. 0 selects the front expiration. |
risk_free_rate | f64 | Annualised continuously-compounded risk-free rate. |
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().box_spread_arb_residual(["SPX"]).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()
.boxSpreadArbResidual(["SPX"])
.onEvent((tick) => {
console.log(tick);
});Rust
rust
// Cargo.toml:
// kairos = "0.1"
use kairos::{Client, BoxSpreadArbResidualRow};
# fn run() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::connect(("me@example.com", "secret"))?;
let sub = client
.live()
.box_spread_arb_residual(["SPX"])
.on_event(|row: &BoxSpreadArbResidualRow| {
println!("max_abs_residual={} pairs_used={}", row.max_abs_residual, row.pairs_used)
})?;
// ... later ...
sub.unsubscribe();
# Ok(())
# }