{"id":32650344,"url":"https://github.com/gkeiel/market_forecaster","last_synced_at":"2026-04-18T11:32:52.396Z","repository":{"id":321437759,"uuid":"1085203432","full_name":"gkeiel/market_forecaster","owner":"gkeiel","description":"A Python tool for trading signals on global markets based on machine learning","archived":false,"fork":false,"pushed_at":"2026-03-14T19:34:34.000Z","size":1183,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-15T05:40:21.540Z","etag":null,"topics":["decision-trees","extra-trees","gradient-boosting","machine-learning","python","random-forest","time-series-analysis"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gkeiel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-28T18:09:25.000Z","updated_at":"2026-03-14T19:34:37.000Z","dependencies_parsed_at":"2025-10-30T20:05:54.415Z","dependency_job_id":null,"html_url":"https://github.com/gkeiel/market_forecaster","commit_stats":null,"previous_names":["gkeiel/market_forecaster"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/gkeiel/market_forecaster","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gkeiel%2Fmarket_forecaster","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gkeiel%2Fmarket_forecaster/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gkeiel%2Fmarket_forecaster/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gkeiel%2Fmarket_forecaster/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gkeiel","download_url":"https://codeload.github.com/gkeiel/market_forecaster/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gkeiel%2Fmarket_forecaster/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31966995,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T00:39:45.007Z","status":"online","status_checked_at":"2026-04-18T02:00:07.018Z","response_time":103,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["decision-trees","extra-trees","gradient-boosting","machine-learning","python","random-forest","time-series-analysis"],"created_at":"2025-10-31T07:06:10.734Z","updated_at":"2026-04-18T11:32:52.390Z","avatar_url":"https://github.com/gkeiel.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Market Forecaster\n\nThis project provides a Python tool for **backtesting and selecting the best-performing strategies** to spot market time series, applying only **machine learning algorithms**.\n\nAs main advantages, the project provides:\n- use of **supervised machine learning** to generate trading signals.\n- recurring **trading signals via Telegram channel**.\n- **open-source code**, allowing **flexibility in specifying** machine learning models and comparing all strategies.\n\nTelegram open channel with daily signals run via GitHub Actions, which anyone can sign up to get a feel for what this bot can offer:\n[t.me/market_forecasting_public](https://t.me/market_forecasting_public)\n\n\n## 📊 Features\n\n- **Data download**: Downloads market data through the Yahoo Finance API.\n- **Machine-learning-based indicators**: Implements machine-learning-based strategies to identify possible trends.\n- **Strategy backtesting**: Runs historical backtests, generating figures and summaries for decision-making.\n- **Performance evaluation**: Assesses results using a weighted objective function and ranks the best strategies.\n- **Predict future prices**: Make predictions based on supervised machine learning, applying decision tree algorithms. \n- **Telegram notifications**: Sends trading signals from the selected strategy directly to user smartphone or computer. \n- **Configuration files**: Uses `.env` for private environment variables, `.json` for tickers list, `.json`for indicators list, and `.csv` for strategies list.\n\n## 📈 Available Strategies\n\nThe project currently supports **supervisioned machine learning** strategies for generating trading signals, using the following methods:\n- **Linear Regression**\n- **Decision Trees Regressor**\n- **Random Forest Regressor**\n- **Gradient Boosting Regressor**\n- **Extra Trees Regressor**\n- **K Neighbors Regressor**\n- **Autoregressive Integrated Moving Average (ARIMA)** models\n\n## 🧩 Structure\n\nThe project is organized around a modular architecture, where each class has a responsibility:\n- **Loader** manages the market configuration files.\n- **Indicator** generates machine-learning-based indicators.\n- **Forecaster** generates price forecasts.\n- **Backtester** runs trading signals on historical data and calculates performance metrics.\n- **Strategies** generates scores and ranks strategies based on a configurable objective function.\n- **Exporter** exports results to spreadsheets.\n- **Notifier** sends notifications via applications.\n\nThe project has the following structure:\n\n ```text\n market_forecaster/ \n │  \n ├── market_forecaster.py \n ├── market_forecaster_bot.py \n |  \n ├── core/   \n │   ├── __init__.py  \n │   ├── loader.py  \n │   ├── indicator.py  \n │   ├── forecaster.py  \n │   ├── backtester.py  \n │   ├── strategies.py    \n │   ├── exporter.py  \n │   └── notifier.py  \n │  \n ├── config/  \n │   ├── config.json  \n │   ├── tickers.json  \n │   └── indicators.json    \n │  \n ├── data/  \n │   ├── debug/  \n │   ├── report/  \n │   └── results/ \n |       ├── best_results.xlsx \n │       ├── strategies.csv  \n │       └── backtests.png    \n │  \n ├── images/  \n ├── requirements.txt  \n ├── README.md  \n └── LICENSE  \n ```\n\n## ⚙️ How to Use\n\n1. **Install dependencies**:\n   ```bash\n    pip install pandas\n    pip install numpy\n    pip install yfinance\n    pip install requests\n    pip install python-dotenv\n    pip install scikit-learn\n    pip install statsmodels\n    ```\n\n2. **Configure tickers and indicators**\n   - In `config.json` add the various configuration parameters.\n   - In `tickers.json` add the stock codes to analyze.\n   - In `indicators.json` add the indicators to generate.\n   - In `strategies.csv` list the stocks to generate trading signals, each with its corresponding best strategy.\n\n3. **Configure Telegram**\n   - Create a Telegram bot and obtain its `TOKEN`.\n   - Create a Telegram channel and obtain its `CHAT_ID`.\n   - Add the bot as channel administrator.\n   - Add keys to `.env` file to be read by `market_forecaster.py`.\n\n4. **Run the script**\n   - To run the batch of backtests, execute:\n     ```bash\n     python market_forecaster.py\n     ```\n   - To generate recurrent trading signals and notifications for each ticker, execute:\n     ```bash\n     python market_forecaster_bot.py\n     ```\n   - To automate the signal generation with GitHub Actions, create the repository secrets `TOKEN` and `CHAT_ID` for the preconfigured workflow.\n\n## 🖼️ Output Examples\n\n- **Backtest chart with Random Forest**\n  \n  After running `market_forecaster.py` it generates strategy charts, spreadsheets for each ticker, and a summary with results sorted by best. The generated figures follow the example below:\n  \n  \u003cp align=\"center\"\u003e\n    \u003cimg\n      src=\"images/B3SA3_RF.png\"\n      alt=\"Optimization\"\n      width=\"733\"\n    /\u003e\n    \u003cimg\n      src=\"images/B3SA3_RF_backtest.png\"\n      alt=\"Optimization\"\n      width=\"733\"\n    /\u003e\n  \u003c/p\u003e\n  \n  Notice that the asset ends the evaluated period near its initial price, so a Buy \u0026 Hold strategy would yield approximately a 105% return. On the other hand, strictly following the machine learning strategy with Gradient Boosting would produce above 160% return over the same period, excluding any transactions fees. Furthermore, short selling operations are ignored by default in calculations assuming there exist borrowing fees involved, though they can easily be enabled in the backtest.\n\n- **Trading signals via Telegram**\n\n  After running `market_forecaster_bot.py`, it generates trading signals for the selected (best) strategies, as the example below:\n  \u003cp align=\"center\"\u003e\n    \u003cimg\n      src=\"images/telegram.png\"\n      alt=\" \"\n      width=\"480\"\n    /\u003e\n  \u003c/p\u003e\n \n## 🧩 Project Structure\n\n- `market_forecaster.py` → Main file for backtesting and selecting the best strategies.\n- `tickers.json` → List of tickers to analyze.\n- `indicators.json` → List of machine-learning-based indicators to test.\n- `strategies.csv` → List of selected strategies for trading signals, including tickers and their indicators.\n\n\n## 📌 Notes\n\n⚠️ We are not responsible for any financial losses resulting from the use of the strategies or signals generated by this code.\n\n- Contributions are welcome! Open an issue or submit a pull request.\n- Future improvements and new features may be added, including:\n  - improve objective function with new weights and presets;\n  - more machine learning methods; ✅\n  - statistical methods (ARIMA); ✅\n  - WhatsApp notifications (Premium); ✅\n  - e-mail reports (Premium); ✅\n  - use optimizer for the objective function.\n\n## 🚀 Premium Version\n\nThe Premium version unlocks advanced features for professional automation and notifications. See the comparison:\n\n| Feature                   | Free | Premium |\n|---------------------------|------|------|\n| Backtest                  |  ✅  |  ✅  |\n| Strategy evaluation       |  ✅  |  ✅  |\n| Telegram notifications    |  ✅  |  ✅  |\n| WhatsApp notifications    |  ❌  |  ✅  |\n| Gmail report              |  ❌  |  ✅  |\n\nIf this project helped you, consider purchasing the Premium version: **currently unavailable**.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgkeiel%2Fmarket_forecaster","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgkeiel%2Fmarket_forecaster","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgkeiel%2Fmarket_forecaster/lists"}