{"id":27306223,"url":"https://github.com/deenayy/algorithmic-trading-bot","last_synced_at":"2025-12-30T23:05:08.628Z","repository":{"id":287434702,"uuid":"964716031","full_name":"deenayy/Algorithmic-Trading-Bot","owner":"deenayy","description":"The-project-aims-to-evaluate-the-predictive-performance-of-different-machine-learning-(ML)-algorithms-for-Bitcoin-trading.-The-proposed-trading-strategy-integrates-key-technical-indicators,-including-the-Relative-Strength-Index-(RSI),-Simple-and-Exponential-Moving-Averages,-and-the-Moving-Average-Convergence-Divergence-(MACD).","archived":false,"fork":false,"pushed_at":"2025-04-11T21:37:38.000Z","size":805,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-12T03:58:56.930Z","etag":null,"topics":["lightgbm","machine-learning","matplotlib","mlflow","numpy","optuna","pandas","pickle","random-forest","scikit-learn","scipy","seaborn","statsmodels","xgboost"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/deenayy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-04-11T17:03:48.000Z","updated_at":"2025-04-11T21:37:41.000Z","dependencies_parsed_at":"2025-04-11T18:46:34.296Z","dependency_job_id":null,"html_url":"https://github.com/deenayy/Algorithmic-Trading-Bot","commit_stats":null,"previous_names":["deenayy/algorithmic-trading-bot"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deenayy%2FAlgorithmic-Trading-Bot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deenayy%2FAlgorithmic-Trading-Bot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deenayy%2FAlgorithmic-Trading-Bot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deenayy%2FAlgorithmic-Trading-Bot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deenayy","download_url":"https://codeload.github.com/deenayy/Algorithmic-Trading-Bot/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248514202,"owners_count":21116900,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["lightgbm","machine-learning","matplotlib","mlflow","numpy","optuna","pandas","pickle","random-forest","scikit-learn","scipy","seaborn","statsmodels","xgboost"],"created_at":"2025-04-12T03:58:59.837Z","updated_at":"2025-04-12T03:59:00.700Z","avatar_url":"https://github.com/deenayy.png","language":"JavaScript","readme":"# Algorithmic-Trading-Bot\n\nAlgorithmic trading employs automated strategies that execute trades based on predefined mathematical rules and models. These computer-driven approaches enable transactions at unprecedented speed and frequency, surpassing human capabilities. By systematically following precise guidelines around timing, price, and volume, algo-trading not only creates potential profit opportunities but also enhances market liquidity and reduces emotional decision-making in trading.\n\n## Methodology and Research Design\n\nThe project aims to evaluate the predictive performance of different machine learning (ML) algorithms for Bitcoin trading.\n\nThe proposed trading strategy integrates key technical indicators, including the **Relative Strength Index (RSI)**, **Simple and Exponential Moving Averages**, and the **Moving Average Convergence Divergence (MACD)**. \n\nAdditionally, the analysis will account for market **seasonality** and underlying **trend patterns**.\n\nWe will train **XGBoost**, **Random Forest**, and **LightGBM** models using historical Bitcoin price data, and then conduct a thorough evaluation of their predictive performance.\n\n## Data Acquisition\n\nThe historical Bitcoin price data were collected from the **Coinbase API** (**[bitcoin data download](Notebook/03.Download-Bitcoin-Data.ipynb)**). \n\nThe data contains the **hourly** values for the **opening**, **closing**, **high**, **low** price of Bitcoin as well as the **traiding volume**.\n\nThe data period spans **1 year**, from **November 2023** to **October 2024**.\n\n## Feature Engineering\n\n### 1. Seasonality and Trends \n\n- We extract various components of the datetime, such as the month, day, hour, and day of the week. This can help the model capture seasonality and trends.\n\n### 2. STL (Seasonal-Trend decomposition using LOESS)\n\n- **STL** stands for **Seasonal-Trend decomposition using LOESS**. It's a robust statistical method used to decompose a time series into three components:\n\n    1. **Seasonal Component**: Represents the repeating pattern in the data over a fixed period (e.g., daily, weekly, monthly).\n    2. **Trend Component**: Captures the long-term progression in the data, showing an overall increase, decrease, or stability over time.\n    3. **Remainder/Residual Component**: Represents the part of the data that cannot be attributed to either seasonality or trend, often considered as noise.\n\n### 3. Autocorrelation\n\n- Autocorrelation in time series refers to the correlation of a time series with a lagged version of itself. It measures how past values of the series influence current values. Understanding autocorrelation can help identify patterns, trends, and periodicity in time-series data\n\n### 4. Technical Indicators\n\n- Calculate the values and add new columns with calculated values for **RSI**, **MACD**, **Moving Averages**.\n\n## Model Selection\n\nFor our imbalanced dataset, an appropriate model needs to either inherently handle class imbalance or be complemented by techniques to mitigate the issue. We will focus on three models:  **Random Forest**, **XGBoost** and **LightGBM**.\n\n## Conclusion\n\nIn this project we tried to find a suitable ML model that could predict the Bitcoin market movements.\n\nA trading strategy was implemented that generates buy/sell signals with the help of some technical indicators.\n\nIn a further step, 3 ML models (Random Forest, XGBoost and LightGBM) were examined to see if they could predict the results of this strategy.\nBecause the target variable is very unbalanced (1 class has over 95% of the values), the three models could not perform very well.\n\nTo improve the results, two oversampling methods (SMOTE and ADASYN) were used. In addition, the weight of the individual classes was changed during hyper-parameter tuning with Optuna in order to improve the ratio of the classes. These measures have improved the F1-Score (Macro), but the values have remained quite low.\n\n**LightGBM** performed best with **SMOTE** oversampling.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeenayy%2Falgorithmic-trading-bot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeenayy%2Falgorithmic-trading-bot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeenayy%2Falgorithmic-trading-bot/lists"}