Skip to content

ExchangeExpConfig


dataclass backtide.backtest.ExchangeExpConfig

Exchange and execution settings for an experiment.

Attributes

commission_type : str | CommissionType, default="percentage"

Fee structure applied to every executed order.

commission_pct : float, default=0.1
Percentage commission per trade.

commission_fixed : float, default=0.0
Fixed commission per trade.

slippage : float, default=0.05
Simulated market-impact percentage.

allowed_order_types : list[str | OrderType], default=["market"]
Which order types the engine accepts.

partial_fills : bool, default=False
Whether to simulate partial order fills.

allow_margin : bool, default=False
Whether margin trading is enabled.

max_leverage : float, default=2.0
Maximum leverage ratio.

initial_margin : float, default=50.0
Initial margin percentage.

maintenance_margin : float, default=25.0
Maintenance margin percentage.

margin_interest : float, default=0.0
Annual interest rate on borrowed funds.

raise_on_margin_limit : bool, default=False
If True, the engine raises an error when an order would breach max_leverage or when equity falls below maintenance_margin. If False, orders are auto-shrunk or rejected and a warning is recorded instead. Does not affect max_position_size, which always rejects (never aborts) independently.

allow_short_selling : bool, default=False
Whether short selling is permitted.

borrow_rate : float, default=0.0
Annual borrow cost for short positions.

raise_on_short_violation : bool, default=False
If True, the engine raises an error when a sell order would create or increase a short position while allow_short_selling is False. If False, such orders are silently rejected with a warning instead of aborting the run.

max_position_size : int, default=100
Max allocation to one position (% of portfolio equity).

conversion_mode : str | CurrencyConversionMode, default="immediate"
How foreign-currency proceeds are converted.

conversion_threshold : float | None, default=None
Threshold for HoldUntilThreshold mode.

conversion_period : str | ConversionPeriod | None, default=None
Period for EndOfPeriod mode.

conversion_interval : int | None, default=None
Bar count for CustomInterval mode.


See Also

DataExpConfig

Data settings for an experiment.

ExperimentConfig

Complete configuration for a single backtest experiment.

PortfolioExpConfig

Portfolio settings for an experiment.


Methods

to_dict Convert to a dictionary.


method backtide.backtestto_dict()

Convert to a dictionary.

Returns

dict

Self as dict.