position history with fees
This commit is contained in:
93
test_binance_data.py
Normal file
93
test_binance_data.py
Normal file
@ -0,0 +1,93 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Test script to check Binance data availability
|
||||
"""
|
||||
|
||||
import sys
|
||||
import logging
|
||||
from datetime import datetime
|
||||
|
||||
# Set up logging
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
def test_binance_data():
|
||||
"""Test Binance data fetching"""
|
||||
print("="*60)
|
||||
print("BINANCE DATA TEST")
|
||||
print("="*60)
|
||||
|
||||
try:
|
||||
print("1. Testing DataProvider import...")
|
||||
from core.data_provider import DataProvider
|
||||
print(" ✅ DataProvider imported successfully")
|
||||
|
||||
print("\n2. Creating DataProvider instance...")
|
||||
dp = DataProvider()
|
||||
print(f" ✅ DataProvider created")
|
||||
print(f" Symbols: {dp.symbols}")
|
||||
print(f" Timeframes: {dp.timeframes}")
|
||||
|
||||
print("\n3. Testing historical data fetch...")
|
||||
try:
|
||||
data = dp.get_historical_data('ETH/USDT', '1m', 10)
|
||||
if data is not None:
|
||||
print(f" ✅ Historical data fetched: {data.shape}")
|
||||
print(f" Latest price: ${data['close'].iloc[-1]:.2f}")
|
||||
print(f" Data range: {data.index[0]} to {data.index[-1]}")
|
||||
else:
|
||||
print(" ❌ No historical data returned")
|
||||
except Exception as e:
|
||||
print(f" ❌ Error fetching historical data: {e}")
|
||||
|
||||
print("\n4. Testing current price...")
|
||||
try:
|
||||
price = dp.get_current_price('ETH/USDT')
|
||||
if price:
|
||||
print(f" ✅ Current price: ${price:.2f}")
|
||||
else:
|
||||
print(" ❌ No current price available")
|
||||
except Exception as e:
|
||||
print(f" ❌ Error getting current price: {e}")
|
||||
|
||||
print("\n5. Testing real-time streaming setup...")
|
||||
try:
|
||||
# Check if streaming can be initialized
|
||||
print(f" Streaming status: {dp.is_streaming}")
|
||||
print(" ✅ Real-time streaming setup ready")
|
||||
except Exception as e:
|
||||
print(f" ❌ Real-time streaming error: {e}")
|
||||
|
||||
except Exception as e:
|
||||
print(f"❌ Failed to import or create DataProvider: {e}")
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
|
||||
def test_dashboard_connection():
|
||||
"""Test if dashboard can connect to data"""
|
||||
print("\n" + "="*60)
|
||||
print("DASHBOARD CONNECTION TEST")
|
||||
print("="*60)
|
||||
|
||||
try:
|
||||
print("1. Testing dashboard imports...")
|
||||
from web.scalping_dashboard import ScalpingDashboard
|
||||
print(" ✅ ScalpingDashboard imported")
|
||||
|
||||
print("\n2. Testing data provider connection...")
|
||||
# Check if the dashboard can create a data provider
|
||||
dashboard = ScalpingDashboard()
|
||||
if hasattr(dashboard, 'data_provider'):
|
||||
print(" ✅ Dashboard has data_provider")
|
||||
print(f" Data provider symbols: {dashboard.data_provider.symbols}")
|
||||
else:
|
||||
print(" ❌ Dashboard missing data_provider")
|
||||
|
||||
except Exception as e:
|
||||
print(f"❌ Dashboard connection error: {e}")
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_binance_data()
|
||||
test_dashboard_connection()
|
Reference in New Issue
Block a user