tensortrade.exchanges.instrument_exchange module¶
-
class
tensortrade.exchanges.instrument_exchange.
InstrumentExchange
(base_instrument='USD', dtype=<class 'numpy.float16'>, feature_pipeline=None)[source]¶ Bases:
object
An abstract instrument exchange for use within a trading environment.
-
__init__
(base_instrument='USD', dtype=<class 'numpy.float16'>, feature_pipeline=None)[source]¶ - Parameters
-
abstract property
balance
¶ The current balance of the base symbol on the exchange.
- Return type
-
property
base_instrument
¶ The exchange symbol of the instrument to store/measure value in.
- Return type
-
abstract
current_price
(symbol)[source]¶ The current price of an instrument on the exchange, denoted in the base instrument.
-
property
dtype
¶ A type or str corresponding to the dtype of the observation_space.
-
property
feature_pipeline
¶ A pipeline of feature transformations for transforming observations.
- Return type
-
abstract property
generated_space
¶ The initial shape of the observations generated by the exchange, before feature transformations.
- Return type
Space
-
abstract property
has_next_observation
¶ If False, the exchange’s data source has run out of observations.
Resetting the exchange may be necessary to continue generating observations.
- Return type
- Returns
Whether or not the specified instrument has a next observation.
-
abstract property
initial_balance
¶ The initial balance of the base symbol on the exchange.
- Return type
-
instrument_balance
(symbol)[source]¶ The current balance of the specified symbol on the exchange, denoted in the base instrument.
-
property
instrument_precision
¶ The floating point precision of the instrument to be traded.
- Return type
-
property
net_worth
¶ Calculate the net worth of the active account on the exchange.
- Returns
The total portfolio value of the active account on the exchange.
- Return type
-
next_observation
()[source]¶ Generate the next observation from the exchange.
- Return type
ndarray
- Returns
The next multi-dimensional list of observations.
-
property
observation_space
¶ The final shape of the observations generated by the exchange, after feature transformations.
- Return type
Space
-
abstract property
performance
¶ The performance of the active account on the exchange since the last reset.
- Return type
DataFrame
-
abstract property
portfolio
¶ The current balance of each symbol on the exchange (non-positive balances excluded).
-
property
profit_loss_percent
¶ Calculate the percentage change in net worth since the last reset.
- Return type
- Returns
The percentage change in net worth since the last reset.
-