Commit Graph

5 Commits

Author SHA1 Message Date
7f03d479c7 Add 5-tier LLM SELL profit thresholds, allow loss sells, fix PnL sign display
- Replace 3-tier LLM SELL thresholds with 5-tier descending confidence
  (1-2%→0.7, 2-3%→0.6, 3-5%→0.5, ≥5%→0.4), min profit 1%
- Allow LLM SELL on losing positions (trust LLM signal for cut-loss)
- Fix +-1.90% sign bug: use pnl_pct instead of pnl amount for sign

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 13:49:14 +00:00
e2ec3cd920 Raise take-profit to 15% and tighten SELL conditions for longer holds
- TAKE_PROFIT_PCT 5% → 15% (risk/reward 5:1 vs 3% stop-loss)
- SELL signal now requires ≥2 confirmations (was 1)
- Add 1h trend filter: hold if 1h still bullish even if 5m shows sell
- Sync cost_tracking.json and stop_orders.json after balance refresh

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 03:38:42 +00:00
1abfdefecd Add advanced indicators: MTF analysis, ADX, StochRSI, OBV, CMF, pivot points
- config.py: Add HTF_TIMEFRAME (1h) and HTF_CANDLE_LIMIT (50)
- data_fetcher.py: Fetch both 5m and 1h candles per symbol
- indicators.py: Add ADX, StochRSI, OBV+slope, CMF to 5m indicators;
  new functions for HTF indicators, pivot points, and their summaries
- main.py: Wire up HTF data flow (1h indicators + pivots → LLM summary)
- llm_analyzer.py: Rewrite prompt with MTF filter (1h trend alignment),
  require 2+ confirmations for BUY, confidence scoring guide

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 03:26:59 +00:00
ce88afdb96 Add cost basis sync, fix stop-loss reliability, improve reporting
- New sync_cost_basis.py: recalculate entry_price from order history,
  sync amounts/balances from wallet (cron every 30 min)
- Fix stop-loss ID staleness: update stop_orders_by_sym in step 2b
  after placing new stops, preventing SELL failures from stale IDs
- Fix position limit inconsistency: use same total_balance in
  validate_trade instead of calling check_position_limit
- Skip stop-loss for positions below MIN_ORDER_AMOUNT
- Add API response body logging for 500 errors
- Cancel "Order not found" treated as success (not error)
- Post-trade wallet refresh to ensure fresh balances
- Report: show total value, total return %, exclude dust positions
- Crontab offset +1 min from candle close for complete data
- Handle PARTIALLY FILLED order status in cost calculation
- Sort orders by mts_create in Python (Bitfinex sort unreliable)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 11:18:49 +00:00
972d66ab1b Initial commit: LLM-driven crypto trading bot
Includes: Bitfinex API integration, technical indicators,
LLM signal generation, risk management, Slack notifications.

Recent fixes:
- SELL orders use position value instead of total balance
- SELL signals always close full position
- Failed orders added to rejected list for Slack reporting
- Position/exposure limits auto-cap to remaining room
- BUY order minimum raised to 10% of portfolio

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 03:25:18 +00:00