Skip to main content

Crypto Trading App

Published: November 22, 20253 min read
#Crypto#trading#agent

Progress Report - November 22, 2025

Project: Trader-7 (LLM-Powered Trading System)

Completed

  • Sprint 3 Complete: Database & Position Sizing Enhancements

    • Confidence-based position sizing integrated into main.py
    • Tiered multipliers: 82-85% (1.0x), 85-90% (1.2x), 90%+ (1.5x)
    • New environment variable: CONFIDENCE_SIZING_ENABLED (default: false)
    • Invalidation analytics added to dashboard (rate, trends, comparison)
  • Fixed Critical Health Checker Bug

    • System was showing DEGRADED status even when all services healthy
    • Root cause: health_checker.py called is_available() but strategists implement health_check()
    • Fix: Changed method call from is_available() to health_check()
    • System now correctly reports HEALTHY when critical services operational
  • Migrated Qwen from DashScope to Together AI

    • Alibaba Cloud KYC validation was blocking Qwen backup strategist
    • Switched to Together AI ($25 free credits, no KYC required)
    • Initial 72B model required dedicated endpoint (paid)
    • Final: Using Qwen/Qwen2.5-7B-Instruct-Turbo (serverless/free tier)
    • Qwen now working as backup when DeepSeek says NO_TRADE
  • Fixed Hindsight Validator KeyError

    • Dashboard analytics page crashing with KeyError: 'missed_opportunitys'
    • Root cause: Naive pluralization ("missed_opportunity" + "s" = "missed_opportunitys")
    • Fix: Explicit outcome-to-key mapping instead of string concatenation
  • Updated Dashboard Health Check for Together AI

    • Was checking HF_API_KEY (HuggingFace) - legacy from old implementation
    • Now checks QWEN_API_KEY and tests api.together.xyz/v1/models
    • Dashboard shows "Qwen (Together AI) configured & reachable"
  • Documentation Updates

    • architecture.md: v3.2 → v3.3 (Phase 6.9, position sizing table)
    • product-description.md: v2.4 → v2.5 (Sprint 3 features)

Issues & Learnings

Issue: Health Checker Method Name Mismatch

  • Root Cause: health_checker.py assumed strategists have is_available() method, but they implement health_check() per base class contract
  • Fix: Single line change - is_available()health_check()
  • Prevention: Method names should match interface contracts; add integration test for health checker
  • Time Impact: 15 minutes to diagnose and fix

Issue: Together AI Model Availability

  • Root Cause: 72B parameter models require dedicated (paid) endpoints on Together AI
  • Fix: Use 7B-Instruct-Turbo model which is available on serverless (free) tier
  • Prevention: Check model availability tier before integration; smaller models often sufficient for backup role
  • Time Impact: 10 minutes (quick iteration)

Issue: Naive Pluralization Logic

  • Root Cause: Code assumed adding 's' works for all words (outcome + 's')
  • Fix: Use explicit dictionary mapping for known outcomes
  • Prevention: Avoid clever string manipulation for fixed vocabularies; explicit > implicit
  • Time Impact: 10 minutes

Impact Summary

Sprint 3 is complete, adding dynamic position sizing based on confidence scores and invalidation analytics to the dashboard. Fixed three bugs affecting system health reporting, Qwen backup functionality, and analytics display. The trading system now has a working 3-tier strategist failover: DeepSeek (primary) → Qwen/Together AI (backup) → Rules-only (fallback).

Next Steps

  • Monitor Qwen backup performance in production
  • Enable confidence-based sizing after sufficient trade data collected
  • Sprint 4: Testing protocol for confidence-based sizing

Generated from session work on 2025-11-22 at 23:49 UTC

Share this post