Commit Graph

36 Commits

Author SHA1 Message Date
dekun 9d1986d771 Exclude trend and roll monitors from position-limit freeze count.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-24 02:04:09 +08:00
dekun 322060de31 Show position-limit freeze on hub and instance risk badges.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-24 01:58:24 +08:00
dekun c0f3606ecc Add win rate and profit-loss ratio to archive stats.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-21 09:13:37 +08:00
dekun c05afbbedf Add win/loss metrics to archive stats with symbol filter sync.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-21 09:03:21 +08:00
dekun ce172a7cee Fix false freeze after restart from stale account_risk_state.
Clear expired cooloff on read, never restart timer from invalid future anchors, and reconcile with journaled manual closes when the 1h window already ended.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-18 22:14:58 +08:00
dekun 9330e356fc Fix freeze countdown exceeding configured cooloff hours.
Clamp future last_close anchors, cap remaining time server-side, prefer freeze_remaining_sec in the badge JS, and auto-repair stale DB rows on read.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-18 22:11:09 +08:00
dekun deb240d4eb docs(risk): clarify cooloff countdown uses last manual close only
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-18 22:04:50 +08:00
dekun c73944581c fix(risk): stop stale 4h cooloff after 1h journal expires
Anchor last_close on journal save, ignore leftover stored until when 1h window ended, and clear expired cooloff on trading-day rollover.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-18 22:04:14 +08:00
dekun 9c778e0232 fix(risk): align freeze countdown with latest close not stale 4h until
Pick the shortest active cooloff end and derive 1h/4h label from remaining time.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-18 20:27:13 +08:00
dekun ff8caf7f8d fix(risk): correct freeze countdown timezone (Asia/Shanghai)
Treat naive app datetimes as local time, normalize legacy UTC-ms rows, and resolve cooloff end from stored until or last_close+duration.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-18 18:00:40 +08:00
dekun f8e760961e fix(risk): reset badge to normal when freeze countdown expires
Also expand account-risk-cooldown docs with countdown format, API fields, and frontend assets.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-18 17:47:47 +08:00
dekun 97370926d6 feat(risk): show live countdown on freeze status badges
Expose freeze_until_ms from risk API and tick hub/instance badges with remaining 1h/4h/daily time.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-18 17:41:04 +08:00
dekun 0280b4f065 fix(risk): shorten cooloff on review save and when count was reset
Allow 1h reduction for any active 4h-tier cooloff, hook trade record review updates, and fix freeze label thresholds.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-18 16:35:51 +08:00
dekun f0a158686e fix(risk): allow journal to reduce 4h cooloff to 1h without pending trade id
Hub closes and late journal saves now shorten active manual cooloffs when exit trigger and note are filled in.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-18 16:27:21 +08:00
dekun e470c5952f feat(hub): add macro calendar for pre-release risk alerts
Manual FOMC/CPI/employment entries in settings drive ±1h monitor banners without touching exchange instances.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-18 11:52:30 +08:00
dekun b6acbf4b2c fix(risk): trigger cooldown only on user-initiated closes
Remove external-close risk hooks; register user_instance, user_hub, and user_trend_stop via hub API and trend stop; update docs and tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 19:14:05 +08:00
dekun e307eef690 feat(risk): add account cooldown and daily freeze after manual/external close
Implements shared account_risk_lib with 4h/1h cooloff and daily freeze rules, wires hooks into all four exchange apps and hub monitor UI, with tests and docs.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 17:05:19 +08:00
dekun 58e940629a fix(order): hide estimated RR preview in fixed RR SLTP mode
Only price and percentage modes show estimated profit-loss ratio before open; fixed RR mode keeps the existing estimated take-profit display.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-16 16:26:18 +08:00
dekun f9257b64e4 feat(order): show estimated RR before open across four exchanges
Add shared manual_order_rr_preview.js to fetch order_defaults after symbol and TP/SL inputs complete, display estimated profit-loss ratio before submit in price and percentage modes (and fixed RR), unified for risk and full-margin sizing.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-16 16:19:32 +08:00
dekun edf4bb835d feat(key-monitor): add program trigger entry across four exchanges
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-14 00:42:21 +08:00
dekun 7b0b8996fe feat(hub): add period date range and trade stats to inner-light-mind
Support today/week/month/custom range selection with sick count, PnL, and per-exchange breakdown; update docs.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-11 18:09:39 +08:00
dekun 24a86a710c feat: add per-account daily open hard limit across all exchanges
Enforce optional DAILY_OPEN_HARD_LIMIT in precheck_risk and can_trade, keep AI alerts at DAILY_OPEN_ALERT_THRESHOLD, and document env setup for all four instances.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-09 15:46:18 +08:00
dekun 5ceacd8077 fix(hub): load full pre-entry history for archive chart pan/zoom
range=history serves archive seed through close (not now). Default view focuses hold period; user can scroll/zoom left to see global morphology before entry.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-07 23:20:37 +08:00
dekun 3052607280 fix(hub): merge strategy snapshots into archive for gate_bot
Include strategy_trade_snapshots when trade_records is empty, harden SQL for older schemas, and show per-exchange sync errors in the archive UI.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-07 23:02:46 +08:00
dekun 6a56928d59 feat(hub): add symbol archive with permanent 5m klines
Add /archive page, hub_symbol_archive.db, trade overlay, 4h background sync, and instance /api/hub/trades/archive. Document in hub-symbol-archive-kline.md with cross-links.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-07 22:51:48 +08:00
dekun 32b66fc343 docs(trend): add hub close and trade records review guide
Document manual hub close flow, trade_records vs strategy snapshots, DCA display rules, backfill script, and deployment checklist.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-07 20:39:46 +08:00
dekun 67cc084347 fix(gate): align fund transfer between gate and gate_bot
- Extract shared gate_transfer_lib and global transfer form on all pages

