新增期货数据动态播放器功能,包括基础版和增强版实现,添加测试脚本和详细文档说明。主要变更包括: 1. 实现买卖盘深度可视化播放功能 2. 添加播放控制、速度调节和跳转功能 3. 提供统一价格轴显示优化版本 4. 添加测试脚本验证功能 5. 编写详细使用文档和README说明
60 lines
1.6 KiB
Python
60 lines
1.6 KiB
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
"""
|
|
Simple test script for futures data player
|
|
"""
|
|
|
|
def main():
|
|
print("=== Futures Data Player Test ===")
|
|
|
|
# Test 1: Check data file
|
|
import os
|
|
data_path = 'data/au2512_20251013.parquet'
|
|
if os.path.exists(data_path):
|
|
print(f"+ Data file exists: {data_path}")
|
|
|
|
try:
|
|
import pandas as pd
|
|
df = pd.read_parquet(data_path)
|
|
print(f"+ Data loaded: {len(df)} rows")
|
|
except Exception as e:
|
|
print(f"- Data loading failed: {e}")
|
|
return
|
|
else:
|
|
print(f"- Data file not found: {data_path}")
|
|
return
|
|
|
|
# Test 2: Check imports
|
|
try:
|
|
import pandas as pd
|
|
import numpy as np
|
|
import matplotlib.pyplot as plt
|
|
import tkinter as tk
|
|
print("+ All required libraries imported successfully")
|
|
except ImportError as e:
|
|
print(f"- Import failed: {e}")
|
|
return
|
|
|
|
# Test 3: Create player instance
|
|
try:
|
|
from futures_player_enhanced import EnhancedFuturesPlayer
|
|
print("+ Creating player instance...")
|
|
player = EnhancedFuturesPlayer()
|
|
|
|
if player.df is not None:
|
|
print(f"+ Player created with {len(player.df)} data points")
|
|
print("+ Test passed! Ready to run the full application.")
|
|
|
|
# Clean up
|
|
player.on_closing()
|
|
else:
|
|
print("- Player creation failed")
|
|
|
|
except Exception as e:
|
|
print(f"- Player test failed: {e}")
|
|
|
|
print("\\nTo run the full application:")
|
|
print("python futures_player_enhanced.py")
|
|
|
|
if __name__ == "__main__":
|
|
main() |