Skip to content

Cypher-redeye/Cresta

Repository files navigation

Cresta Logo

CRESTA

Your Wealth, Powered by Intelligence

Production-grade AI Robo-Advisory for Indian Equity Markets

React Django PyTorch PostgreSQL Redis Docker License Status

Live Demo β†’ Β· Author β†’


Screenshots

Dark Mode Landing
Dark Mode Landing β€” live SENSEX/NIFTY ticker, 3D COBE globe, breathing emerald gradient, floating market data.
Light Mode Landing
Light Mode Landing β€” same data, zero compromise on readability. Globe adapts palette automatically.
Intelligent Features
Intelligent Features β€” AI Risk Profiling, Real-time Market Data, Automated Rebalancing cards.
Login Page
Login Page β€” Warren Buffett quote, Google OAuth, JWT authentication, sign up flow.
Email Verification
Email Verification β€” token-based verification for all new signups, 24-hour expiry.
Portfolio Dashboard
Portfolio Dashboard β€” total invested, current value, P&L, asset allocation donut, live ticker tape, AI alerts.
Holdings and AI Advisor
Holdings + AI Advisor β€” sparkline trends, BUY/SELL/HOLD signals, AI Score breakdown (Sentiment/Risk Fit/Valuation), personalized news.
Market Watch
Market Watch β€” stock search, 30-day historical + 7-day AI forecast, dynamic red/green coloring, NIFTY/SENSEX/BANK NIFTY indices.
Personalized News
Personalized News Feed β€” top gainers/losers, Reuters/Bloomberg headlines filtered by portfolio holdings.
Settings
Settings β€” profile management, dark/light mode toggle, language selection (English, Hindi, Gujarati, Punjabi).
Hindi Mode
Full Hindi Mode β€” entire dashboard rendered in Hindi including nav, tooltips, AI reasoning, holdings table, and alerts. Gujarati and Punjabi also supported.

Why Cresta?

Zerodha and Groww give you a brokerage. Smallcase gives you curated baskets. Cresta gives you a reasoning engine.

Zerodha / Groww Smallcase Wealthfront Cresta
AI Stock Scoring βœ— βœ— Partial βœ… Ensemble ML (LSTM + XGBoost + ARIMA + FinBERT)
Explainable Signals βœ— βœ— βœ— βœ… Sentiment / Risk Fit / Valuation breakdown
Indian Language Support βœ— βœ— βœ— βœ… Hindi, Gujarati & Punjabi
7-day Price Forecast βœ— βœ— βœ— βœ… Walk-forward validated ensemble
Email Watchlist Alerts βœ“ βœ— βœ“ βœ… Trigger-based, configurable
Risk Profiling (ML) βœ— βœ— βœ“ βœ… XGBoost + NFCS 2021 real survey data
Email Verification βœ— βœ— βœ“ βœ… Token-based, 24-hour expiry

Built for the 200M+ Indians who invest without institutional-grade tooling.


πŸ“Š ML Evaluation Metrics

1. 🧠 Intelligent Risk Profiling

Cresta dynamically classifies users as Conservative, Moderate, or Aggressive based on Age, Income, Investment Goals, and Risk Tolerance.

  • Model: XGBoost Classifier
  • Dataset: 25,000 profiles β€” 2,578 real NFCS 2021 Investor Survey respondents (FINRA Foundation) augmented with 22,422 synthetic profiles generated via SEBI income capacity guideline distributions and empirical behavioral noise.
  • Accuracy: 68% (Validated on heterogeneous synthetic noise)
  • Aggressive Recall: 97% β€” solved the high-bias "Moderate" issue

Explainable AI (XAI) β€” Feature Importance:

Feature Importance
Risk Tolerance 61.35%
Income 17.81%
Investment Goal 14.75%
Age 3.88%
Experience 2.21%

2. πŸ“ˆ Tier-2 Quant Stock Forecasting

  • Architecture: Attention-LSTM Hybrid + XGBoost + ARIMA Ensemble
  • Attention Mechanism: Applies learned temporal weights across LSTM hidden states, allowing the model to selectively focus on the most predictive time steps rather than treating all historical observations equally.
  • Ensemble Weights: (0.70 LSTM / 0.10 XGBoost / 0.20 ARIMA) selected via validation MAPE minimization across walk-forward folds β€” LSTM dominates long-horizon trend capture while ARIMA stabilizes short-term variance.
  • Features (16): Close, Volume, SMA (5, 20), RSI (14), MACD, Bollinger Bands, OBV, FinBERT Sentiment (daily NSE-listed company headlines via yfinance news API, aggregated as mean sentiment score per ticker across all articles published within 24 hours), USD/INR Exchange Rate, India VIX, Crude Oil Futures
  • Validation: Strict Walk-Forward Validation (3-fold expanding window, minimum 45-day folds) β€” no look-ahead bias
  • Seed: Fixed at 42 for full reproducibility
  • Dataset: 20 years of historical Nifty50 daily data (via Kaggle & yfinance)

Forecasting Performance (Walk-Forward Validated):

