This project implements an AI-driven trading strategy for Nifty options. It uses historical Nifty index data to backtest a simple options selling strategy based on market volatility. The strategy evaluates daily price movements and executes trades accordingly, providing performance metrics and visualization of cumulative profits.
The strategy involves:
- Selling At-the-Money (ATM) +1% Call and Put Options when the market movement is less than 1%.
- Targeting a net profit of ₹100 per trade on both Call and Put positions.
- Automated Backtesting: Analyze historical Nifty data with a rule-based trading strategy.
- Performance Metrics: Gain insights into total trades, win rate, and final profit/loss.
- Visualization: Visualize the cumulative P/L over time with matplotlib.
- Total Trades: 248
- Winning Trades: 151
- Win Rate: 60.89%
- Final P/L: ₹10,800.00
- Load historical Nifty data.
- Calculate daily market movement.
- Execute trades based on volatility.
- Aggregate and visualize performance.
- Generate performance metrics.
python backtest_strategy.py
Install dependencies using:
pip install -r requirements.txt
- Introduce AI-driven predictions for market movements.
- Automate live trading with broker APIs.
Feel free to fork the repository and submit pull requests for improvements!
This project is licensed under the MIT License.