Restructured hedger modules: moved CLP hedger and auto hedger into separate folders, updated data fetchers and main app, removed deprecated files
This commit is contained in:
67
clp_auto_hedger/test_full_logging.py
Normal file
67
clp_auto_hedger/test_full_logging.py
Normal file
@ -0,0 +1,67 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Test just the ScalperHedger class instantiation and logging
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
from unittest.mock import patch, MagicMock
|
||||
|
||||
# Add current directory to Python path
|
||||
current_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
sys.path.append(current_dir)
|
||||
|
||||
# Mock environment variables to avoid errors
|
||||
os.environ['SCALPER_AGENT_PK'] = '0x' + '0' * 64 # Mock private key
|
||||
os.environ['MAIN_WALLET_ADDRESS'] = '0x' + '0' * 40 # Mock address
|
||||
|
||||
try:
|
||||
# Mock the Hyperliquid imports to avoid API calls
|
||||
with patch.dict('sys.modules', {
|
||||
'hyperliquid.exchange': MagicMock(),
|
||||
'hyperliquid.info': MagicMock(),
|
||||
'hyperliquid.utils': MagicMock(),
|
||||
'eth_account': MagicMock(),
|
||||
'dotenv': MagicMock()
|
||||
}):
|
||||
|
||||
# Set up logging first
|
||||
from logging_utils import setup_logging
|
||||
logger = setup_logging("normal", "SCALPER_HEDGER")
|
||||
|
||||
# Update root logger
|
||||
import logging
|
||||
root_logger = logging.getLogger()
|
||||
root_logger.handlers.clear()
|
||||
root_logger.handlers = logger.handlers
|
||||
root_logger.setLevel(logger.level)
|
||||
|
||||
print("Logging setup completed. Creating ScalperHedger...")
|
||||
|
||||
# Now import and create the class (this should trigger logging)
|
||||
from clp_scalper_hedger import ScalperHedger
|
||||
|
||||
# This should trigger initialization logging messages
|
||||
hedger = ScalperHedger()
|
||||
|
||||
print("ScalperHedger created. Check log file for messages...")
|
||||
|
||||
# Check log file content
|
||||
logs_dir = os.path.join(os.getcwd(), "logs")
|
||||
log_files = [f for f in os.listdir(logs_dir) if f.startswith("SCALPER_HEDGER_")]
|
||||
|
||||
if log_files:
|
||||
latest_log = sorted(log_files)[-1]
|
||||
log_file_path = os.path.join(logs_dir, latest_log)
|
||||
|
||||
with open(log_file_path, 'r') as f:
|
||||
content = f.read()
|
||||
print(f"\n=== LOG FILE CONTENT ({latest_log}) ===")
|
||||
print(content)
|
||||
else:
|
||||
print("❌ No log files found")
|
||||
|
||||
except Exception as e:
|
||||
print(f"❌ Error: {e}")
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
Reference in New Issue
Block a user