File size: 3,173 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
import os
import sys
import time
from dotenv import load_dotenv

# Load env before imports
load_dotenv("/workspaces/aureon-trading/.env")

from binance_client import BinanceClient
from kraken_client import KrakenClient, get_kraken_client

def debug_check():
    print("=== DEBUG START ===")
    
    # KRAKEN
    print("\n\n--- KRAKEN ---")
    try:
        # Check env vars expected by Client
        k_key = os.getenv("KRAKEN_API_KEY")
        k_secret = os.getenv("KRAKEN_API_SECRET")
        print(f"   Env KRAKEN_API_KEY present: {bool(k_key)}")
        print(f"   Env KRAKEN_API_SECRET present: {bool(k_secret)}")
        
        # Instantiate with NO ARGS
        kraken = get_kraken_client()
        
        # 1. Check Account
        print("1. Testing account()...")
        try:
            acct = kraken.account()
            print(f"βœ… account() result keys: {list(acct.keys())}")
            if 'balances' in acct:
                print(f"   Balances count: {len(acct['balances'])}")
                print(f"   Example Bal: {acct['balances'][0] if acct['balances'] else 'None'}")
            else:
                print(f"   Full Result: {acct}")
        except Exception as e:
            print(f"❌ account() failed: {e}")

        # 2. Check get_account_balance()
        print("2. Testing get_account_balance()...")
        bal = kraken.get_account_balance()
        print(f"   Balance Map count: {len(bal)}")
        print(f"   Sample: {list(bal.items())[:5] if bal else 'None'}")
        
        # 3. Check Ledgers
        print("3. Testing get_ledgers()...")
        try:
            ledgers = kraken.get_ledgers()
            print(f"   Result type: {type(ledgers)}")
            if ledgers:
                print(f"   Count: {len(ledgers)}")
                first_k = next(iter(ledgers))
                print(f"   Sample ({first_k}): {ledgers[first_k]}")
            else:
                print("   (No ledgers returned)")
        except Exception as e:
            print(f"❌ get_ledgers() failed: {e}")

    except Exception as e:
        print(f"❌ KRAKEN INIT FAILED: {e}")

    # BINANCE
    print("\n\n--- BINANCE ---")
    try:
        b_key = os.getenv("BINANCE_API_KEY")
        b_secret = os.getenv("BINANCE_API_SECRET")
        print(f"   Env BINANCE_API_KEY present: {bool(b_key)}")

        # Instantiate with NO ARGS
        binance = get_binance_client()
        
        # Test ZROUSDT
        print("1. Testing get_all_orders('ZROUSDT', limit=1000)...")
        orders = binance.get_all_orders("ZROUSDT", limit=1000)
        print(f"   Result count: {len(orders)}")
        if orders:
            # Check for buys
            buys = [o for o in orders if o['side'] == 'BUY' and o['status'] == 'FILLED']
            print(f"   Filled BUYs: {len(buys)}")
            if buys:
                print(f"   Sample BUY: {buys[0]}")
        else:
            print("   (No orders returned)")

    except Exception as e:
        print(f"❌ BINANCE FAILED: {e}")

    print("\n=== DEBUG END ===")

if __name__ == "__main__":
    debug_check()