tensortrade.oms.orders.trade module

class tensortrade.oms.orders.trade.Trade(order_id: str, step: int, exchange_pair: ExchangePair, side: TradeSide, trade_type: TradeType, quantity: Quantity, price: float, commission: Quantity)[source]

Bases: TimedIdentifiable

A trade object for use within trading environments.

__init__(order_id: str, step: int, exchange_pair: ExchangePair, side: TradeSide, trade_type: TradeType, quantity: Quantity, price: float, commission: Quantity)[source]
Parameters:
  • order_id – The id of the order that created the trade.

  • step – The timestep the trade was made during the trading episode.

  • exchange_pair – The exchange pair of instruments in the trade.

  • BTC/USDT ((e.g.)

  • ETH/BTC

  • ADA/BTC

  • AAPL/USD

  • NQ1!/USD

  • CAD/USD

  • etc)

  • side – Whether the quote instrument is being bought or sold.

  • base_instrument) ((e.g. BUY = trade the base_instrument for the quote_instrument in the pair. SELL = trade the quote_instrument for the)

  • size – The size of the core instrument in the trade.

  • shares ((e.g. 1000)

  • satoshis (6.50)

  • contracts (2.3)

  • etc).

  • price – The price paid per quote instrument in terms of the core instrument.

  • $10 ((e.g. 10000 represents)

  • "USD"). (000.00 if the base_instrument is)

  • commission – The commission paid for the trade in terms of the core instrument.

  • $10

  • "USD").

property base_instrument: Instrument
property commission: Quantity
property is_buy: bool
property is_limit_order: bool
property is_market_order: bool
property is_sell: bool
property price: float
property quote_instrument: Instrument
property size: float
to_dict()[source]
to_json()[source]
class tensortrade.oms.orders.trade.TradeSide(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

BUY: str = 'buy'
SELL: str = 'sell'
instrument(pair: TradingPair) Instrument[source]
class tensortrade.oms.orders.trade.TradeType(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

LIMIT: str = 'limit'
MARKET: str = 'market'