尚未偵測到更新。GitHub 發布版本後會顯示在這裡。
個人 GitHub 帳號下公開儲存庫的擁有者可以登入並驗證所有權,自行管理介紹,無需管理員核准。
登入並產生驗證檔案,在 30 分鐘內將其提交至此儲存庫的預設分支。其他分支或分叉儲存庫中的檔案無效。然後在下方檢查檔案,即可無需管理員核准直接管理專案。請保留檔案以維持管理權限。
如需登入,將前往登入頁面。登入後請回到此處,再次點擊所選的驗證按鈕。
在專案資料夾中執行 /nomorevibe verify,即可驗證所有權並自行管理介紹。
一分鐘完成驗證製作者的介紹僅有上面的一句話。 更多詳情請閱讀儲存庫 README。 儲存庫 README ↗
正在載入完整 README。
檢視完整 README ↗Live app: https://rapos-sable.vercel.app · Chart Vision: https://rapos-sable.vercel.app/chart-vision · Optimiser: https://rapos-sable.vercel.app/optimizer
Backend API: https://rapos-api.onrender.com (health check; the free instance can take up to a minute to wake after being idle)
RAPOS is a portfolio web app with an AI backend. Version 3 adds two modules:
| Module | What it does | Where |
|---|---|---|
| Chart Vision (OpenCV) | Reads a screenshot of any candlestick chart and rebuilds the OHLC price data, then scores its risk | backend/cv/, chart-vision.html |
| Portfolio Optimiser | Mean-variance (Markowitz) optimisation with an efficient frontier, replacing the old fixed allocation table | backend/optimizer.py, optimizer.html |
python -m cv.evaluate (from backend/) benchmarks the digitiser against ground truth across 13 chart styles (including the independent mplfinance library), 3 densities and JPEG/resize degradation. Results go to backend/cv/results/.
Benchmark (351 images, 13 styles, 3 densities, clean/JPEG/resized):
| Metric | Result |
|---|---|
| Images processed without error | 351 / 351 |
| Price axis read by OCR | 99.7% |
| Mean close-price error (when candle count exact) | 0.064% (95th percentile 0.19%, max 0.82%) |
| Up/down direction correct | 99.7% |
| Correlation of extracted vs true returns | 0.997 |
| Exact candle count, 40 / 90 / 160 candles, clean image | 100% / 100% / 95% |
| Exact candle count, 40 / 90 / 160 candles, JPEG | 95% / 87% / 41% |
| Mean time per image | 2.1 s |
The LSTM is trained with PyTorch (train_lstm.py) and exported to lstm_weights.npz (export_lstm_weights.py). The API runs it with NumPy (lstm_numpy.py), which matches PyTorch to within 1e-7 and saves about 300 MB of RAM. PyTorch is only needed to retrain.
backend/data/asset_universe.csv, made by generate_asset_universe.py) is simulated data calibrated to typical long-run asset-class returns, volatilities and correlations.| Method | Endpoint | Purpose |
|---|---|---|
| POST | /api/digitize-chart | multipart image (+ optional price_high, price_low, interval) → candles, overlay image, risk analysis |
| GET | /api/optimize?profile=&risk_free=&max_weight= | optimise the built-in universe |
| POST | /api/optimize | same, with custom_assets: [{name, closes}] |
| POST | /api/analyze-series | risk metrics + LSTM signal for a list of closes |
| POST | /api/portfolio/analyze | {holdings: [{ticker, quantity} or {ticker, value}], profile} → current risk, optimal mix, trades (real market data) |
| GET | /api/history?ticker=&days= | daily closes + return/volatility/drawdown (Market Hub chart) |
| GET | /api/search-stocks?q= | search by company name or ticker (US, NSE/BSE, crypto) |
| GET | /api/quotes?tickers=AAPL,MSFT,BTC | batched live prices (Finnhub, Yahoo fallback) |
| GET | /api/live-price?ticker= | one live price |
| GET | /api/rebalance | older demo rebalancer on the simulated universe (kept for compatibility) |
| GET | /api/health | service, OCR, model and market-data status |
render.yaml builds backend/Dockerfile (FastAPI, OpenCV, Tesseract for axis OCR; the LSTM runs in NumPy, so the service uses ~230 MB and fits the free plan). Enter FINNHUB_API_KEY when asked (optional; live prices and news). When it's live, open https://<your-service>.onrender.com/api/health.PROD_API in js/rapos-config.js and push. It is the only place the backend URL is set../. Every push to main redeploys; other branches get preview URLs.Render's free plan sleeps after ~15 minutes idle; the first request then takes ~30-60 s, and the pages say so.
cd backend
pip install -r requirements-dev.txt # server deps + PyTorch (training), pytest; plus the Tesseract binary for axis OCR (apt install tesseract-ocr / brew install tesseract)
export FINNHUB_API_KEY=your_key # optional, for live prices and news
uvicorn main:app --reload # http://localhost:8000/docs
python -m pytest -q # 20 tests
Serve the frontend from the repo root (e.g. python -m http.server 5500) and open chart-vision.html or optimizer.html. Pages served from localhost use the local backend automatically; add ?api=https://... to point elsewhere.
Deploying with OCR: Render's native Python environment has no Tesseract. Deploy backend/ with the included Dockerfile (Render → Docker runtime) to enable axis OCR; otherwise Chart Vision asks for the high/low prices.
API key: set FINNHUB_API_KEY as an environment variable. Never commit keys.
RELIANCE.NS, TCS.BO; priced in rupees, converted to US dollars with the daily USD/INR rate so currency risk is included) and major crypto (BTC, ETH, ...)./api/predict-risk remain for reference.| Path | What it is |
|---|---|
index.html, login.html, signup.html, forgot-password.html, reset-password.html | Landing page and Supabase auth |
dashboard.html | Holdings (live prices), portfolio risk check, Rebalancer, PDF plan export |
chart-vision.html | Chart screenshot → OHLC data → risk analysis |
optimizer.html | Mean-variance optimiser (your portfolio, any tickers, or the demo universe) |
js/ | rapos-config.js (backend URL), api.js, ui.js, live-ticker.js, symbols.js |
backend/ | FastAPI service: main.py, market_data.py, portfolio.py, optimizer.py, cv/ (Chart Vision), forecast.py, LSTM files, tests/ |
docs/coursework/ | Lab, testing and poster documents submitted for the course |
Project_Report/ | Final project report |