class tensortrade.env.default.actions.BSH(cash: Wallet, asset: Wallet)[source]

A simple discrete action scheme where the only options are to buy, sell, or hold.

Parameters: cash (Wallet) – The wallet to hold funds in the base intrument. asset (Wallet) – The wallet to hold funds in the quote instrument.
action_space

attach(listener)[source]
get_orders(action: int, portfolio: tensortrade.oms.wallets.portfolio.Portfolio) → tensortrade.oms.orders.order.Order[source]

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

Parameters: action (Any) – The action to be interpreted. portfolio ('Portfolio') – The portfolio defined for the environment. List[Order] – A list of orders to be submitted to the broker.
registered_name = 'bsh'
reset()[source]

Resets the action scheme.

class tensortrade.env.default.actions.ManagedRiskOrders(stop: List[float] = [0.02, 0.04, 0.06], take: List[float] = [0.01, 0.02, 0.03], trade_sizes: Union[List[float], int] = 10, durations: Union[List[int], int, None] = None, trade_type: tensortrade.oms.orders.trade.TradeType = <TradeType.MARKET: 'market'>, order_listener: Optional[tensortrade.oms.orders.order_listener.OrderListener] = None, min_order_pct: float = 0.02, min_order_abs: float = 0.0)[source]
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.
action_space

get_orders(action: int, portfolio: tensortrade.oms.wallets.portfolio.Portfolio) → List[tensortrade.oms.orders.order.Order][source]

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

Parameters: action (Any) – The action to be interpreted. portfolio ('Portfolio') – The portfolio defined for the environment. List[Order] – A list of orders to be submitted to the broker.
class tensortrade.env.default.actions.SimpleOrders(criteria: Union[List[OrderCriteria], OrderCriteria] = None, trade_sizes: Union[List[float], int] = 10, durations: Union[List[int], int] = None, trade_type: TradeType = <TradeType.MARKET: 'market'>, order_listener: OrderListener = None, min_order_pct: float = 0.02, min_order_abs: float = 0.0)[source]

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

Parameters: criteria (List[OrderCriteria]) – A list of order criteria to select from when submitting an order. (e.g. MarketOrder, LimitOrder w/ price, StopLoss, etc.) 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.
action_space

get_orders(action: int, portfolio: tensortrade.oms.wallets.portfolio.Portfolio) → List[tensortrade.oms.orders.order.Order][source]

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

Parameters: action (Any) – The action to be interpreted. portfolio ('Portfolio') – The portfolio defined for the environment. List[Order] – A list of orders to be submitted to the broker.
class tensortrade.env.default.actions.TensorTradeActionScheme[source]

An abstract base class for any ActionScheme that wants to be compatible with the built in OMS.

The structure of the action scheme is built to make sure that action space can be used with the system, provided that the user defines the methods to interpret that action.

portfolio

The portfolio object to be used in defining actions.

Type: ‘Portfolio’
broker

The broker object to be used for placing orders in the OMS.

Type: ‘Broker’
perform(env, portfolio)[source]

Performs the action on the given environment.

get_orders(action, portfolio)[source]

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

clock

The reference clock from the environment. (Clock)

When the clock is set for the we also set the clock for the portfolio as well as the exchanges defined in the portfolio.

Returns: Clock – The environment clock.
get_orders(action: Any, portfolio: tensortrade.oms.wallets.portfolio.Portfolio) → List[tensortrade.oms.orders.order.Order][source]

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

Parameters: action (Any) – The action to be interpreted. portfolio ('Portfolio') – The portfolio defined for the environment. List[Order] – A list of orders to be submitted to the broker.
perform(env: tensortrade.env.generic.environment.TradingEnv, action: Any) → None[source]

Performs the action on the given environment.

Under the TT action scheme, the subclassed action scheme is expected to provide a method for getting a list of orders to be submitted to the broker for execution in the OMS.

Parameters: env ('TradingEnv') – The environment to perform the action on. action (Any) – The specific action selected from the action space.
reset() → None[source]

Resets the action scheme.

tensortrade.env.default.actions.get(identifier: str) → tensortrade.env.generic.components.action_scheme.ActionScheme[source]

Gets the ActionScheme that matches with the identifier.

Parameters: identifier (str) – The identifier for the ActionScheme. ‘ActionScheme’ – The action scheme associated with the identifier. KeyError: – Raised if the identifier is not associated with any ActionScheme.