tensortrade.trades.trade module

class tensortrade.trades.trade.Trade(symbol, trade_type, amount, price)[source]

Bases: object

A trade object for use within trading environments.

__init__(symbol, trade_type, amount, price)[source]
Parameters
  • symbol (str) – The exchange symbol of the instrument in the trade (AAPL, ETH/USD, NQ1!, etc).

  • trade_type (TradeType) – The type of trade executed (0 = HOLD, 1=LIMIT_BUY, 2=MARKET_BUY, 3=LIMIT_SELL, 4=MARKET_SELL).

  • amount (float) – The amount of the instrument in the trade (shares, satoshis, contracts, etc).

  • price (float) – The price paid per instrument in terms of the base instrument (e.g. 10000 represents $10,000.00 if the base_instrument is “USD”).

property amount

The amount of the instrument in the trade (shares, satoshis, contracts, etc).

Return type

float

copy()[source]

Return a copy of the current trade object.

Return type

Trade

property is_buy

Returns: Whether the trade type is a buy offer.

Return type

bool

property is_hold

Returns: Whether the trade type is non-existent (i.e. hold).

Return type

bool

property is_sell

Returns: Whether the trade type is a sell offer.

Return type

bool

property price

The price paid per instrument in terms of the base instrument (e.g. 10000 represents $10,000.00 if the base_instrument is “USD”).

Return type

float

property symbol

The exchange symbol of the instrument in the trade (AAPL, ETH/USD, NQ1!, etc).

Return type

str

property trade_type

The type of trade (“buy”, “sell”, “hold”, etc).

Return type

TradeType