File size: 1,746 Bytes
fb03795
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/usr/bin/env python3
"""Test AI decision logic with fallback (simulates HF Space environment)"""

import sys
sys.path.insert(0, '/Users/nicholashughes/huggingsoacecrypto/cryptotrader')

from app import ExponentialLearner

print("="*60)
print("Testing AI Decision Logic (Fallback Mode)")
print("="*60)

# Create AI instance
ai = ExponentialLearner()

# Test market conditions
test_conditions = [
    {
        "name": "Strong Bullish",
        "data": {
            "price": 150.0,
            "change_24h": 5.5,
            "rsi": 65,
            "trend": "UP",
            "volume_trend": "increasing"
        }
    },
    {
        "name": "Strong Bearish",
        "data": {
            "price": 145.0,
            "change_24h": -4.2,
            "rsi": 35,
            "trend": "DOWN",
            "volume_trend": "decreasing"
        }
    },
    {
        "name": "Neutral/Sideways",
        "data": {
            "price": 148.0,
            "change_24h": 0.5,
            "rsi": 50,
            "trend": "NEUTRAL",
            "volume_trend": "neutral"
        }
    }
]

for test in test_conditions:
    print(f"\n{'='*60}")
    print(f"Test Case: {test['name']}")
    print(f"{'='*60}")
    
    decision = ai.get_best_action("SOL/USD", test['data'])
    
    print(f"\n✅ AI Decision:")
    print(f"   Action: {decision['action']}")
    print(f"   Confidence: {decision['confidence']}")
    print(f"   Reason: {decision['reason']}")
    print(f"   Leverage: {decision['leverage']}x")
    print(f"   Size: {decision['size_percent']}%")
    
    print(f"\n📊 Logged Input: {ai.last_api_input}")
    print(f"🤖 Logged Output: {ai.last_api_output}")

print(f"\n{'='*60}")
print("✅ All tests completed successfully!")
print("="*60)