Ticker Sector Avg Ensemble MAPE Status
RELIANCE.NS Energy/Conglomerate 1.33% βœ… Verified
TCS.NS IT Services 3.85% βœ… Verified
INFY.NS IT Services 2.69% βœ… Verified
HDFCBANK.NS Banking 2.67% βœ… Verified
ICICIBANK.NS Banking 2.51% βœ… Verified
SUNPHARMA.NS Pharma 0.82% βœ… Verified
MARUTI.NS Auto 7.66% βœ… Verified
ONGC.NS Energy 4.30% βœ… Verified

Average Ensemble MAPE across test set: 3.23% (Dramatic improvement from ~11-18%)


ML Pipeline

Raw Market Data (OHLCV + News Headlines)
         β”‚
         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              Feature Engineering             β”‚
β”‚  RSI Β· MACD Β· Bollinger Β· SMA Β· OBV Β·       β”‚
β”‚  India VIX Β· USD/INR Β· Crude Β· FinBERT      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                    β”‚  16 features
         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
         β–Ό                     β–Ό
  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚ Attention-  β”‚       β”‚  XGBoost    β”‚
  β”‚   LSTM      β”‚       β”‚  Regressor  β”‚
  β”‚ (temporal)  β”‚       β”‚ (tabular)   β”‚
  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜       β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜
         β”‚                     β”‚
         β–Ό                     β–Ό
  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚    ARIMA    β”‚       β”‚   FinBERT   β”‚
  β”‚ (baseline)  β”‚       β”‚  (NLP sent) β”‚
  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜       β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜
         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                   β–Ό
          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
          β”‚    Ensemble    β”‚
          β”‚  0.70/0.10/0.20β”‚
          β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                  β–Ό
     AI Score + BUY / SELL / HOLD
          7-day Price Forecast

πŸ—οΈ System Architecture

graph TD
    Client[React + Vite Frontend] <-->|HTTPS / REST API| Nginx[Nginx Reverse Proxy]
    Nginx <-->|Gunicorn| Django[Django 5 Backend]
    Django <-->|Task Queue| Redis[Redis Broker]
    Redis <--> Celery[Celery + Celery Beat]
    Celery <-->|Train/Predict| PyTorch[Attention-LSTM Engine]
    Celery <-->|Analyze News| FinBERT[HuggingFace NLP]
    Django <-->|Classify Risk| XGBoost[XGBoost Profiler]
    Django <--> Postgres[(PostgreSQL)]
    PyTorch <--> YF[yfinance API]
Loading

πŸ—„οΈ Database Schema

