Skip to content

Portfolio


dataclass backtide.backtest.Portfolio

A snapshot of the portfolio's holdings at a point in time.

Cash is represented as a mapping from currency to amount, allowing multi-currency portfolios. Positions are a mapping from ticker symbol to signed quantity (positive = long, negative = short).

Attributes

cash : dict[Currency, float]

Cash balances keyed by currency. Each value is the amount held in that currency.

positions : dict[str, float]
Open positions keyed by ticker symbol. Positive values are long positions, negative values are short positions. Fractional values are supported only for crypto instruments (e.g., 0.0234 BTC).

orders : list[Order]
Currently open (unfilled) orders.


See Also

ExperimentConfig

Complete configuration for a single backtest experiment.

Order

A trading order submitted during the simulation.

State

The simulation state passed to a strategy's evaluate method on every tick.