Spaces:
Sleeping
Sleeping
| #!/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) | |