--:--:-- HKT

System Architecture

End-to-end data flow from market feeds → Futu API → trading logic → dashboard. Tap any section to explore.

HK ETF Strategy US ETF Strategy Futu OpenAPI Simulate Mode L2 Quotes (Paid) Cloudflare CDN
Server
DO SGP1
HK Capital
200k HKD
US Capital
$30k USD
HK Cron
08:30 HKT
US Cron
20:00 HKT
Mode
Simulate
Quote Feed
L2 · Futu
🌐
External Data Sources
HKEX · NYSE/NASDAQ via Futu API (L2) · Yahoo Finance (VIX only)
3 feeds
HKEX
HK ETF prices via Futu broker feed
HK Market L2 · Futu API
Tap for details
ETF prices (07200, 07226, 07500, 07552) are Futu broker prices delivered via the Futu OpenAPI. L2 (Level 2, paid subscription) — includes full order book depth. Not a direct HKEX feed; Futu re-distributes the exchange data through their cloud infrastructure.
NYSE · NASDAQ
US ETF prices via Futu broker feed
US Market L2 · Futu API
Tap for details
SPY, QQQ, SDS, QID prices are Futu broker prices via the Futu OpenAPI. L2 (Level 2, paid) — full order book depth. 1-min ORB bars built via request_history_kline(). All US execution prices come from Futu OpenD — yfinance is used only for ^VIX.
Yahoo Finance
^VIX volatility index only
VIX only
Tap for details
Fetched via yfinance library. Used exclusively for daily ^VIX close + 20-day MA for the US regime gate check before market open. Not used for execution.
L2 broker price feed via Futu API
☁️
Futu Cloud
Securities infrastructure — L2 broker feed relay + order execution
2 accounts
Futu Data Servers
L2 broker quote relay · order routing
Cloud L2 Paid
Tap for details
Aggregates Level 2 (full order book) quotes from HKEX and US exchanges. Paid L2 subscription — includes full bid/ask order book depth, not just last-trade price. Streams to local OpenD via Futu's proprietary binary TCP on port 11111. Handles order routing back to exchange.
HK Simulate Account
200,000 HKD · TrdEnv.SIMULATE
HK Paper
Tap for details
CSOP HK ETF paper account. Lot size = 100 shares. Orders via OpenSecTradeContext. Position data syncs across Futu App and desktop client in real-time.
US Simulate Account
$30,000 USD · TrdEnv.SIMULATE
US Paper
Tap for details
STOCK_AND_OPTION account type — supports margin. ProShares SDS + QID paper trading. Must use refresh_cache=True on all position/order/account queries.
OpenD TCP gateway · 127.0.0.1:11111
🖥️
DigitalOcean VPS
SGP1 · Ubuntu 22.04 · /opt/squote/
6 services
Futu OpenD
127.0.0.1:11111 · persistent daemon
Gateway
Tap for details
Local process authenticating with Futu Cloud and exposing quote + trade API to Python scripts. Managed by systemd (futu-opend.service). Must be running before any trader starts.
Cron Scheduler
/etc/cron.d/squote-trader
Cron
Tap for details
Two jobs: HK trader at 08:30 HKT Mon–Fri, US trader at 20:00 HKT Mon–Fri. Each job runs a pgrep guard to prevent double-spawning if the previous run is still active.
HK Trader
live_trader.py
HK
ACTIVE NOW
Tap for details
HSTECH ORB Breakout (07226/07552) + HSI Gap Continuation (07200/07500). σ-based ORB range, TP1 + trailing stop, SL reversal before 14:30, hard EOD exit 15:50 HKT.
US Trader
sds_qid/futu_trader.py
US
ACTIVE NOW
Tap for details
Regime gate: VIX ≥ 20 AND VIX > MA20 AND daily spike ≥ 3%. SPY/QQQ ORB 09:30–10:00 ET. Lot 1 (60% capital) on breakdown, Lot 2 (+40%) on −0.75% drop. Hard EOD 15:50 ET.
SQLite Database
trades.db · WAL mode
Storage
Tap for details
Tables: trades, daily_notes, account_snapshot. Modes: paper, simulate, us_simulate, us_live. Every signal, trade event, state transition logged with timestamp. Deterministically replayable.
Flask Dashboard
dashboard_server.py · :8080
API + UI
Tap for details
Endpoints: /api/status, /api/quotes (HK Futu), /api/us_quotes (Futu + yfinance VIX), /api/today, /api/trades, /api/daily_decision. Serves live_dashboard.html. Quotes cached 60s.
HTTP origin · port 8080
🔶
DNS & Delivery
GoDaddy registrar · Cloudflare DNS proxy · SSL
2 services
GoDaddy
Domain registrar — arrie.pro
Registrar
Tap for details
arrie.pro registered with GoDaddy. Nameserver records delegated to Cloudflare (NS → ns1/ns2.cloudflare.com). GoDaddy handles only registration — no proxying role.
Cloudflare
DNS proxy · CDN · SSL/TLS · DDoS
CDN / Proxy
Tap for details
Authoritative DNS for arrie.pro. A record proxied (orange cloud) to VPS IP. SSL terminates at Cloudflare edge — VPS serves plain HTTP :8080. Real VPS IP hidden. Free DDoS protection.
Proxied HTTPS · arrie.pro
💻
Dashboard — arrie.pro
Desktop + Mobile browser · auto-refresh 10s
Live
HK Dashboard Tab
ETF quotes · P&L · 7-day activity
HK
Tap for details
Live Futu quotes for 07200/07226/07500/07552. Equity curve chart, today's trades table, 7-day activity log. Capital bar showing 200k HKD. Mobile-responsive grid.
US Dashboard Tab
SDS/QID/SPY/QQQ/VIX · decision log
US
Tap for details
Live price tiles: SDS, QID, SPY, QQQ via Futu OpenD. VIX via yfinance. Daily Decision Log with TRADED / NO TRADE (shows VIX values) / NO BREAKDOWN. Capital bar $30k USD.
Strategy Detail Flows
  • 1
    08:30 HKT — Cron fires HK trader
    pgrep guard prevents double-spawn. Process checks OpenD is reachable.
  • 2
    09:20 HKT — Futu OpenD connect
    OpenQuoteContext + OpenSecTradeContext init. SIMULATE account selected.
  • 3
    09:25 HKT — HSI gap check
    Previous close vs today's open. Gap range 0.55%–2.0% triggers HSI Gap Continuation setup.
  • 4
    09:30–10:00 HKT — HSTECH ORB build
    5-min bars via Futu. ORB range width must exceed σ threshold to arm breakout trigger.
  • 5
    10:00–14:30 HKT — Live scan
    Breakout above/below ORB fires entry. TP1 partial exit + trailing stop. SL reversal allowed before 14:30.
  • 6
    15:50 HKT — Hard EOD exit
    All positions closed regardless of P&L. Events + equity snapshot written to trades.db.
  • 1
    20:00 HKT — Cron fires US trader
    pgrep guard. First action: VIX regime check before connecting to Futu.
  • 2
    Regime gate — yfinance ^VIX check
    Requires VIX ≥ 20.0 AND VIX > 20-day MA AND daily spike ≥ 3%. All three must pass. On failure: logs skip note with exact values → exit.
  • 3
    20:02 HKT — Futu OpenD connect
    Only runs if regime passed. US simulate account selected.
  • 4
    21:30–22:00 HKT — SPY/QQQ ORB
    09:30–10:00 ET. 1-min bars via request_history_kline(). ORB_low locked at 22:00 HKT.
  • 5
    22:00 HKT — Breakdown trigger armed
    Entry = ORB_low × 0.999. Lot 1 (60% of $15k) on break. Lot 2 (+40%) when SPY/QQQ drops −0.75% from Lot 1 price.
  • 6
    03:50 HKT — Hard EOD exit
    15:50 ET equivalent. All SDS/QID positions closed. Decision + trades logged to trades.db (mode: us_simulate).
  • 1
    Flask on :8080
    dashboard_server.py serves live_dashboard.html and all REST endpoints. Started on boot via systemd or screen session.
  • 2
    HK quotes — Futu OpenD
    /api/quotes: OpenQuoteContext.get_market_snapshot() for 07200, 07226, 07500, 07552. 5-min cache.
  • 3
    US quotes — Futu primary + VIX fallback
    /api/us_quotes: SDS/QID/SPY/QQQ via Futu OpenD. ^VIX always yfinance. 60s cache.
  • 4
    Daily Decision Log
    /api/daily_decision groups daily_notes by date. Classifies each day: TRADED / NO TRADE (with VIX values) / NO BREAKDOWN.
  • 5
    Browser auto-refresh every 10s
    All API endpoints polled. HKT→ET conversion for US timestamps. Mobile responsive CSS Grid. Server date used for today-marker to avoid UTC offset issues.
  • 1
    GoDaddy — Domain Registration
    arrie.pro purchased and registered with GoDaddy. NS records updated to point at Cloudflare's nameservers (ns1/ns2.cloudflare.com).
  • 2
    Cloudflare — Authoritative DNS
    A record for arrie.pro → VPS IP, with orange-cloud proxy enabled. All DNS queries for arrie.pro answered by Cloudflare.
  • 3
    SSL Termination at Edge
    Browser ↔ Cloudflare: HTTPS (free Universal SSL). Cloudflare → VPS: HTTP :8080. No certificate needed on VPS origin server.
  • 4
    DDoS Protection + IP Masking
    Real VPS IP hidden behind Cloudflare's anycast network. Cloudflare absorbs volumetric attacks before they reach the droplet.