tensortrade.oms.instruments.instrument module

class tensortrade.oms.instruments.instrument.Instrument(symbol: str, precision: int, name: str = None)[source]

Bases: object

A financial instrument for use in trading.

Parameters:
  • symbol (str) – The symbol used on an exchange for a particular instrument. (e.g. AAPL, BTC, TSLA)
  • precision (int) – The precision the amount of the instrument is denoted with. (e.g. BTC=8, AAPL=1)
  • name (str, optional) – The name of the instrument being created.
__eq__(other: Any) → bool[source]

Checks if two instruments are equal.

Parameters:other (Any) – The instrument being compared.
Returns:bool – Whether the instruments are equal.
__ne__(other: Any) → bool[source]

Checks if two instruments are not equal.

Parameters:other (Any) – The instrument being compared.
Returns:bool – Whether the instruments are not equal.
__rmul__(other: float) → tensortrade.oms.instruments.quantity.Quantity[source]

Enables reverse multiplication.

Parameters:other (float) – The number used to create a quantity.
Returns:Quantity – The quantity created by the number and the instrument involved with this operation.
__truediv__(other: tensortrade.oms.instruments.instrument.Instrument) → tensortrade.oms.instruments.trading_pair.TradingPair[source]

Creates a trading pair through division.

Parameters:

other (Instrument) – The instrument that will be the quote of the pair.

Returns:

TradingPair – The trading pair created from the two instruments.

Raises:
  • InvalidTradingPair – Raised if other is the same instrument as self.
  • Exception – Raised if other is not an instrument.