Config
Backtest
parse_filters_expr(s: str | None)
Parse a pyarrow.dataset filter expression from a string.
>>> parse_filters_expr('field("Currency") == "CHF"')
<pyarrow.dataset.Expression (Currency == "CHF")>
>>> parse_filters_expr("print('hello')")
>>> parse_filters_expr("None")
class BacktestVenueConfig
Bases: NautilusConfig
Represents a venue configuration for one specific backtest engine.
- Parameters:
- name (str) – The name of the venue.
- oms_type (OmsType | str) – The order management system type for the exchange. If
HEDGINGwill generate new position IDs. - account_type (AccountType | str) – The account type for the exchange.
- starting_balances (list [Money | str ]) – The starting account balances (specify one for a single asset account).
- base_currency (Currency | str , optional) – The account base currency for the exchange. Use
Nonefor multi-currency accounts. - default_leverage (float , optional) – The account default leverage (for margin accounts).
- leverages (dict *[*str , float ] , optional) – The instrument specific leverage configuration (for margin accounts).
- margin_model (MarginModelConfig , optional) – The margin calculation model configuration. Default ‘leveraged’.
- modules (list [ImportableActorConfig ] , optional) – The simulation modules for the venue.
- fill_model (ImportableFillModelConfig , optional) – The fill model for the venue.
- latency_model (ImportableLatencyModelConfig , optional) – The latency model for the venue.
- fee_model (ImportableFeeModelConfig , optional) – The fee model for the venue.
- book_type (str , default 'L1_MBP') – The default order book type.
- routing (bool , default False) – If multi-venue routing should be enabled for the execution client.
- reject_stop_orders (bool , default True) – If stop orders are rejected on submission if trigger price is in the market.
- support_gtd_orders (bool , default True) – If orders with GTD time in force will be supported by the venue.
- support_contingent_orders (bool , default True) – If contingent orders will be supported/respected by the venue. If False, then it’s expected the strategy will be managing any contingent orders.
- use_position_ids (bool , default True) – If venue position IDs will be generated on order fills.
- use_random_ids (bool , default False) – If all venue generated identifiers will be random UUID4’s.
- use_reduce_only (bool , default True) – If the reduce_only execution instruction on orders will be honored.
- bar_execution (bool , default True) – If bars should be processed by the matching engine(s) (and move the market).
- bar_adaptive_high_low_ordering (bool , default False) – Determines whether the processing order of bar prices is adaptive based on a heuristic.
This setting is only relevant when bar_execution is True.
If False, bar prices are always processed in the fixed order: Open, High, Low, Close.
If True, the processing order adapts with the heuristic:
- If High is closer to Open than Low then the processing order is Open, High, Low, Close.
- If Low is closer to Open than High then the processing order is Open, Low, High, Close.
- trade_execution (bool , default False) – If trades should be processed by the matching engine(s) (and move the market).
- allow_cash_borrowing (bool , default False) – If borrowing is allowed for cash accounts (negative balances).
- frozen_account (bool , default False) – If the account for this exchange is frozen (balances will not change).
- price_protection_points (int , default 0) – Defines an exchange-calculated price boundary (in points) to prevent marketable orders from executing at excessively aggressive prices.