| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
QuantIQ is an AI-powered decision intelligence platform for retail investors. Instead of forcing users to switch between charts, news sites, screeners, and general-purpose LLMs, QuantIQ brings live market data, historical trends, technical indicators, machine learning predictions, and AI-assisted reasoning into a single experience. The goal is not to predict the market with certainty, but to reduce research time and provide transparent, data-backed insights that help users make more informed trading and investment decisions.
The platform operates on two distinct but coordinated intelligence layers:
Both components share the same underlying machine learning pipeline. When a new model version is trained, both tools update together automatically.
Infrastructure note: The entire platform runs on free-tier services. The only variable cost is the Gemini API, which amounts to a few rupees per analysis call.
The public entry point features a sleek, dark-themed responsive landing page outlining the platform's capabilities.
Stateless session management via JWT tokens, supporting traditional email signups and Google OAuth credential linking.
A real-time trading board with fluid, GPU-accelerated TradingView candlestick charts, interactive indicators (SMA, EMA, RSI), and a sidebar tape for watchlists and alert status.
Generate detailed, tool-grounded financial analysis reports dynamically utilizing the ReAct agent architecture.
Interact with your quantitative strategy co-pilot. Customize entry/exit targets on the chart, ask technical questions, and get real-time memory-anchored answers.
Comprehensive system monitoring. Live Grafana dashboard scraping FastAPI, Celery latency, Redpanda delay, and memory footprint in real time.
Interactive entity mapping and tables tracking watchlist coordinates, strategy backtesting predictions, and user checkouts.
[ Hugging Face Spaces (Docker) ]
+----------------------------------+
| worker/worker.py |
| - yfinance tick polling (5s) |
| - AIOKafkaProducer publish |
| - 1-min OHLCV aggregation |
| - NeonDB batch write |
| - Price alert evaluation |
+----------------------------------+
|
Redpanda Cloud (Kafka-compatible)
topic: stock-ticks
|
+----------------------------------+
| backend/app/main.py |
| - FastAPI + Uvicorn (ASGI) |
| - Strawberry GraphQL |
| - AIOKafkaConsumer subscriber |
| - ONNX model inference |
| - Gemini ReAct Agent |
| - Advisor Chat endpoint |
| - Razorpay webhook handler |
| - /metrics (Prometheus) |
+----------------------------------+
| Celery + Redis |
| - Prediction outcome labeling |
| - Strategy outcome comparison |
+----------------------------------+
|
+--------------------+-------------------+
| |
NeonDB (PostgreSQL) Grafana Cloud
- users, watchlists scrapes /metrics
- stock_history, alerts via Prometheus
- prediction_logs
- strategy_logs
|
Vercel (Frontend)
- React 19 + Vite + TypeScript
- GraphQL WebSocket subscription
- Lightweight Charts candlestick
- Real-time ticker tape
- AI Analyst + Advisor Chat
Data Flow:
| Layer | Technology | Why |
|---|---|---|
| Language | Python 3.12 | Native async/await, rich ecosystem |
| Package Manager | uv | Faster than pip, lockfile-based reproducibility |
| Web Framework | FastAPI | Best-in-class async Python framework |
| ASGI Server | Uvicorn | Production-grade, WebSocket support |
| GraphQL | Strawberry GraphQL | Code-first, Python type annotations |
| ORM | SQLAlchemy 2.x (async) | Fully async queries via asyncpg |
| Database Driver | asyncpg | Native async PostgreSQL protocol |
| Migrations | Alembic | Versioned, reversible DB migrations |
| Validation | Pydantic v2 | Fast request/response schema validation |
| Database | NeonDB (PostgreSQL) | Free-tier serverless Postgres |
| Message Broker | Redpanda Cloud | Free-tier Kafka-compatible broker |
| Task Queue | Celery + Redis | Periodic MLOps labeling background tasks |
| Market Data | yfinance | Free Yahoo Finance wrapper, no API key |
| Technical Analysis | pandas-ta | RSI, MACD, EMA on Pandas DataFrames |
| ML Training | scikit-learn | RandomForestClassifier for direction prediction |
| ML Runtime | ONNX Runtime | Sub-millisecond local inference, zero cloud cost |
| ML Export | skl2onnx | Converts sklearn models to portable ONNX format |
| AI Layer | Google Gemini 2.5 Flash | ReAct reasoning agent with native tool use |
| AI SDK | google-genai | Official Google GenAI Python SDK |
| Payments | Razorpay | Free-tier payment gateway with webhooks |
| HTTP Client | httpx | Async HTTP for outbound API calls |
| Media Storage | Cloudinary | Free-tier profile image upload and serving |
| Auth | JWT (PyJWT) + Google OAuth | Stateless bearer tokens + Google login |
| smtplib (MIME) | Transactional email via Gmail SMTP | |
| Observability | prometheus-fastapi-instrumentator | Auto-instrumented HTTP metrics |
| Dashboarding | Grafana Cloud (free tier) | Live production monitoring dashboard |
| Containerization | Docker | Reproducible builds for backend + worker |
| Frontend Language | TypeScript 5.x | End-to-end type safety |
| Frontend Framework | React 19 | Component rendering with concurrent features |
| Build Tool | Vite | Fast dev server and production bundler |
| Styling | Tailwind CSS v4 | Utility-first CSS |
| Charting | Lightweight Charts (TradingView) | GPU-accelerated candlestick rendering |
| Backend Hosting | Hugging Face Spaces | Free persistent Docker runtime |
| Frontend Hosting | Vercel | Free zero-config React/Vite deployment |
The initial implementation used asyncio.sleep loops and Redis Pub/Sub. The migration to Redpanda was driven by three specific requirements:
Rather than calling a hosted inference API on every request, the model is trained once locally with train.py, exported to ONNX, and loaded into the FastAPI process on startup.
Model details:
The agent runs a multi-step loop until it has sufficient context, then produces a structured JSON response: {"bullish_probability": int, "reason": "..."}.
Agent Tools:
| Tool | What it does |
|---|---|
| get_user_watchlist | Fetches the user's tracked tickers from NeonDB |
| get_stock_history_and_indicators | Pulls OHLCV history and computes RSI, MACD, EMA via pandas-ta |
| get_ml_prediction | Runs ONNX inference and returns the bullish probability score |
| get_user_alerts | Retrieves the user's active price alert thresholds |
| create_price_alert | Creates a new price alert for a given ticker |
On every message, the system prompt is dynamically constructed with the live ticker price, active indicators, user-drawn price markers, the real-time ONNX probability score, and the last 30 turns of conversation history. This allows the Advisor to cross-reference its own prior recommendations when evaluating the user's current chart markers, rather than treating each message as an independent request.
Every Analyst prediction is logged to prediction_logs. A Celery periodic task runs every two minutes, fetches the current price, calculates outcome and PnL, and marks the record as completed.
The strategy tracker extends this to user-defined levels. When a user locks in a strategy through the Advisor, both the AI recommended levels and the user's custom levels are stored in strategy_logs. The worker evaluates both configurations independently on each cycle, enabling a direct AI vs. user performance comparison over time.
All metrics are exposed at /metrics and scraped by Grafana Cloud every minute.
HTTP Layer (auto via prometheus-fastapi-instrumentator):
AI Strategy Engine (custom collectors):
Market Data Pipeline (custom collectors):
Application Core (custom collectors):
| Plan | Price | AI Credits | Refresh |
|---|---|---|---|
| Free | Rs.0 | 3 (lifetime) | No |
| Analyst | Rs.500 | 10 (one-time) | No |
| Trader | Rs.1,500 | 50 (one-time) | No |
| Pro | Rs.10,000 | 100/month | Monthly |
Payments go through Razorpay with HMAC webhook verification before any tier or credit update happens server-side. New users see a 3-day discount offer evaluated from the account creation timestamp.
QuantIQ/ | |-- backend/ # FastAPI backend service | +-- app/ | |-- main.py # App entrypoint, ONNX loader, Prometheus init | |-- api/ | | +-- endpoints.py # REST routes: auth, watchlist, alerts, payments, metrics | |-- config/ | | |-- settings.py # Pydantic Settings: all env vars | | +-- metrics.py # Custom Prometheus collector definitions | |-- database/ | | |-- session.py # SQLAlchemy async engine + session factory | | |-- models.py # ORM models: User, Watchlist, StockHistory, | | | # Alert, PredictionLog, StrategyLog | | +-- crud.py # Database query functions | |-- graphql/ | | +-- schema.py # Strawberry GraphQL: queries, mutations, subscriptions | |-- schemas/ | | +-- schemas.py # Pydantic request/response models | +-- services/ | |-- gemini.py # Gemini ReAct agent, ONNX inference helper | +-- celery_app.py # Celery worker: prediction + strategy outcome labeling | |-- worker/ | +-- worker.py # yfinance polling, AIOKafkaProducer, OHLCV aggregation | |-- frontend/ # React 19 + Vite + TypeScript | +-- src/ | |-- pages/ # LandingPage, Dashboard, UpgradePage | |-- components/ # StockChart, AIAnalyst, AdvisorChat, | | # WatchlistSidebar, PriceAlerts | +-- App.tsx # Router, auth state, Google OAuth | |-- alembic/ # Alembic migration scripts |-- train.py # Offline ML training + ONNX export |-- model.onnx # Trained ONNX model |-- pyproject.toml # uv project config + Python dependencies |-- supervisord.conf # Process supervisor for HF Spaces Docker container +-- README.md
# Google Gemini API Key — aistudio.google.com (free quota available)
GEMINI_API_KEY=your_gemini_api_key_here
# Database — NeonDB free tier PostgreSQL connection string
DATABASE_URL=postgresql://user:password@host/dbname
# Redpanda Cloud bootstrap server (free tier)
KAFKA_BOOTSTRAP_SERVERS=your_redpanda_bootstrap_server:9092
# JWT secret key for token signing
SECRET_KEY=your_secret_key_here
# Razorpay credentials — dashboard.razorpay.com
RAZORPAY_KEY_ID=your_razorpay_key_id
RAZORPAY_KEY_SECRET=your_razorpay_key_secret
# Cloudinary — free tier for profile image uploads
CLOUDINARY_CLOUD_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_API_SECRET=your_api_secret
# Gmail SMTP for transactional email
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=your_email@gmail.com
SMTP_PASS=your_app_password
# Hugging Face model repository
HF_MODEL_REPO=Karan6124/quantiq-modelPrerequisites: Python 3.12+, Node.js 18+, uv (pip install uv), Docker Desktop
# 1. Clone the repo
git clone https://github.com/Edge-Explorer/QuantIQ.git
cd QuantIQ
# 2. Install Python dependencies
uv sync
# 3. Start local PostgreSQL
docker-compose up -d
# 4. Add your .env file (copy the template above)
# 5. Run database migrations
uv run alembic upgrade head
# 6. Start the backend
uv run uvicorn backend.app.main:app --reload
# 7. Start the ingestion worker
uv run python worker/worker.py
# 8. Start the Celery worker (for MLOps background tasks)
uv run celery -A backend.app.services.celery_app worker --beat --loglevel=info
# 9. Start the frontend
cd frontend && npm install && npm run devuv run python train.pyThis fetches 2 years of daily OHLCV data, computes RSI/MACD/EMA features, trains a RandomForestClassifier, exports to model.onnx via skl2onnx, and verifies the output with a test inference call. Upload the resulting model.onnx to your Hugging Face Hub repo so the backend can download it on cold starts.
| Component | Platform | Cost |
|---|---|---|
| Backend + Worker | Hugging Face Spaces (Docker) | Free |
| Frontend | Vercel | Free |
| Database | NeonDB | Free tier |
| Message Broker | Redpanda Cloud | Free tier |
| Monitoring | Grafana Cloud | Free tier |
| AI Analysis | Google Gemini API | Pay-per-use (very small) |
To deploy backend updates to Hugging Face Spaces, do not push manually. Run the automated deployment script from the project root:
.\deploy_hf.ps1This script prepends required YAML frontmatter config, commits and pushes to the HF remote space, and automatically restores the clean README.md file for GitHub. After running the script, push your clean branch updates to GitHub: git push origin main.
The project uses GitHub Actions for automated code quality and build verification on every push and pull request to the main branch:
Interested in adding features or helping us scale? Check out our Contribution Guidelines for local setup instructions and a list of active Open Issues (like Discord webhooks and ONNX model metadata APIs).
MIT — do whatever you want with it. See LICENSE.
| Back | FazBrowse Home | New Git URL |