Commit Graph

3 Commits

Author SHA1 Message Date
b6bd45b151 Fix SELL P&L calculation, add debug logging, and multiple improvements
- Fix realized_pnl always being 0 on SELL (use amount*price instead of amount_usdt)
- Add debug logging for all-HOLD LLM cycles (log sample HOLD reasons)
- Fix nonce collision in Bitfinex API auth (add counter)
- Fix timezone to UTC+8 in main, trade_logger, sync_cost_basis, check_errors
- Fix stop-loss retry with longer delay after cancel
- Add min order amount check in trader before BUY
- Fix risk_manager to skip positions with amount <= 0
- Cap trade_history to 500 entries to prevent unbounded growth
- Fix greedy regex in LLM response parser
- Reset cost_tracking start dates to null

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 06:23:54 +00:00
36225df832 Add Claude auto-fix to check_errors.py, distinguish LLM failure in Slack reports
- check_errors.py: on errors, call Claude CLI to diagnose and attempt auto-fix,
  include fix report in Slack alert
- slack_notifier.py: show "LLM 分析失敗" when LLM fails instead of "All HOLD"
- main.py: track llm_ok flag and pass to Slack reporter
- setup.sh: restore ~/.local/bin in crontab PATH for claude CLI
- llm_analyzer.py: use shutil.which for robust claude binary lookup

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 03:08:06 +00:00
24c3f033d2 Add check_errors.py cron job for API error monitoring
- New check_errors.py: scans last 1 hour of logs, sends Slack @channel only on errors
- Add to system crontab (every 5 min)
- Update setup.sh to include check_errors.py in crontab setup

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 12:34:52 +00:00