You are on page 1of 5

REPORT IIT KGP

Pranjay Sidhwani Company: Zelta Labs


Hackathon
§ Algorithmic Trading Model Development for BTC/USDT §
Here is the report enclosed for the Data science hackathon by Kharagpur. Please find the commented Jupyter
notebook for the model. I have used time series modeling and used LGBM model and K-fold cross validation
for training the data. For backtesting results, I have attached graphs in the report but you can also see it by
running the code.

Section 1: Introdcution
In recent years, the cryptocurrency market, particularly the BTC/USDT trading pair, has witnessed unprece-
dented growth and volatility. As market participants seek to navigate this dynamic landscape, the integration
of advanced predictive modeling and optimization techniques has become imperative. This report provides a
comprehensive overview of the development process, model optimization strategies, and key insights gained
throughout a focused project aimed at enhancing market analysis within the BTC/USDT market.

The project’s primary objective was to harness the power of cutting-edge technologies and methodologies
to better understand and predict market movements within the BTC/USDT trading pair. By delving into the
intricacies of the development process, model optimization, and insights gleaned from the project, this report
offers a valuable resource for traders, analysts, and researchers seeking to gain a deeper understanding of the
crypto market.

Throughout the report, we will explore the key components of the project, including the choice of modeling
techniques, data preprocessing, feature selection, and optimization methodologies. Additionally, we will discuss
the relevance of real-time data, model interpretability, and the evolving nature of the cryptocurrency market
that necessitates constant adaptation of analytical approaches.

Section 2: Strategy

(1) What is Support and Resistance?

1. Support In a downtrend, prices fall because there is an excess of supply over demand. The lower prices go,
the more attractive prices become to those waiting on the sidelines to buy the shares. At some level, demand
that would have been slowly increasing will rise to the level where it matches supply. At this point, prices will
stop falling. This is support.

2. Resistance Resistance is the opposite of support. Prices move up because there is more demand than
supply. As the prices move higher, there will come a point when selling will overwhelm the desire to buy. This
happens for a variety of reasons. It could be that traders have determined that prices are too high or have met
their target. It could be the reluctance of buyers to initiate new positions at such rich valuations. It could be
for any other number of reasons. But a technician will clearly see on a price chart a level at which supply begins
to overwhelm demand. This is resistance. Like support, it can be a level or a zone.

(2) Is Engulfing:
• This function checks whether a candle at index l exhibits an engulfing pattern.
• An engulfing pattern occurs when the current candle completely engulfs the previous candle.
IIT KGP Hackathon – Pranjay Sidhwani 2

• Two conditions are checked:


The body size of the current and previous candles should be greater than a specified minimum (body
diffmin).
The open and close prices of the current and previous candles should satisfy certain conditions.
• Returns 1 if it’s a bullish engulfing pattern, 2 if it’s a bearish engulfing pattern, and 0 otherwise.

(3) Is Star:
• This function checks whether a candle at index l exhibits a star pattern.
• A star pattern is characterized by a small body surrounded by long upper and lower shadows.
• The function calculates ratios and checks conditions based on these ratios and other criteria.

• Returns 1 if it’s a bullish star pattern, 2 if it’s a bearish star pattern, and 0 otherwise.

(4) Close Resistence:


• This function checks if the closing price of the candle at index l is close to a resistance level.

• It takes a list of resistance levels (levels) and a tolerance limit (lim).


• Conditions are checked to determine if the closing price is close to any of the resistance levels within the
specified limit.
• Returns 1 if the conditions are met and 0 otherwise.

(5) Close support:


• Similar to closeResistance, this function checks if the closing price of the candle at index l is close to a
support level.

• It takes a list of support levels (levels) and a tolerance limit (lim).


• Conditions are checked to determine if the closing price is close to any of the support levels within the
specified limit.
• Returns 1 if the conditions are met and 0 otherwise.

(6) Main strategy


• n1 and n2 are parameters used in the support and resistance functions to define the number of candles
before and after the reference candle.

• BackCandles specifies the number of historical candles to consider.


• Signal is a list initialized with zeros to store the generated trading signals.
• If Is star pattern or Is engulfing pattern is bullish and close resistance is true then it is bullish condition
and signal is 1

• If Is star pattern or Is engulfing pattern is bearish and close support is true then it is bearish condition
and signal is 2
IIT KGP Hackathon – Pranjay Sidhwani 3

Section 3: Data Visualization and Feature Extraction


According to my strategy, there were 275 buying trades, 337 selling trades, and 17230 no trades. The data
provided for already clean please find the decription of the each columns in the data.

As mentioned, I have used time series modeling and created lag features for the last 30 "2 hrs" intervals. I
have also converted date and time into features by extracting features like hour, day, week, quarter, year, etc.
There are 156 features used for training the date.

Section 4: Model Parameters and trainings


As mentioned earlier, I have used LGBM model for training the data and K fold cross validation for training
the data where K= 10. Accuracy of the model is 96.56%. Attached is the parameters for the LGBM model.

Section 5: Backtesting Result


Backtesting was performed using python library backtesting As Out of sample 1 and out of sample 2 data are
not provided I backtested it on training data set.
Below are the result for the backtest of the data
Initial Money = 1,00,000 $
IIT KGP Hackathon – Pranjay Sidhwani 4

Here are some graphs for the backtesting result-


IIT KGP Hackathon – Pranjay Sidhwani 5

Section 6: Insight Gain


Embarking on the data science hackathon centered around developing an algorithmic trading model for the
BTC/USDT crypto market, I anticipated gaining profound insights into the intricacies of cryptocurrency trad-
ing. As I delvec into the model development process, the microstructure of the market unfolded, unraveling
the impacts of order book dynamics, fluctuations in liquidity, and variations in trading volumes on the nuanced
movements of BTC/USDT prices. The analysis of historical data promises to reveal patterns and trends, offering
a nuanced comprehension of optimal time frames for executing trading strategies. Throughout the hackathon,
I was eager to unravel the challenges associated with risk management in the volatile crypto landscape, gaining
insights into effective strategies to safeguard capital. The adaptability of my algorithm to shifting market condi-
tions will likely emerge as a crucial aspect, highlighting the model’s responsiveness to evolving trends. Moreover,
I look forward to exploring potential correlations between BTC/USDT price movements and external factors
such as news events, regulatory changes, or technological advancements. Execution analysis will shed light
on the nuances of trade execution, addressing challenges like slippage and guiding strategies for optimal order
fulfillment. The incorporation of machine learning techniques into my model holds the promise of enhanced
interpretability, deepening my understanding of the decision-making processes. In this dynamic and competitive
hackathon environment, continuous improvement of my algorithmic trading model will be paramount, ensuring
its adaptability to the ever-evolving nature of the cryptocurrency market. This experience holds the potential
to furnish me with a wealth of insights that can significantly elevate my skills in algorithmic trading within the
BTC/USDT crypto market.

You might also like