tensortrade.actions.multi_discrete_action_strategy module

class tensortrade.actions.multi_discrete_action_strategy.MultiDiscreteActionStrategy(instrument_symbols, actions_per_instrument=20, max_allowed_slippage_percent=1.0)[source]

Bases: tensortrade.actions.action_strategy.ActionStrategy

Discrete strategy, which calculates the trade amount as a fraction of the total balance for each instrument provided.

__init__(instrument_symbols, actions_per_instrument=20, max_allowed_slippage_percent=1.0)[source]
Parameters
  • instrument_symbols (List[str]) – The exchange symbols of the instruments being traded.

  • actions_per_instrument (int) – The number of bins to divide the total balance by. Defaults to 20 (i.e. 1/20, 2/20, …, 20/20).

  • max_allowed_slippage – The maximum amount above the current price the strategy will pay for an instrument. Defaults to 1.0 (i.e. 1%).

property dtype

A type or str corresponding to the dtype of the action_space.

Return type

Union[type, str]

get_trade(action)[source]

The trade type is determined by action % len(TradeType), and the trade amount is determined by the multiplicity of the action.

For example, 0 = HOLD, 1 = LIMIT_BUY|0.25, 2 = MARKET_BUY|0.25, 5 = HOLD, 6 = LIMIT_BUY|0.5, 7 = MARKET_BUY|0.5, etc.

Return type

Trade