{"repo":"NadirAliOfficial/contrarian-trading-strategy","free":true,"listed":false,"github":"https://github.com/NadirAliOfficial/contrarian-trading-strategy","clone":"git clone https://github.com/NadirAliOfficial/contrarian-trading-strategy.git","description":"Python implementation of a Contrarian Trading Strategy to backtest market reversal approaches using historical stock data. Evaluate performance metrics such as profit, drawdown, win rate, and Sharpe ratio. Built with yfinance for data fetching and numpy and pandas for data analysis.","language":"Python","stars":10,"topics":["algorithmic-trading","backtesting","contrarian","python","quantitative-finance","stocks","yfinance"],"license":"MIT","category":"trading","readme_excerpt":"Contrarian Trading Strategy Python backtesting framework for contrarian (mean reversion) strategies on US equities using historical data from yfinance. Strategy Logic 1. Calculate rolling z-score of returns over N days 2. Enter long when z-score +2 (overbought) 4. Exit when z-score reverts to 0 5. Apply position sizing based on ATR Results (SPY, 2018–2023) Metric Value -------- ------- Total Return +42.3% Sharpe Ratio 1.38 Max Drawdown -12.1% Win Rate 58.4% Usage Parameters - --ticker — Stock symbol (default: SPY) - --start / --end — Backtest date range - --lookback — Z-score window in days (default: 20) - --zscore entry — Entry threshold (default: 2.0)","default_branch":null,"files":null,"tree":[],"storefront":"/r/NadirAliOfficial","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/NadirAliOfficial/contrarian-trading-strategy/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}