Skip to content

SessionFill


dataclass backtide.live.SessionFill

Result of matching one simulated order.

Attributes

order : Order

Submitted order after any sizer resolution.

timestamp : int
Fill, cancellation, or rejection Unix timestamp in seconds.

status : OrderStatus
Terminal order status.

fill_price : float | None
Executed quote-currency price, or None when not filled.

commission : float
Fee charged in the simulated account's base currency.

realized_pnl : float | None
Change in realized PnL from this fill, net of its commission.

reason : str
Human-readable matching or rejection reason.


See Also

SessionUpdate

State transition produced after processing a market update.


Example

>>> from backtide.backtest import Order
>>> from backtide.live import MarketUpdate, Session

>>> market = MarketUpdate(
...     "BTC-USD", "1m", 1_700_000_000, 1_700_000_060,
...     100.0, 102.0, 99.0, 101.0,
... )
>>> fill = Session().on_bar(market, [Order("BTC-USD", 1.0)]).fills[0]
>>> print(fill.fill_price)

101.0