115 lines
3.6 KiB
Python
115 lines
3.6 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
NAS临时配置方案
|
|
在等待姜维将军提供实际NAS配置时,使用本地测试路径
|
|
"""
|
|
import os
|
|
import json
|
|
from datetime import datetime
|
|
|
|
print("="*70)
|
|
print("📁 NAS临时配置方案")
|
|
print("="*70)
|
|
|
|
# 创建临时NAS配置
|
|
temp_config = {
|
|
"configuration_type": "temporary_local",
|
|
"created_by": "赵云(数据工程将军)",
|
|
"timestamp": datetime.now().isoformat(),
|
|
"status": "waiting_for_real_nas",
|
|
"temporary_storage": {
|
|
"path": "/Users/chufeng/.openclaw/sanguo_projects/sanguo_quant_live/zhaoyun-data/data/temp_nas_minute",
|
|
"purpose": "分钟数据下载测试和临时存储",
|
|
"capacity": "本地磁盘空间",
|
|
"access_type": "本地文件系统"
|
|
},
|
|
"required_nas_config": {
|
|
"storage_path": "等待姜维将军提供",
|
|
"access_type": "SMB/NFS/FTP/SSH等",
|
|
"network": {
|
|
"ip_address": "待提供",
|
|
"port": "待提供",
|
|
"credentials": "待提供"
|
|
},
|
|
"vpn_config": {
|
|
"enabled": True,
|
|
"config_file": "待提供",
|
|
"credentials": "待提供"
|
|
}
|
|
},
|
|
"minute_data_specs": {
|
|
"total_records": "约2.04亿条",
|
|
"storage_needed": "15.5-19GB",
|
|
"time_period": "2021-2026 (5年)",
|
|
"data_granularity": ["1min", "5min", "15min"],
|
|
"stock_count": "约5,500只A股"
|
|
},
|
|
"deployment_plan": {
|
|
"phase1": "本地测试和验证(立即开始)",
|
|
"phase2": "等待NAS配置(与姜维将军协调)",
|
|
"phase3": "NAS实际部署和数据迁移",
|
|
"phase4": "全量数据下载和质量验证"
|
|
}
|
|
}
|
|
|
|
# 创建临时存储目录
|
|
temp_path = temp_config["temporary_storage"]["path"]
|
|
os.makedirs(temp_path, exist_ok=True)
|
|
os.makedirs(os.path.join(temp_path, "1min"), exist_ok=True)
|
|
os.makedirs(os.path.join(temp_path, "5min"), exist_ok=True)
|
|
os.makedirs(os.path.join(temp_path, "15min"), exist_ok=True)
|
|
os.makedirs(os.path.join(temp_path, "logs"), exist_ok=True)
|
|
os.makedirs(os.path.join(temp_path, "reports"), exist_ok=True)
|
|
|
|
print("✅ 临时存储目录已创建:")
|
|
print(f" 主目录: {temp_path}")
|
|
print(f" 1分钟数据: {temp_path}/1min")
|
|
print(f" 5分钟数据: {temp_path}/5min")
|
|
print(f" 15分钟数据: {temp_path}/15min")
|
|
print(f" 日志目录: {temp_path}/logs")
|
|
print(f" 报告目录: {temp_path}/reports")
|
|
|
|
# 保存临时配置
|
|
config_file = os.path.join(temp_path, "nas_temp_config.json")
|
|
with open(config_file, 'w', encoding='utf-8') as f:
|
|
json.dump(temp_config, f, ensure_ascii=False, indent=2)
|
|
|
|
print(f"\n✅ 临时配置已保存: {config_file}")
|
|
|
|
# 创建分钟数据下载脚本的配置文件
|
|
download_config = {
|
|
"data_source": "akshare",
|
|
"base_dir": temp_path,
|
|
"timeframes": ["1min", "5min", "15min"],
|
|
"date_range": {
|
|
"start": "2021-01-01",
|
|
"end": "2026-03-26"
|
|
},
|
|
"download_settings": {
|
|
"batch_size": 50,
|
|
"max_workers": 10,
|
|
"request_delay": 0.5,
|
|
"retry_count": 3
|
|
},
|
|
"quality_checks": {
|
|
"enabled": True,
|
|
"min_completeness": 0.95,
|
|
"price_logic_check": True,
|
|
"date_continuity_check": True
|
|
}
|
|
}
|
|
|
|
config_file2 = os.path.join(temp_path, "download_config.json")
|
|
with open(config_file2, 'w', encoding='utf-8') as f:
|
|
json.dump(download_config, f, ensure_ascii=False, indent=2)
|
|
|
|
print(f"✅ 下载配置文件已保存: {config_file2}")
|
|
|
|
print("\n" + "="*70)
|
|
print("🚀 临时方案执行计划")
|
|
print("="*70)
|
|
|
|
print("1. ✅ VPN和网络环境验证完成")
|
|
print("2. ✅ AKShare数据源验证完成")
|
|
print("3. ✅ 临时存储目录创建完成")
|
|
print("4. |