https://github.com/ianjure/mean-reversion-trading
A trading algorithm based on a popular financial theory.
https://github.com/ianjure/mean-reversion-trading
algorithmic-trading simulation streamlit trading trading-algorithms
Last synced: 2 months ago
JSON representation
A trading algorithm based on a popular financial theory.
- Host: GitHub
- URL: https://github.com/ianjure/mean-reversion-trading
- Owner: ianjure
- Created: 2024-09-04T12:16:56.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-05T04:49:57.000Z (almost 2 years ago)
- Last Synced: 2025-03-21T23:17:22.286Z (over 1 year ago)
- Topics: algorithmic-trading, simulation, streamlit, trading, trading-algorithms
- Language: Jupyter Notebook
- Homepage: https://tradestrats.streamlit.app/meanreversion
- Size: 121 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Mean Reversion Trading [](https://colab.research.google.com/github/ianjure/mean-reversion-trading/blob/main/Mean_Reversion_Notebook.ipynb) [](https://tradestrats.streamlit.app/meanreversion)
Mean reversion is a financial theory that suggests asset prices tend to return to their average levels after an extreme price movement. The goal of this project is to develop an algorithm that replicates this strategy and simulates its returns using historical stock data.
## Data Overview
We will retrieve historical price data for the stock from Yahoo Finance using the [yfinance](https://pypi.org/project/yfinance/) library. This dataset will include the closing prices, which are crucial for simulating the trading strategy. Additionally, we will use [pandas-ta](https://pypi.org/project/pandas-ta/), a technical analysis library, to calculate two key indicators: the Relative Strength Index (RSI) and the Simple Moving Average (SMA).
## Project Method
1. **Collect the Data:** Retrieve stock price data from Yahoo Finance.
2. **Clean the Data:** Remove irrelevant features and standardize the index format.
3. **Create New Features:** Use pandas-ta to calculate the 10-period RSI and 200-period SMA.
4. **Simulate the Strategy:** Apply the entry and exit conditions to execute the strategy and calculate the expected returns.
5. **Deploy the Model:** Develop a web application that allows users to test the model.
## Next Steps
* **Explore** and evaluate additional trading strategies.
* **Experiment** with different combinations of RSI and SMA periods.
**This project is inspired by:** [Mean Reversion Trading Strategy Using Python](https://eodhd.medium.com/testing-a-powerful-mean-reversion-trading-strategy-using-python-4eb5eed60857)