tensortrade.actions.dynamic_orders module

class tensortrade.actions.dynamic_orders.DynamicOrders(criteria=None, trade_sizes=10, trade_type=<TradeType.MARKET: 'market'>, order_listener=None)[source]

Bases: tensortrade.actions.action_scheme.ActionScheme

A discrete action scheme that determines actions based on a list of trading pairs, order criteria, and trade sizes.

__init__(criteria=None, trade_sizes=10, trade_type=<TradeType.MARKET: 'market'>, order_listener=None)[source]
Parameters:
  • pairs – A list of trading pairs to select from when submitting an order.
  • TradingPair ((e.g.) –
  • criteria (Union[List[ForwardRef], ForwardRef]) – A list of order criteria to select from when submitting an order.
  • MarketOrder, LimitOrder w/ price, StopLoss, etc.) ((e.g.) –
  • trade_sizes (Union[List[float], int]) – A list of trade sizes to select from when submitting an order.
  • '[1, 1/3]' = 100% or 33% of balance is tradeable. '4' = 25%, 50%, 75%, or 100% of balance is tradeable.) ((e.g.) –
  • order_listener (optional) – An optional listener for order events executed by this action scheme.
action_space

The discrete action space produced by the action scheme.

Return type:Discrete
criteria

A list of order criteria to select from when submitting an order. (e.g. MarketOrderCriteria, LimitOrderCriteria, StopLossCriteria, CustomCriteria, etc.)

Return type:List[ForwardRef]
get_order(action, portfolio)[source]

Get the order to be executed on the exchange based on the action provided.

Parameters:
  • action (int) – The action to be converted into an order.
  • exchange – The exchange the action will be executed on.
  • portfolio (Portfolio) – The portfolio of wallets used to execute the action.
Return type:

Order

Returns:

The order to be executed on the exchange this time step.

trade_sizes

A list of trade sizes to select from when submitting an order. (e.g. ‘[1, 1/3]’ = 100% or 33% of balance is tradeable. ‘4’ = 25%, 50%, 75%, or 100% of balance is tradeable.)

Return type:List[float]