Skip to content

Latest commit

 

History

History
66 lines (52 loc) · 2.85 KB

File metadata and controls

66 lines (52 loc) · 2.85 KB

Volatility-Aware Trading Assistant

An AI-powered Streamlit dashboard that connects to Zerodha Kite, forecasts next-day volatility with MGARCH (DCC), visualizes correlations, and provides risk-aware insights with paper/real trade workflows.

Features

  • Live/historical data via Zerodha Kite Connect (with synthetic fallback if not logged in)
  • MGARCH (DCC) volatility forecasts via arch, with safe univariate/rolling fallbacks
  • Plotly visualizations: prices, rolling volatility, animated correlation heatmap, correlation-over-time
  • Risk KPIs: forecasted volatility, suggested stop-loss, position sizing
  • Paper trading simulator and real trading scaffold (map indices to tradable instruments)
  • Modern dark UI with glassmorphism styling

Project Structure

  • app.py — Streamlit application
  • requirements.txt — Python dependencies
  • .streamlit/config.toml — UI theme (optional)

Prerequisites

  • Python 3.10+
  • Zerodha Kite Connect API key/secret (for live data and real orders)

Installation

# 1) Create and activate a virtual environment (recommended)
python -m venv .venv
. .venv/Scripts/activate  # Windows PowerShell: .venv\Scripts\Activate.ps1

# 2) Install dependencies
pip install -r requirements.txt

Running the App

streamlit run app.py

Then open the URL shown (usually http://localhost:8501).

Zerodha Login Flow

  1. Enter your API Key and API Secret in the sidebar.
  2. Click the generated login URL, complete login on Zerodha to obtain a request_token.
  3. Paste the request_token back in the app and click "Generate Access Token".
  4. On success, live data and real trading endpoints become available.

Note: Index symbols like Nifty 50, Nifty IT, Nifty FMCG are not directly tradable. For real trades, map to tradable instruments like ETFs (e.g., NIFTYBEES) or futures before placing orders. The app’s real trading function is a placeholder and intentionally skips order placement until you wire correct mappings.

Modeling Notes

  • Primary: MGARCH DCC built using arch.multivariate.DynamicConditionalCorrelation
  • Fallbacks: univariate GARCH(1,1) per series, or rolling standard deviation
  • Forecasts reported as annualized volatility (%)
  • Stop-loss suggestion = volatility × multiplier (configurable)
  • Position sizing uses risk-per-trade % and stop-loss distance

Data Refresh

  • Manual refresh button clears caches and reloads
  • Optional auto-refresh every 60 seconds

Optional: LSTM Comparison (future work)

  • Add an LSTM model on returns to compare with MGARCH forecasts and report accuracy

Safety & Disclaimers

  • For educational and paper trading use. Markets are risky; no guarantees.
  • Ensure compliance with broker APIs and exchange regulations.
  • Never deploy real trading without thorough testing and proper risk controls.

Credits

Developed by Maithili Sharma | Department of AI, Vishwakarma University