tensortrade.actions.simple_orders module

class tensortrade.actions.simple_orders.SimpleOrders(criteria=None, trade_sizes=10, trade_type=<TradeType.MARKET: 'market'>, durations=None, 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'>, durations=None, 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.
compile()[source]
criteria

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

Return type:List[ForwardRef]
durations

A list of durations to select from when submitting an order.

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

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

Parameters:
  • action (int) – any The action to be converted into an order.
  • portfolio (Portfolio) – ‘Portfolio’ The portfolio the environment is operating on.
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]