/** * Walking the bars, for a study and for a strategy. * * Split from `run.ts` because they are two things. That file decides what an * engine is loaded with: the host record, the clock, the settings, the venue. * This one decides how the bars are then handed over, and the two differ by * exactly one thing, whether frames have to reach the engine between them. */ import type { CompiledProgram } from '../../core/emit/index.js'; import type { Engine } from '../../core/engine/index.js'; import type { ChartBar, ChartCalcContext, ChartSettings } from './contract.js'; import type { HeldVenue } from './venue.js'; /** * A run in hand, held between a chart's recomputes. * * The signature and the bar times are what a tail run is checked against before * it is trusted: splicing a tail onto a history that has changed underneath it * draws a wrong study that looks entirely plausible. */ export interface Held { readonly engine: Engine; readonly signature: string; count: number; firstTime: number; lastTime: number; /** * The destination this run's orders go to, for a strategy. * * Held with the engine because the two are one run: the venue holds the * orders that have not filled yet, and an engine continued onto a new bar * against a fresh venue would have its working orders silently forgotten. */ readonly venue: HeldVenue | null; } /** A study: every bar in one hand-over, which is what `run` is for. */ export declare function runWhole(engine: Engine, bars: readonly ChartBar[], ctx: ChartCalcContext | undefined, program: CompiledProgram, settings: ChartSettings): Held; /** * A strategy: one bar at a time, with the venue answering between them. * * The order is deliver, execute, then ask. A driver that asked the venue before * executing would price a fill against a bar the strategy had not seen yet, and * one that delivered after executing would let a script read a position its own * order on this bar had just created. * * `supplied` is the whole count rather than the index reached, so `bar.isLast` * means the same on this path as on the one above it: a strategy written to act * on the final bar acts on the final bar, not on every bar in turn. */ export declare function walkWith(engine: Engine, held: HeldVenue, bars: readonly ChartBar[], ctx: ChartCalcContext | undefined, program: CompiledProgram, settings: ChartSettings): Held; //# sourceMappingURL=driving.d.ts.map