Initial commit: BTC 1h prediction model (53.10% accuracy)
🎯 项目成果: - 准确率: 53.10% (2026年测试集) - 任务类型: 二分类 (预测涨/跌) - 特征: OHLCV + RSI + MACD (9个特征) - 训练数据: 2020-2025年BTC小时数据 (52,351序列) - 测试数据: 2026年1-29日 (484序列) 📊 性能指标: - 精确率: 51.79% - 召回率: 49.36% - F1分数: 0.5054 - 预测分布: 非常平衡 (偏差仅-11个) 🔬 实验历史: - 尝试了5种方案 (回归/分类, 不同数据划分) - 分类任务优于回归任务 (53.10% vs 49.5%) - 全量训练避免了过拟合问题 📦 主要模型文件: - models/checkpoints/dlinear_classification_2026/ - best_model.pt (最佳模型) - preprocessor.pkl (预处理器) - test_2026_results.json (测试结果) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
commit
9bbdc8d42b
82 files changed
+8742
No files matched your search
@@ -0,0 +1,65 @@
|
||||
"""测试Binance API连接(使用SOCKS5代理)"""
|
||||
|
||||
import sys
|
||||
import os
|
||||
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
from data.fetcher import BinanceDataFetcher
|
||||
|
||||
def main():
|
||||
print("="*80)
|
||||
print("测试Binance API连接 - SOCKS5代理")
|
||||
print("="*80)
|
||||
|
||||
# 测试连接
|
||||
fetcher = BinanceDataFetcher()
|
||||
|
||||
if fetcher.client is None:
|
||||
print("\n❌ API连接失败,将使用缓存数据")
|
||||
return
|
||||
|
||||
print("\n✓ API连接成功!")
|
||||
|
||||
# 获取当前价格
|
||||
try:
|
||||
btc_price = fetcher.get_latest_price('BTC')
|
||||
eth_price = fetcher.get_latest_price('ETH')
|
||||
sol_price = fetcher.get_latest_price('SOL')
|
||||
|
||||
print(f"\n当前价格:")
|
||||
print(f" BTC: ${btc_price:,.2f}")
|
||||
print(f" ETH: ${eth_price:,.2f}")
|
||||
print(f" SOL: ${sol_price:,.2f}")
|
||||
except Exception as e:
|
||||
print(f"\n❌ 获取价格失败: {e}")
|
||||
return
|
||||
|
||||
# 获取历史数据(1天测试)
|
||||
try:
|
||||
print("\n正在获取BTC 1小时数据(最近1天)...")
|
||||
from datetime import datetime, timedelta
|
||||
end_date = datetime.now()
|
||||
start_date = end_date - timedelta(days=1)
|
||||
|
||||
df = fetcher.fetch_ohlcv(
|
||||
'BTC',
|
||||
'1h',
|
||||
start_date=start_date.strftime('%Y-%m-%d'),
|
||||
end_date=end_date.strftime('%Y-%m-%d'),
|
||||
use_cache=False # 强制从API获取
|
||||
)
|
||||
|
||||
print(f"✓ 成功获取 {len(df)} 行数据")
|
||||
print(f"\n最新数据:")
|
||||
print(df.tail())
|
||||
|
||||
except Exception as e:
|
||||
print(f"\n❌ 获取历史数据失败: {e}")
|
||||
return
|
||||
|
||||
print("\n" + "="*80)
|
||||
print("✓ Binance API测试通过!代理工作正常")
|
||||
print("="*80)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in new issue
Block a user