0% found this document useful (0 votes)
26 views3 pages

Bitcoin Trading Strategy Backtesting Guide

The document outlines a coding test with three main questions focused on backtesting trading strategies for Bitcoin. Question 1 involves implementing a Kimchi Momentum Strategy using data from Upbit and Binance, while Question 2 requires backtesting alpha factors with specified calculations on hourly price data. A bonus question encourages brainstorming additional trading strategies using alternative data sources, emphasizing the optimization process over the final results.

Uploaded by

So Kit Wai
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views3 pages

Bitcoin Trading Strategy Backtesting Guide

The document outlines a coding test with three main questions focused on backtesting trading strategies for Bitcoin. Question 1 involves implementing a Kimchi Momentum Strategy using data from Upbit and Binance, while Question 2 requires backtesting alpha factors with specified calculations on hourly price data. A bonus question encourages brainstorming additional trading strategies using alternative data sources, emphasizing the optimization process over the final results.

Uploaded by

So Kit Wai
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

CodingTest.

md 2023-11-07

Coding Test

Please complete the task in jupyter notebook (ipynb) & submit the required charts as png
with the jupyter notebook together inside a zip file.

Question 1
Kimchi Momentum Strategy Backtesting

. When Bitcoin goes up X% on Upbit Exchange , Long Bitcoin in Binance ; when Bitcoin
goes down Y% on UpBit exchange , Short Bitcoin in Binance.

. You need to collect price of Bitcoin Perpetual Futures from UpBit & Binance respectively.

. Divide the whole data period into 2 parts. 50% of the time for backtest another 50% for
forward test. For example, you have data from 01/2021 to 01/2023. Then 01/2021 to
01/2022 is used for backtest. 01/2022 to 01/2023 is used for forward test.

. Generate a sharpe heat map to loop and find the best X & Y combination. (like image
below)

. Calculate CAGR , Maximum Drawdown and Sharpe Ratio

Question 2
Alpha Factors Backtesting

. Download the hourly price data (i.e. Candlestick data) of BTCUSDT linear perpetual
swaps from Binance or Bybit since 2021 Jan til the latest data source you can get.
Clean the data.
1/3
[Link] 2023-11-07

. Create & define columns (alphas) by following the below formulas; Remark: Please
handle some marginal cases when denominator equals 0, can just assuming an
insignificant value to the formula,

2/3
[Link] 2023-11-07

for example on 'alpha_C', define denominator as max(high - low, 0.0001)

'alpha_A': √ high  low - VWAP, where VWAP = (Cumulative Typical Price *


Volume) / Cumulative Volume & Cumulative Typical Price = (close + high + low)
/ 3; you can take the rolling 24h data to compute VWAP.

'alpha_B': −1  ((low − close)  (open)5)/((low − high)  (close)5)

'alpha_C': (close − open)/((high − low) + .001

. After computing the 3 'alphas', you can design any approaches for on these 'alphas'
(can be of different approaches on each 'alphas' or same approach on different
'alphas', can simple as if alpha_X is bigger than zero, long; vice versa, or do another
layer of data transformation to signal). You can combine the performance of strategies
built on different alphas. Compute the backtest result (sharpe ratio, return/CAGR,
maximum drawdown, calmar ratio, with a plot of performance curve).

Question 3 (Bonus)
Bonus Strategies Brainstorm Backtesting

Come up with a trading strategy of BTC or ETH (CTA appraoch). Extra points if
alternative data are used (such as Coinglass, or other available websites) for
constructing the strategy. Compute the backtest result (sharpe ratio, return/CAGR,
maximum drawdown, calmar ratio, with a plot of performance curve). Tell us if the
result matches your expectation. We focus more on the process of from construction to
optimization of the strategies without overfitting & ideas behind than the result of
backtest.

3/3

Common questions

Powered by AI

Backtesting the Kimchi Momentum Strategy involves specific considerations for cryptocurrency markets, such as higher volatility, trading on multiple exchanges, and potential price discrepancies (arbitrage opportunities) between exchanges like Upbit and Binance. This contrasts with equity strategies, which typically involve more stable price movements and a single exchange. The unique characteristics of cryptocurrencies necessitate different data handling and testing approaches, making direct comparisons to traditional equity strategies less straightforward .

Dividing the data period into two parts, 50% for backtesting and 50% for forward testing, helps assess the strategy's robustness and validate its performance. Backtesting uses historical data to develop the strategy, while forward testing applies the strategy to unseen data, reducing the risk of overfitting and confirming its potential effectiveness .

Data cleaning is crucial for removing errors, inconsistencies, and inaccuracies in the dataset, ensuring the reliability of backtesting results. Cleaned data leads to more accurate calculations of alphas and subsequent performance metrics such as Sharpe ratio, return/CAGR, and maximum drawdown. It directly impacts the validity and trustworthiness of the backtest results, as unclean data can lead to erroneous conclusions and poor strategy performance .

Visualizing the performance curve allows traders to intuitively assess the cumulative performance and volatility of a strategy over time. It helps in identifying trends, drawdowns, and recovery periods, thus providing insights into how the strategy behaves under different market conditions. This visualization aids in understanding the strategy's strengths and weaknesses, facilitating subsequent optimization and adjustment .

Challenges in calculating alphas include handling marginal cases where the denominator equals zero, which can lead to undefined or erroneous values. This can be addressed by assuming an insignificant value, such as 0.0001, for these denominators, ensuring calculations remain valid without resulting in infinite or undefined results .

Performance metrics such as maximum drawdown and Calmar ratio provide insights into the risk and risk-adjusted return profile of a trading strategy. Maximum drawdown measures the largest peak-to-trough decline, indicating potential loss exposure. The Calmar ratio, which involves dividing the annualized return by maximum drawdown, offers a clearer view of the trade-off between risk and reward, thus aiding in evaluating the sustainability and attractiveness of a strategy .

Combining multiple alpha strategies allows for diversification and the potential to smooth out returns from individual strategies. Each alpha can capture different market inefficiencies or trends, and by combining them, the overall strategy can exhibit a more stable and less volatile performance, improving measures such as Sharpe ratio, CAGR, and reducing maximum drawdown .

Using alternative data provides additional, often non-traditional insights that can capture market sentiment or operational factors not evident in price data alone. This can lead to the development of more robust strategies that better anticipate market movements. The impact on performance evaluation is reflected in potentially higher Sharpe ratios and other metrics, as alternative data may uncover overlooked opportunities or risks .

Continuous data updates allow for real-time adjustments and refinement of strategies, catering to evolving market conditions. This dynamic approach facilitates ongoing optimization of alpha factors and can enhance performance by capturing current trends and mitigating emerging risks. Regular updates can improve the accuracy of performance evaluations like Sharpe ratio and drawdown metrics, fostering more adaptive and responsive trading strategies .

A Sharpe heat map visualizes the Sharpe ratios for different combinations of X% and Y% in the Kimchi Momentum Strategy. By examining the heat map, you can identify the combination of X and Y that yields the highest Sharpe ratio, indicating the most efficient risk-adjusted return. This helps in fine-tuning the strategy for improved performance .

You might also like