tensortrade.env.actions.managed_risk_orders module

class tensortrade.env.actions.managed_risk_orders.ManagedRiskOrders(*args, **kwargs)[source]

Bases: AbstractActionScheme

A discrete action scheme that determines actions based on managing risk,

through setting a follow-up stop loss and take profit on every order.

Parameters:
  • stop (List[float]) – A list of possible stop loss percentages for each order.

  • take (List[float]) – A list of possible take profit percentages for each order.

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

  • durations (List[int]) – A list of durations to select from when submitting an order.

  • trade_type (TradeType) – A type of trade to make.

  • order_listener (OrderListener) – A callback class to use for listening to steps of the order process.

  • min_order_pct (float) – The minimum value when placing an order, calculated in percent over net_worth.

  • min_order_abs (float) – The minimum value when placing an order, calculated in absolute order value.

property action_space: Space

The action space of the TradingEnv.

Returns:

The gymnasium action space of the TradingEnv.

Return type:

Space

get_orders(action: int) List[Order][source]

Gets the list of orders to be submitted for the given action.

Parameters:

action (gymnasium.core.ActType) – The action to be interpreted.

Returns:

A list of orders to be submitted to the broker.

Return type:

List[Order]

registered_name = 'managed-risk'