Skip to content

@livefolio/sdk / NextOpenFn

Type Alias: NextOpenFn

NextOpenFn = (asset, t) => Promise<{ price: number; t: Date; }>

Defined in: reference/backtest-executor.ts:21

Callback that resolves the next-open price for asset as seen from date t. BacktestExecutor calls this once per order to determine the fill price.

The function should return the opening price of the first trading session strictly after t, along with that session's timestamp. In a typical backtest setup this reads from the same data feed used to compute features.

Parameters

ParameterTypeDescription
assetAssetThe instrument being filled.
tDateThe date on which the rebalance order was submitted (the "signal date"). The fill should occur on the next open after this date to avoid look-ahead.

Returns

Promise<{ price: number; t: Date; }>

An object with the fill timestamp t and the opening price.

Released under the MIT License.