{"id":19427855,"url":"https://github.com/gappeah/solana-ml-forecast","last_synced_at":"2025-02-25T05:22:33.703Z","repository":{"id":259603233,"uuid":"878994501","full_name":"gappeah/Solana-ML-Forecast","owner":"gappeah","description":"This project uses machine learning, specifically an XGBoost regressor, to predict the price of Solana (SOL) based on historical data and engineered features.","archived":false,"fork":false,"pushed_at":"2024-11-01T00:43:14.000Z","size":371130,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-07T19:44:27.571Z","etag":null,"topics":["cryptocurrency","data-visualization","machine-learning","solana","xgboost"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","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/gappeah.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}},"created_at":"2024-10-26T17:09:52.000Z","updated_at":"2024-11-01T00:43:17.000Z","dependencies_parsed_at":"2024-10-27T00:58:10.994Z","dependency_job_id":null,"html_url":"https://github.com/gappeah/Solana-ML-Forecast","commit_stats":null,"previous_names":["gappeah/solana-ml-forecast"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gappeah%2FSolana-ML-Forecast","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gappeah%2FSolana-ML-Forecast/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gappeah%2FSolana-ML-Forecast/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gappeah%2FSolana-ML-Forecast/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gappeah","download_url":"https://codeload.github.com/gappeah/Solana-ML-Forecast/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240607635,"owners_count":19828272,"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":["cryptocurrency","data-visualization","machine-learning","solana","xgboost"],"created_at":"2024-11-10T14:13:06.494Z","updated_at":"2025-02-25T05:22:33.665Z","avatar_url":"https://github.com/gappeah.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Solana Price Prediction using XGBoost\n\nThis project uses machine learning, specifically an XGBoost regressor, to predict the price of Solana (SOL) based on historical data and engineered features.\n\n## Project Overview\nThe primary objective of this project is to predict Solana prices using historical data. \nThis repository provides a framework for predicting the price of Solana, utilising time-series data and engineered features like lagged and rolling statistics. The model is trained with the XGBoost algorithm, known for its performance in regression tasks on structured datasets using a gradient boosting framework. The dataset consists of historical price data of Solana from April 2015 to October 2024 obtained from Coincodex.com  \n\n## What is Solana \n* Solana is a decentralized computer network that uses a blockchain database to record transactions and manage the currency. The individual unit of Solana is called a sol.\n* Solana uses a proof-of-stake (PoS) mechanism and a proof-of-history (PoH) mechanism to improve on the traditional PoS blockchain. PoH uses hashed timestamps to verify when transactions occur.\n* Solana can power smart contracts, decentralized finance apps, NFTs, and more. It claims to be able to process 50,000 transactions per second.\n* Solana was created by Anatoly Yakovenko and Raj Gokal founded Solana Labs in 2018 and launched Solana in 2020.\n\n\n## Setup Instructions\n\nEnsure you have Python 3.7+ and the following libraries installed:\n\n```bash\npip install numpy pandas matplotlib scikit-learn xgboost\n```\n\n### Files\n\n- `main_xgboost copy.ipynb`: Jupyter notebook containing the main code for data preprocessing, model training, and evaluation.\n- `solana_2020-04-09_2024-10-28.csv`: Historical Solana price data used to train and test the model.\n\n\n## Running the Project\n\n1. **Clone the repository** or download the necessary files.\n   ```bash\n   git clone https://github.com/gappeah/Solana-ML-Forecast\n   ```\n\n2. **Prepare the dataset**: Ensure the `solana_2020-04-09_2024-10-26.csv` file is in the working directory.\n## Usage\n\n### 1. Load Data\nLoad the Solana price data into a DataFrame and parse the `Start` column as the datetime index:\n\n```python\nimport pandas as pd\n\n# Load dataset\ndata = pd.read_csv('solana_2020-04-09_2024-10-28.csv')\ndata['Start'] = pd.to_datetime(data['Start'])\ndata.set_index('Start', inplace=True)\n```\n\n### 2. Feature Engineering\nCreate lagged and rolling statistical features for the `Close` price:\n\n```python\ntarget = 'Close'\nlags = [1, 7, 14, 30]\n\n# Lagged features\nfor lag in lags:\n    data[f'{target}_lag_{lag}'] = data[target].shift(lag)\n\n# Rolling statistics\ndata['rolling_mean_7'] = data[target].rolling(window=7).mean()\ndata['rolling_std_7'] = data[target].rolling(window=7).std()\ndata['rolling_mean_30'] = data[target].rolling(window=30).mean()\ndata['rolling_std_30'] = data[target].rolling(window=30).std()\n\n# Drop NaN values\ndata.dropna(inplace=True)\n```\n\n### 3. Prepare Features and Target\nSeparate the features (X) and target variable (y):\n\n```python\nX = data.drop(columns=['Close'])\ny = data['Close']\n```\n\n### 4. Train the XGBoost Model\nConfigure and train the XGBoost model with categorical support enabled:\n\n```python\nfrom xgboost import XGBRegressor\n\n# Initialize XGBoost Regressor\nxgb_model = XGBRegressor(\n    objective='reg:squarederror',\n    random_state=42,\n    enable_categorical=True  # Enable categorical feature support\n)\n\n# Fit the model\nxgb_model.fit(X, y)\n```\n\n### 5. Model Evaluation\nEvaluate the model using Mean Absolute Error (MAE) and Mean Squared Error (MSE):\n\n```python\nfrom sklearn.metrics import mean_absolute_error, mean_squared_error\n\n# Predictions\ny_pred = xgb_model.predict(X)\n\n# Evaluation metrics\nmae = mean_absolute_error(y, y_pred)\nmse = mean_squared_error(y, y_pred)\n\nprint(\"Mean Absolute Error (MAE):\", mae)\nprint(\"Mean Squared Error (MSE):\", mse)\n```\n\n## Example\n\nAn example run to check the dataset and engineered features:\n\n```python\n# Display the first few rows of the dataset\nprint(data.head())\n```\n\n## Results\n\nThe model's performance can be evaluated by comparing the predicted values against actual values. Here is an example of a quick visualization:\n\n```python\nimport matplotlib.pyplot as plt\n\nplt.figure(figsize=(10,5))\nplt.plot(y.index, y, label=\"Actual Price\")\nplt.plot(y.index, y_pred, label=\"Predicted Price\")\nplt.xlabel(\"Date\")\nplt.ylabel(\"SOL Price\")\nplt.legend()\nplt.show()\n```\n## References\n- [Matplotlib documentation](https://matplotlib.org/)\n- [Pandas documentation](https://pandas.pydata.org/)\n- [Numpy documentation](https://numpy.org/doc/stable/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgappeah%2Fsolana-ml-forecast","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgappeah%2Fsolana-ml-forecast","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgappeah%2Fsolana-ml-forecast/lists"}