Tradomate Config
The configuration of your trading bot is done through the TradomateConfig object.
This object is passed to the strategy_info function, which is the first function that is called
when your strategy is executed. You can setup the different configurations here.
It is also passed to your strategy function as the first argument. This allows you to access the configuration from within your strategy function.
Configuration options
Section titled “Configuration options”| Option | Type | Description | Default Value |
|---|---|---|---|
symbols | List[str] | List of symbols to trade. This cannot be changed or set manually. | The symbol selected to trade |
initial_capital | float | Initial capital to trade with | 1000000 |
Custom configuration
Section titled “Custom configuration”You can add your own custom configuration options to the TradomateConfig object.
This can be done by adding a new key-value pair to the config object.
Example usage
Section titled “Example usage”import tradomate as tm
def strategy_info(config: tm.TradomateConfig): # Setting initial capital config.initial_capital = 1000
# Creating a custom configuration option for length of EMA config.length = 14
@tm.strategy()def my_handler(config: tm.TradomateConfig, data: tm.TradomateData): # Build your Trading Strategy here.
# Get the length of EMA from the config ema = tm.ta.ema(data.close, timeperiod=config.length)
# Rest of the strategy if tm.ta.cross_over(ema, data.close): tm.enter_long_position_market( quantity=config.quantity, comment="Long", )
if tm.ta.cross_under(ema, data.close): tm.enter_short_position_market( quantity=config.quantity, comment="Short", )