CCXTExchange¶
An exchange for trading on CCXT-supported cryptocurrency exchanges.
Class Parameters¶
base_instrument- The exchange symbol of the instrument to store/measure value in.
dtype- A type or str corresponding to the dtype of the
observation_space.
- A type or str corresponding to the dtype of the
feature_pipeline- A pipeline of feature transformations for transforming observations.
Properties and Setters¶
base_instrument- The exchange symbol of the instrument to store/measure value in.
dtype- A type or str corresponding to the dtype of the
observation_space.
- A type or str corresponding to the dtype of the
feature_pipeline- A pipeline of feature transformations for transforming observations.
base_precision- The floating point precision of the base instrument.
instrument_precision- The floating point precision of the instrument to be traded.
initial_balance- The initial balance of the base symbol on the exchange.
balance- The current balance of the base symbol on the exchange.
portfolio- The current balance of each symbol on the exchange (non-positive balances excluded).
trades- A list of trades made on the exchange since the last reset.
performance- The performance of the active account on the exchange since the last reset.
generated_space- The initial shape of the observations generated by the exchange, before feature transformations.
observation_columns- The list of column names of the observation data frame generated by the exchange, before feature transformations.
observation_space- The final shape of the observations generated by the exchange, after feature transformations.
net_worth- Calculate the net worth of the active account on the exchange.
profit_loss_percent- Calculate the percentage change in net worth since the last reset.
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.
- If
Functions¶
Below are the functions that the Exchange uses to effectively operate.
Private¶
_create_observation_generator
Public¶
has_next_observation- Return the reward corresponding to the selected risk-adjusted return metric.
next_observation- Generate the next observation from the exchange.
instrument_balance- The current balance of the specified symbol on the exchange, denoted in the base instrument.
current_price- The current price of an instrument on the exchange, denoted in the base instrument.
execute_trade- Execute a trade on the exchange, accounting for slippage.
reset- Reset the feature pipeline, initial balance, trades, performance, and any other temporary stateful data.
Use Cases¶
Use Case #1: Initiating CCXTExchnage
import ccxt
from tensortrade.exchanges.live import CCXTExchange
coinbase = ccxt.coinbasepro()
exchange = CCXTExchange(exchange=coinbase, base_instrument='USD')