UNPKG

kestrel.markets

Version:

A typed, token-efficient language + runtime for agentic trading: agents author bounded plans, the runtime fires them at the tick. CLI + typed library + MCP server.

30 lines (29 loc) 2.29 kB
/** * # fill — the FillModel seam + SimFillEngine (RUNTIME §6–7) * * The judge of the runtime. One seam ({@link FillModel}) returns a calibrated per-assessment * `pFill`, an expected fill price, and a definite floor `fill?` — never a bare boolean — and * every plan *and the structural null* cross the same model, so strategies are compared on * fills, not on fill assumptions (ARCHITECTURE §4). Two implementations bracket the truth: * * - {@link StrictCrossV1} — the **floor judge**: fills only on a strict tape cross, at the * resting price. Conservative by construction (`pFill ∈ {0,1}`). * - {@link MakerFairV1} — the **ceiling judge**: strict-cross ∪ a hazard of being filled * while resting at/near `fair`, with hazard **parameters injected as versioned data** * ({@link MakerFairHazardParams}); the shipped {@link MAKER_FAIR_DEFAULT_HAZARD} is clearly * labelled uncalibrated. * * {@link SimFillEngine} is the pure, time-injected state machine that rests orders, reassesses * them on book updates, and cash-settles at intrinsic — reporting both the floor outcome and * the E[$] under `pFill`. Same event sequence ⇒ same outcomes (RUNTIME §0). */ export { StrictCrossV1, MakerFairV1, MakerFairCalV1, STRICT_CROSS_LIMITS, MAKER_FAIR_LIMITS, loadEpisodeSigmoidParams, MAKER_FAIR_DEFAULT_HAZARD, makerFairHazard, strictCross, isCalibratedSupport, directionalPfill, classifyMoneyness, MONEYNESS_ATM_BAND, MONEYNESS_DEEP_OTM_FRAC, SELL_FAR_OTM_CAP, BUY_FAR_OTM_CROSSING, } from "./model.js"; export { guardIntent, guardedIntentOf, guardedPfill } from "./guarded-intent.js"; /** Per-contract option intrinsic — the single canonical `intrinsic(spot, strike, right)` from * `src/fair` (pure). The fill seam and settlement read the same function fair prices against * (RUNTIME §4/§6); it is re-exported here so fill consumers keep one import surface. */ export { intrinsic } from "../fair/index.js"; export { SimFillEngine, SETTLE_MARK_STALE_AFTER_MS, EPISODE_REMINT_DT_REF_MS } from "./engine.js"; export { SpotFillEngine, spotStrictCross } from "./spot.js"; export { markHeldLegsPerWake, OPTION_CONTRACT_MULTIPLIER } from "./mark-to-model.js"; export { heldPositionAsOfGradedBus, reconstructHeldOptionLegs } from "./held-position.js";