SessionConfig
dataclass backtide.live.SessionConfig
Configuration for a live simulated session.
| Attributes |
initial_cash : float, default=100000
Starting cash balance in
base_currency : Currency, default=Currency.USDbase_currency.
Accounting currency for cash, fills, and equity.
commission_pct : float, default=0
Percentage commission charged on every fill (for example,
commission_fixed : float, default=00.1
means 0.1%).
Fixed commission charged on every fill.
slippage : float, default=0
Percentage slippage applied to fills.
allow_short : bool, default=False
Whether fills may create a negative position.
allow_margin : bool, default=False
Whether fills may create a negative cash balance.
trade_on_partial : bool, default=False
Whether strategy and order processing runs on incomplete candles.
Keeping the default avoids repeated decisions on the same candle.
max_history : int, default=10000
Maximum bars retained per symbol for strategy evaluation.
max_leverage : float, default=2
Maximum gross exposure divided by current equity when margin is enabled.
initial_margin : float, default=50
Minimum equity percentage required when increasing exposure.
maintenance_margin : float, default=25
Minimum equity percentage maintained against gross exposure. Breaches
trigger deterministic simulated liquidation.
margin_interest : float, default=0
Annual percentage charged on negative base-currency cash.
borrow_rate : float, default=0
Annual percentage charged on short notional.
max_position_size : float, default=100
Maximum absolute per-symbol notional as a percentage of equity.
max_drawdown : float, default=0
Drawdown percentage that halts exposure-increasing orders. Zero disables
the guard.
allowed_order_types : list[str | OrderType], default=all order types
Order types accepted by the simulation broker.
partial_fills : bool, default=False
Whether fills are capped by
max_volume_participation : float, default=100max_volume_participation.
Maximum percentage of a candle's volume available to one simulated fill.
metrics : list[str | BaseMetric | dict[str, BaseMetric]]
Built-in metric keys or custom Python metric instances maintained during the session.
Python instances are retained in memory while serialized configurations contain names.
risk_free_rate : float, default=0
Annual risk-free rate used by risk-adjusted performance metrics.
|
Example
>>> from backtide.live import SessionConfig
>>> config = SessionConfig(
... initial_cash=25_000,
... commission_pct=0.1,
... slippage=0.05,
... )
>>> print(config.initial_cash)
25000.0