SessionSnapshot
dataclass backtide.live.SessionSnapshot
Mark-to-market snapshot of a simulated account.
| Attributes |
portfolio : Portfolio
Cash, positions, and currently resting orders.
latest_prices : dict[str, float]
Latest valid close per canonical symbol.
equity : float
Cash plus positions marked to
realized_pnl : floatlatest_prices.
Cumulative realized PnL net of commissions.
unrealized_pnl : float
Open-position PnL marked to
processed_bars : intlatest_prices.
Number of updates that triggered matching or strategy evaluation.
gross_exposure : float
Sum of absolute marked position values.
net_exposure : float
Signed marked value of all positions.
leverage : float
Gross exposure divided by equity.
buying_power : float
Remaining gross exposure capacity under the configured leverage cap.
drawdown : float
Fractional decline from peak session equity.
peak_equity : float
Highest marked equity observed during the session.
total_costs : float
Cumulative commissions, margin interest, and short-borrow charges.
trading_halted : bool
Whether a configured risk guard is rejecting exposure-increasing orders.
halt_reason : str | None
Human-readable reason for the active risk halt.
metrics : dict[str, float]
Selected live-compatible performance metrics computed from session state.
|
Example
>>> from backtide.live import Session
>>> snapshot = Session().snapshot()
>>> print(snapshot.equity)
100000.0
>>> print(snapshot.portfolio.positions)
{}