tensortrade.oms.orders.trade module

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

Bases: tensortrade.core.base.TimedIdentifiable

A trade object for use within trading environments.

__init__(order_id: str, step: int, exchange_pair: ExchangePair, side: tensortrade.oms.orders.trade.TradeSide, trade_type: tensortrade.oms.orders.trade.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.

  • 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 core instrument in the trade.

  • 1000 shares ((e.g.) –

  • satoshis (6.50) –

  • contracts (2.3) –

  • etc)

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

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

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

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

  • 10000 represents $10

  • if the base_instrument is "USD")

property base_instrument
property commission
property is_buy
property is_limit_order
property is_market_order
property is_sell
property price
property quote_instrument
property size
to_dict()[source]
to_json()[source]
class tensortrade.oms.orders.trade.TradeSide(value)[source]

Bases: enum.Enum

An enumeration.

BUY: str = 'buy'
SELL: str = 'sell'
instrument(pair: TradingPair) → Instrument[source]
class tensortrade.oms.orders.trade.TradeType(value)[source]

Bases: enum.Enum

An enumeration.

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