- Block auto-transfer when trend pullback plans have open positions

- Redirect manual transfer back to the current page after submit

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-07 10:01:32 +08:00
dekun 1282293e91 docs: unify Ubuntu root /opt PM2 deployment and refresh README
Add docs/ubuntu-server.md; remove Windows and alternate process managers from deployment guides; index strategy, key monitor, TP/SL, breakeven, and replay docs in root README.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-04 11:48:54 +08:00
dekun 1a6b5f55a1 fix: regenerate clean app icons with Pillow (fix corrupted favicon)
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-04 10:22:08 +08:00
dekun e03cce20d6 feat: add brand icons for Chrome shortcuts and PWA manifest
Dark cyan-green candlestick icon for hub and four exchanges; generate/sync scripts and docs/shortcut-icon.md.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-04 10:17:22 +08:00
dekun 02bc3c14bc docs: document four-exchange env sync script usage
Add docs/env-sync-scripts.md; cross-link from deploy README, feature docs, README, and script headers.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-04 10:02:08 +08:00
dekun 5e694ff795 docs: reference unified env sync script in position-sizing guide
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-04 09:59:53 +08:00
dekun e6e79215fc chore: add unified four-exchange env sync scripts
sync_four_exchange_env runs position sizing + transfer sync; transfer script preserves existing values and supports --set-amount/--enable-auto-transfer.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-04 09:59:33 +08:00
dekun 29b0634c6d feat: bidirectional daily auto-transfer with position skip
Rebalance swap to AUTO_TRANSFER_AMOUNT at Beijing hour: top up from funding or sweep excess back. Skip and WeChat notify when active positions exist.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-04 09:57:25 +08:00
dekun 0456d5fa2c chore: add script to sync position sizing env across four exchanges
sync_four_exchange_position_sizing_env.py appends missing POSITION_SIZING_MODE and FULL_MARGIN_BUFFER_RATIO, optional --set-mode/--set-buffer; docs updated.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-04 08:30:44 +08:00
dekun f7bac11694 feat: add full-margin position sizing mode across four exchanges
Env POSITION_SIZING_MODE switches risk vs full-margin (available*buffer, BTC/ETH 10x). Blocks trend/roll/key auto opens in full margin, purges breakout/fib monitors with WeChat notice, keeps RR check and initial SL snapshot for records.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-04 08:24:35 +08:00