Angel API Momentum Backtest Code

Замовник: AI | Опубліковано: 02.03.2026

I need clean, well-commented Python code that lets me back-test a momentum-based, algorithmic trading strategy on Indian stocks through the Angel One smart-API. At a minimum, the script should: • Pull historical equity data with the Angel API endpoints I already use in live trading. • Let me set adjustable momentum parameters (look-back window, ranking criteria, rebalance frequency, position sizing) from a single config section. • Generate a fast vectorised back-test, calculate P&L, drawdown, Sharpe and basic trade metrics, then output them to a tidy DataFrame and a couple of matplotlib / seaborn charts. • Stay modular so I can swap the data-loader or plug the core logic into my live trading script later. Acceptance criteria 1. I run one command and the back-test completes without errors on Python 3.11. 2. Results match a simple benchmark calculation I will supply. 3. All API keys and secrets are read securely from an .env file; none are hard-coded. Please include a brief README that explains setup, required Python packages and how to change parameters for further experiments.