tensortrade.orders.trade module

class tensortrade.orders.trade.Trade(order_id, exchange_id, step, pair, side, trade_type, quantity, price, commission)[source]

Bases: tensortrade.base.core.TimedIdentifiable

A trade object for use within trading environments.

__init__(order_id, exchange_id, step, pair, side, trade_type, quantity, price, commission)[source]
Parameters:
  • order_id (str) – The id of the order that created the trade.
  • exchange_id (str) – The id of the exchange the trade was executed on.
  • step (int) – The timestep the trade was made during the trading episode.
  • pair (TradingPair) – The trading pair of the instruments in the trade.
  • BTC/USDT, ETH/BTC, ADA/BTC, AAPL/USD, NQ1!/USD, CAD/USD, etc) ((e.g.) –
  • side (TradeSide) – Whether the quote instrument is being bought or sold.
  • BUY = trade the base_instrument for the quote_instrument in the pair. SELL = trade the quote_instrument for the base_instrument) ((e.g.) –
  • size – The size of the base instrument in the trade.
  • 1000 shares, 6.50 satoshis, 2.3 contracts, etc) ((e.g.) –
  • price (float) – The price paid per quote instrument in terms of the base instrument.
  • 10000 represents $10,000.00 if the base_instrument is "USD") ((e.g.) –
  • commission (Quantity) – The commission paid for the trade in terms of the base instrument.
  • 10000 represents $10,000.00 if the base_instrument is "USD")
base_instrument
Return type:Instrument
commission
Return type:Quantity
is_buy
Return type:bool
is_limit_order
Return type:bool
is_market_order
Return type:bool
is_sell
Return type:bool
price
Return type:float
quote_instrument
Return type:Instrument
size
Return type:float
to_dict()[source]
to_json()[source]
class tensortrade.orders.trade.TradeSide[source]

Bases: enum.Enum

An enumeration.

BUY = 'buy'
SELL = 'sell'
instrument(pair)[source]
Return type:Instrument
class tensortrade.orders.trade.TradeType[source]

Bases: enum.Enum

An enumeration.

LIMIT = 'limit'
MARKET = 'market'