Portfolio

The Python Portfolio exposes read‑only account, PnL, exposure, margin, and snapshot queries. Instrument PnL and exposure queries accept fresh price overrides where applicable, and all eight scalar and collection PnL and exposure queries accept an optional target currency. Conversion failure returns no value for scalar methods and net_exposures, while PnL collection methods raise. No method returns a partial mixed‑currency total. The authoritative update and lifecycle commands remain internal to the Rust engine.

class Portfolio

Bases: object

Wrapper providing shared access to [Portfolio] from Python.

account(venue=None, account_id=None)

Returns a detached, point-in-time copy of the account.

The copy does not reflect later account updates, and changing it does not affect the Portfolio. Call account() again to obtain the latest account state.

balances_locked(venue=None, account_id=None)
build_snapshot(account_id)
equity(venue=None, account_id=None)
instrument_initial_margins(venue=None, account_id=None)
instrument_maintenance_margins(venue=None, account_id=None)
is_completely_net_flat(account_id=None)
is_initialized()
is_net_flat(instrument_id, account_id=None)
is_net_long(instrument_id, account_id=None)
is_net_short(instrument_id, account_id=None)
mark_values(venue=None, account_id=None)
missing_price_instruments(venue, account_id=None)
net_exposure(instrument_id, price=None, account_id=None, target_currency=None)
net_exposures(venue=None, account_id=None, target_currency=None)
net_position(instrument_id, account_id=None)
realized_pnl(instrument_id, account_id=None, target_currency=None)
realized_pnls(venue=None, account_id=None, target_currency=None)
snapshots(account_id)
statistics()
total_pnl(instrument_id, price=None, account_id=None, target_currency=None)
total_pnls(venue=None, account_id=None, target_currency=None)
unrealized_pnl(instrument_id, price=None, account_id=None, target_currency=None)
unrealized_pnls(venue=None, account_id=None, target_currency=None)
class PortfolioConfig

Bases: object

Configuration for Portfolio instances.

bar_updates
convert_to_account_base_currency
debug
equity_curve
min_account_state_logging_interval_ms
snapshot_interval_ms
use_mark_prices
use_mark_xrates