erDiagram
    USER ||--o{ PORTFOLIO : owns
    USER {
        int id PK
        string email
        string password_hash
    }
    INVESTOR_PROFILE ||--|| USER : belongs_to
    INVESTOR_PROFILE {
        int id PK
        int age
        decimal income
        int risk_tolerance
        string user_class "Aggressive/Moderate/Conservative"
        boolean email_verified
    }
    PORTFOLIO ||--o{ HOLDING : contains
    PORTFOLIO {
        int id PK
        decimal total_value
        decimal cash_balance
    }
    HOLDING ||--o{ ALERT : triggers
    HOLDING {
        int id PK
        string ticker
        decimal quantity
        decimal average_buy_price
    }
    STOCK_PREDICTION {
        string ticker PK
        json history_array
        json future_forecast_array
        timestamp last_updated
    }
    ALERT {
        int id PK
        string ticker
        string signal "Buy/Sell/Hold"
        boolean is_active
    }
    PAPER_TRADE {
        int id PK
        string ticker
        string action "BUY/SELL"
        decimal quantity
        decimal price_at_trade
        timestamp created_at
    }
    WATCHLIST_ALERT {
        int id PK
        string ticker
        decimal target_price
        string condition "ABOVE/BELOW"
        boolean triggered
    }
Loading

✨ Core Features

🌍 Interactive 3D Global Exchange Globe

  • 7 Global Exchanges: BSE SENSEX, NSE NIFTY 50, FTSE 100, NYSE/DOW, IBOVESPA, NIKKEI 225, ASX 200
  • Geographic Sync: Angular-distance phi detection ensures correct exchange card appears when that continent faces the camera
  • Live Data: BSE SENSEX and NSE NIFTY 50 prices fetched live from backend API
  • Theme-Aware: Globe adapts palette for Light and Dark mode via ThemeContext

🎨 Premium Emerald Design System

  • Dark Mode: Deep charcoal #121212 Β· Light Mode: Cool off-white #f0f4f8
  • Animated Background: Canvas-based breathing gradient with 3 independent radial emerald glows + 45 floating market data numbers (SENSEX values, β‚Ή prices, β–²β–Ό indicators)
  • Complete cyanβ†’emerald migration across all components, Tailwind config, and CSS variables

πŸ€– Explainable AI (XAI) & Fiduciary Scoring

  • Sentiment (40 pts): FinBERT NLP on daily NSE-listed company headlines
  • Risk Fit (40 pts): Stock Beta matched against ML-classified user risk profile
  • Valuation (20 pts): Price positioning relative to 52-week high/low
  • Natural language reasoning generated per stock for full fiduciary transparency

πŸ“ˆ Performance-Driven Data Visualization

  • Dynamic green/red chart coloring across all charts based on price direction
  • Growth Forecast: historical line colored by trend, AI forecast in blue with confidence shading
  • Portfolio chart, holdings sparklines, market indices all follow same logic

πŸ” Security & Authentication

  • JWT with 15-minute access tokens and HttpOnly refresh rotation
  • Email Verification: Token-based verification for all new signups (24-hour expiry, SMTP delivery)
  • Google OAuth integration
  • Stock ticker inputs validated against NSE/BSE suffix whitelist
  • Computational DoS mitigation via PostgreSQL prediction cache
  • Production: SECURE_SSL_REDIRECT, X-Frame-Options: DENY, strict HSTS

🌐 Deep Localization (i18n)

  • react-i18next supporting English, Hindi, Gujarati, and Punjabi
  • All UI components, ML reasoning strings, and alerts translatable

πŸ“Š Portfolio Management

  • Real-time P&L tracking via yfinance
  • Smart Buy/Sell/Hold alerts based on moving average crossovers
  • Email watchlist price trigger alerts via SMTP
  • Paper trading and watchlist alert models
  • Live ticker tape: SENSEX, NIFTY, BANK NIFTY, NIFTY IT, NASDAQ, S&P 500, USD/INR, GOLD

πŸ› οΈ Technology Stack

Category Technology Purpose
Frontend React 18, Vite, TailwindCSS, COBE UI, routing, globe visualization
Backend Django 5, DRF API layer, ML serving, alert triggers
Database PostgreSQL Users, holdings, watchlist, alerts
Cache Redis ML results, live ticker data
Auth JWT + Google OAuth Authentication, email verification
ML PyTorch, XGBoost, statsmodels, FinBERT Ensemble advisory engine
MLOps MLflow CV loss curves, model versions, hyperparameters
DevOps Docker, Nginx, Gunicorn Containerization, production serving
i18n react-i18next English, Hindi, Gujarati, Punjabi

πŸš€ Quick Start

With Docker (Recommended)

git clone https://github.com/Cypher-redeye/Cresta.git
cd Cresta
docker-compose up --build
  • Frontend: http://localhost:5173
  • Backend API: http://localhost:8000/api/

Without Docker

# Backend
cd backend
python -m venv venv
source venv/bin/activate   # Windows: venv\Scripts\activate
pip install -r requirements.txt
cp .env.example .env       # Fill in values
python manage.py migrate
python manage.py runserver

# Frontend
cd frontend
npm install
npm run dev

Environment Variables

Backend (backend/.env)

Variable Description
SECRET_KEY Django secret key
DEBUG False in production
DATABASE_URL PostgreSQL connection string
REDIS_URL Redis connection URL
ALLOWED_HOSTS Comma-separated allowed hosts
CORS_ALLOWED_ORIGINS Frontend URL(s)
EMAIL_HOST_USER SMTP sender address
EMAIL_HOST_PASSWORD SMTP app password
FRONTEND_URL Frontend URL for email verification links

πŸ—ΊοΈ Roadmap

  • Oracle Cloud Deployment β€” full ML stack on 4 OCPU / 24GB RAM free tier
  • Portfolio Backtesting β€” simulate historical strategy vs Nifty50 benchmark with Sharpe ratio, drawdown, CAGR
  • Options Chain Analyzer β€” IV and Greeks visualization for F&O traders
  • Mutual Fund Coverage β€” extend AI scoring to top 50 Indian MFs
  • Mobile App β€” React Native port with push-based watchlist alerts
  • SEBI Compliance Pipeline β€” auditable reasoning logs for RIA regulations

πŸ“š Academic References

  • Hochreiter, S., & Schmidhuber, J. (1997). Long Short-Term Memory. Neural Computation, 9(8), 1735–1780.
  • Vaswani, A., et al. (2017). Attention Is All You Need. NeurIPS.
  • Araci, D. (2019). FinBERT: Financial Sentiment Analysis with Pre-trained Language Models. arXiv:1908.10063.
  • Chen, T., & Guestrin, C. (2016). XGBoost: A Scalable Tree Boosting System. KDD '16.
  • Markowitz, H. (1952). Portfolio Selection. Journal of Finance, 7(1), 77–91.

Contributors


Author

Om Sharma AI Engineering Student Β· Parul University Β· Batch 2023–2027

GitHub

Built end-to-end as a final year capstone project. Every architectural decision is production-intent.


Cresta is a production-ready, highly localized Robo-Advisory platform demonstrating the viable intersection of behavioral finance, deep learning, and modern web architecture.

About

A full-stack AI Robo-Advisory platform for the Indian equity market, combining Attention-LSTM forecasting, FinBERT sentiment analysis, and XGBoost risk profiling to deliver personalized, explainable stock recommendations.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors