Definitions
Base Trading Strategy
The base trading strategy (BTS) is a simulated high-frequency trading strategy that is designed to simply track market predictions. The BTS executes a long position (buys the asset) when the market is predicted to go up and takes a short position (sells the asset) when the market is predicted to go down and vice versa. It maintains the position when the market is predicted to be neutral or when the market continues to move in favour of the selected position. The position is closed if the market is predicted to move against the selected position.
The BTS is used to provide an indication of the performance of our market perdictions under ideal conditions of
no fees;
no latency; and
no slippage
Using BTS we calculate average daily returns for each month. A Sharpe ratio is also calculated from daily return data for each month. The daily returns achieved by the BTS could be in as high as 50% daily with a Sharpe ratio of 3.0. These are exceptionally high returns and Sharpe ratios but not surprising given the exceptional quality of our predictions and the ideal conditions under which the BTS operates.
You can collect the real-time data for predictions and market price using the WebSocket interface and validate the return figures using the following code snippet for the BTS:
import numpy as np
def bts(predictions: np.array, bids: np.array, asks: np.array, fee=0.0):
"""
Base Trading Strategy (BTS) is a simple high-frequency trading strategy that
buys when the prediction is +1 and sells when the prediction is -1 and vice
versa. It assumes that it can buy at the ask price and sell at the bid price
at the time that prediction is available therefore taking bid-ask spread into
account but not the latency of reacting to the prediction or execution of the
order. By default, it assumes no fee is charged for the trades but this can be
changed by setting the 'fee' option.
:param predictions: array of price movement predictions (+1, 0, -1)
:param bids: array of bid prices at the time of each prediction
:param asks: array of ask prices at the time of each prediction
:param fee: the fee charged for each trade
:return: the profit or loss of the strategy
"""
position = None
money = 1
for i in range(0, len(predictions)):
move = predictions[i]
if move == 0:
continue
if position is None:
pass
elif position == -1 and move == 1:
change = (price - asks[i]) / price
money *= 1 + (change - fee)
elif position == 1 and move == -1:
change = (bids[i] - price) / price
money *= 1 + (change - fee)
else:
continue
position = move
price = bids[i] if move == -1 else asks[i]
money *= 1 - fee
return money - 1
Confusion Matrix
Forward Testing
Forward testing refers to assessing a model or trading strategy using market data that was not utilized during its training or validation phase. This ensures that the performance evaluation is based on unseen data, providing a genuine measure of the model's or strategy's effectiveness. By employing forward testing, traders can gauge how well their models or strategies perform in real-world conditions that were not previously encountered by the model.
pip
pip is short for 'percentage in point' equivalent to 1/100 of 1%, 1 part in 10,000 or 0.0001. We commonly use pip when talking about price changes. For example, 10 pip change in the price of a $20,000 asset is $20.
Prediction Quality Matrix
A table that summarizes the performance of a classification model or algorithm by mapping the actual (expected) outcomes of a classification against the predicted values. It is used in to evaluate the effectiveness of a model's predictions.
In AI circles, it is commonly known as the confusion matrix. However, we believe there is no 'confusion' here and the matrix clearly provides the finest level of information about the quality of a model's predictions. Therefore, you will see us use the term prediction quality matrix (PQM) throughout our documents and materials.
Here is an example of the PQM for a sideways market detection over a 15 day period in the first half of June 2023 for BTC-USD on dYdX:
Actual Sideways
79.6%
7.6%
87.2%
Actual Trending
6.4%
6.3%
12.8%
Prediction Totals
86.0%
14.0%
100%
As can be seen, the market remained sideways for the majority of the time, accounting for 87.2% of the total duration. Our predictions accurately identify a sideways market 86.0% of the time, with 79.6% being true positives and 6.4% false positives. Therefore, if your trading strategy is designed for sideways markets, without utilizing the predictions, you would have an error rate of 12.8%. However, by incorporating the predictions, the error rate decreases to 7.5% (6.4%/86.0%). This represents a reasonable improvement compared to trading without predictions.
The value of the predictions becomes more apparent when it comes to detecting trending markets. In the absence of the predictions, your error rate would be 87.2% (reflecting the times when the market is sideways). By leveraging the predictions, your error rate decreases to 54.5% (7.6%/14.0%). This substantial reduction is expected to have a significant impact on the performance of your trending market algorithm.
Price Jump
A price jump is a substantial change in the market conditions that results in price discontinuity. It is typically the result of macroeconomic announcements or scheduled and unscheduled release of information about a particular asset or stock.
Professional Traders
We refer to high frequency trades (HFTs), market makers (MMs) and institutional traders as professional trades (PTs). PTs have a high level of sophistication that allows them to use our predictions in algorithmic and automated trading strategies in real-time.
Prediction Service
We define a service as the set of predictions for a combination of an exchange, an asset, a prediction type, and a set of parameters for the prediction type. For example, Tesla price movement predictions on NASDAQ (NASDAQ/TSLA/price_movement) or BTCUSDT sideways predictions on Binance (Binance/BTCUSDT/sideways). Our pricing is based on the number of prediction services that you use for a preiod of time.
Sideways Market
A sideways market, also known as a horizontal or a range-bound market, refers to a market condition where the price of an asset, such as a stock, currency pair, or commodity, trades within a relatively narrow price range over an extended period of time. In a sideways market, there is limited upward or downward movement, resulting in a flat or horizontal price pattern on the price chart.
Sharpe Ratio
The Sharpe ratio is a measure used to assess the risk-adjusted return of a trading strategy. It was developed by Nobel laureate William F. Sharpe. The ratio helps investors understand the excess return earned for the amount of risk taken.
A higher ratio is typically better and indicates a higher return per unit of risk, implying better risk-adjusted performance. A ratio of 1 is typically considered the bare minimum for a trading strategy.
We publish the Sharpe ratio for each of our prediction models in conjunction with our base trading strategy.
Trending Market
This is the opposite of a sideways market where the price of an asset moves consistently in a particular direction, either upward (bullish trend) or downward (bearish trend). Unlike a sideways market, where the price remains within a relatively narrow range, a trending market shows a clear and sustained movement in one direction. Traders and investors often seek to identify and capitalize on trending markets to profit from the price momentum and potential trading opportunities presented by the trend.
Last updated