mirror of
https://github.com/BrentNeale1/fx-quant.git
synced 2026-07-28 10:57:43 +00:00
d843e63e7b942c5840f149fabdfa697b8acbc34c
Add Classic Pivot Points (P, R1-R3, S1-S3) computed from previous day's OHLC data, displayed as horizontal lines on an interactive Plotly.js candlestick chart at /chart with instrument/granularity selectors. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
fx-quant
Web Dashboard
A Flask-based web UI for managing the trading bot remotely — edit config, monitor status, view logs, and toggle the kill switch from a browser instead of SSH + manual YAML editing.
Setup
-
Set your dashboard password in
config/.env:DASHBOARD_PASSWORD=your-secure-password-here -
Build and start both services:
docker-compose build && docker-compose up -d -
Access via SSH tunnel (dashboard is not exposed publicly):
ssh -L 5000:localhost:5000 your-serverThen open http://localhost:5000 in your browser.
-
Log in with username
adminand the password you set in step 1.
Dashboard Pages
- Status (
/) — Current mode (paper/live), strategy, instruments, loop interval, kill switch toggle, and last 10 orders - Config (
/config) — Form-based editor for allsystem.yamlsections: instruments, granularities, strategy params, feature windows, AI settings, execution settings. Saves with backup and signals the bot to reload. - Logs (
/logs) — Tabbed tables showing order history (logs/order_log.csv) and AI decisions (logs/ai_decisions.csv), newest first
Config Reload Flow
When you save config changes through the dashboard:
- Dashboard backs up
system.yamltosystem.yaml.backup - Dashboard writes the updated config
- Dashboard creates a
RELOAD_CONFIGsignal file - Bot checks for this file at the top of each 60s loop iteration
- Bot reloads config, deletes the signal file, and continues with new settings
Kill Switch
The dashboard provides activate/deactivate buttons (with confirmation prompts) that create/remove the STOP_ALL_TRADING file — the same mechanism the bot already uses.
Files Added/Changed
| File | What |
|---|---|
src/dashboard.py |
Flask app — routes, auth, config editor, status, logs |
templates/base.html |
Base layout (Bootstrap 5 via CDN) |
templates/index.html |
Status page |
templates/config.html |
Config editor form |
templates/logs.html |
Order log + AI decisions tables |
docker-compose.yml |
Added dashboard service on port 5000 |
requirements.docker.txt |
Added flask, flask-httpauth |
config/.env |
Added DASHBOARD_PASSWORD |
src/order_executor.py |
Added RELOAD_CONFIG signal check in main loop |
Verification Checklist
docker-compose build && docker-compose up -d— both containers start- http://localhost:5000 shows login prompt (via SSH tunnel)
- Status page shows current config and kill switch state
- Edit a setting (e.g. add
GBP_USDto instruments), save - Bot logs show
CONFIG RELOAD REQUESTEDwithin 60s - Logs page shows order history and AI decisions
- Kill switch toggle works with confirmation dialog
Description
Languages
Python
93.1%
HTML
6.9%