File size: 4,629 Bytes
da0ce7b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#!/usr/bin/env python3
"""Debug ticker and opportunity issue"""
from aureon_baton_link import link_system as _baton_link; _baton_link(__name__)
import os
import sys
import json
sys.path.insert(0, '/workspaces/aureon-trading')

print("=" * 70)
print("πŸ” COMPREHENSIVE TICKER & OPPORTUNITY DEBUG")
print("=" * 70)

# 1. Check environment
print("\nβœ… STEP 1: Environment Setup")
os.environ['LIVE'] = '1'
print(f"   LIVE = {os.environ.get('LIVE')}")
print(f"   DRY_RUN = {os.environ.get('DRY_RUN', 'NOT SET')}")

# 2. Check imports
print("\nβœ… STEP 2: Loading Core Modules")
try:
    from unified_exchange_client import MultiExchangeClient
    print("   βœ… unified_exchange_client")
except Exception as e:
    print(f"   ❌ {e}")
    sys.exit(1)

# 3. Initialize client
print("\nβœ… STEP 3: Initialize MultiExchangeClient")
try:
    multi = MultiExchangeClient(dry_run=False)
    print(f"   βœ… Clients: {list(multi.clients.keys())}")
except Exception as e:
    print(f"   ❌ {e}")
    sys.exit(1)

# 4. Get tickers
print("\nβœ… STEP 4: Fetch Tickers")
try:
    tickers = multi.get_24h_tickers()
    print(f"   βœ… Got {len(tickers)} tickers")
    if tickers:
        print(f"\n   Sample tickers:")
        for t in tickers[:10]:
            sym = t.get('symbol', 'N/A')
            price = t.get('lastPrice', 0)
            change = t.get('priceChangePercent', 0)
            volume = t.get('quoteVolume', 0)
            print(f"      {sym:12s} ${price:10.6f} {change:+6.2f}% Vol: {volume:12.0f}")
    else:
        print("   ❌ NO TICKERS RETURNED!")
except Exception as e:
    print(f"   ❌ Error: {e}")
    import traceback
    traceback.print_exc()
    sys.exit(1)

# 5. Try to run AureonKrakenEcosystem briefly
print("\nβœ… STEP 5: Initialize AureonKrakenEcosystem")
try:
    from aureon_unified_ecosystem import AureonKrakenEcosystem, CONFIG
    
    eco = AureonKrakenEcosystem(initial_balance=74.83, dry_run=False)
    print(f"   βœ… Ecosystem initialized")
    print(f"   Cash balance: ${eco.cash_balance_gbp:.2f}")
    print(f"   MIN_TRADE_USD: ${CONFIG['MIN_TRADE_USD']}")
    print(f"   MIN_SCORE: {CONFIG['MIN_SCORE']}")
    print(f"   ENTRY_COHERENCE: {CONFIG['ENTRY_COHERENCE']}")
    
    # Refresh tickers
    print("\nβœ… STEP 6: Refresh Tickers in Ecosystem")
    count = eco.refresh_tickers()
    print(f"   βœ… Loaded {count} tickers into ecosystem cache")
    
    # Find opportunities
    print("\nβœ… STEP 7: Find Opportunities")
    opps = eco.find_opportunities()
    print(f"   βœ… Found {len(opps)} opportunities")
    
    if opps:
        print(f"\n   Top 5 opportunities:")
        for opp in opps[:5]:
            sym = opp['symbol']
            score = opp['score']
            coh = opp['coherence']
            change = opp['change24h']
            print(f"      {sym:12s} Score: {score:6.1f} Ξ“: {coh:.2f} {change:+6.2f}%")
    else:
        print("   ⚠️ NO OPPORTUNITIES FOUND")
        print("\n   Checking why...")
        if not eco.ticker_cache:
            print("   β†’ ticker_cache is EMPTY")
        else:
            print(f"   β†’ ticker_cache has {len(eco.ticker_cache)} symbols")
            # Check first symbol for filtering
            first_sym = list(eco.ticker_cache.keys())[0]
            data = eco.ticker_cache[first_sym]
            print(f"\n   Example ticker: {first_sym}")
            print(f"      price: {data.get('price')}")
            print(f"      change24h: {data.get('change24h')}")
            print(f"      volume: {data.get('volume')}")
            print(f"      source: {data.get('source')}")
            
            # Check why it was filtered
            change = data['change24h']
            price = data['price']
            volume = data['volume']
            print(f"\n   Filtering checks for {first_sym}:")
            print(f"      MIN_MOMENTUM ({CONFIG['MIN_MOMENTUM']}): {change:.2f} >= {CONFIG['MIN_MOMENTUM']} ? {change >= CONFIG['MIN_MOMENTUM']}")
            print(f"      MAX_MOMENTUM ({CONFIG['MAX_MOMENTUM']}): {change:.2f} <= {CONFIG['MAX_MOMENTUM']} ? {change <= CONFIG['MAX_MOMENTUM']}")
            print(f"      MIN_VOLUME ({CONFIG['MIN_VOLUME']}): {volume:.0f} >= {CONFIG['MIN_VOLUME']} ? {volume >= CONFIG['MIN_VOLUME']}")
            print(f"      price check: {price:.6f} >= 0.0001 ? {price >= 0.0001}")
    
except Exception as e:
    print(f"   ❌ Error: {e}")
    import traceback
    traceback.print_exc()
    sys.exit(1)

print("\n" + "=" * 70)
print("βœ… DEBUG COMPLETE")
print("=" * 70)