67 lines
1.9 KiB
Python
67 lines
1.9 KiB
Python
#!/usr/bin/env python
|
|
# -*- coding: utf-8 -*-
|
|
|
|
"""
|
|
Multi-Timeframe Strategy Test (中英文混合测试)
|
|
"""
|
|
|
|
import sys
|
|
import os
|
|
|
|
# Fix encoding issues
|
|
os.environ['PYTHONIOENCODING'] = 'utf-8'
|
|
|
|
# Add current directory to path
|
|
current_dir = os.path.dirname(os.path.abspath(__file__))
|
|
sys.path.insert(0, current_dir)
|
|
|
|
print(f"Current Directory: {current_dir}")
|
|
print(f"Python Environment: xtquant conda")
|
|
|
|
# Test multi-timeframe strategy
|
|
print("\n=== Multi-Timeframe Strategy Test ===")
|
|
|
|
try:
|
|
import multi_timeframe_ma_score_strategy
|
|
print("Success: multi_timeframe_ma_score_strategy imported")
|
|
|
|
# Create strategy instance
|
|
strategy = multi_timeframe_ma_score_strategy.MultiTimeframeMAScoreStrategy()
|
|
print(f"Strategy Name: {strategy.name}")
|
|
print(f"Strategy Description: {strategy.description}")
|
|
print(f"Short MA Period: {strategy.short_ma}")
|
|
print(f"Long MA Period: {strategy.long_ma}")
|
|
print(f"Timeframes: {strategy.timeframes}")
|
|
|
|
# Test initialization
|
|
if strategy.initialize():
|
|
print("Success: Strategy initialized successfully")
|
|
else:
|
|
print("Error: Strategy initialization failed")
|
|
|
|
except Exception as e:
|
|
print(f"Error: multi_timeframe_ma_score_strategy import failed: {e}")
|
|
import traceback
|
|
traceback.print_exc()
|
|
|
|
# Test simple multi-timeframe test
|
|
print("\n=== Simple Multi-Timeframe Test ===")
|
|
|
|
try:
|
|
import test_multi_timeframe_simple
|
|
print("Success: test_multi_timeframe_simple imported")
|
|
except Exception as e:
|
|
print(f"Error: test_multi_timeframe_simple import failed: {e}")
|
|
|
|
# Test backtest runner
|
|
print("\n=== Backtest Runner Test ===")
|
|
|
|
try:
|
|
import run_multi_timeframe_score_backtest
|
|
print("Success: run_multi_timeframe_score_backtest imported")
|
|
except Exception as e:
|
|
print(f"Error: run_multi_timeframe_score_backtest import failed: {e}")
|
|
|
|
print("\n=== All Tests Completed ===")
|
|
print("Note: Using English output to avoid encoding issues in conda environment")
|