feat(data): 15min数据补全—路径参数化+cron入口+回填+设计文档
- download_minute.py: STOCK_ROOT环境变量参数化(Mac/NAS兼容); 修tencent备源amount聚合 last→sum - refresh_15min_daily.py: 新建cron入口(交易日判断baostock/直连pop代理/日志) - 回填470缺口(170 SH/SZ成功, 300 BSE源不支持) - docs/data/15min-data-design.md: 15min数据层设计文档(源/覆盖/脚本/刷新/约束/路径映射)
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import time
|
||||
@@ -42,14 +43,16 @@ logging.basicConfig(
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# --- 配置 ---
|
||||
OUTPUT_DIR = Path("/Volumes/stock/minute_kline/15min")
|
||||
# STOCK_ROOT 可通过环境变量覆盖;默认 Mac 挂载点,NAS 用 STOCK_ROOT=/volume1/stock
|
||||
STOCK_ROOT = Path(os.environ.get("STOCK_ROOT", "/Volumes/stock"))
|
||||
OUTPUT_DIR = STOCK_ROOT / "minute_kline" / "15min"
|
||||
PROGRESS_FILE = OUTPUT_DIR / "download_progress.json"
|
||||
REQUEST_INTERVAL = 0.3
|
||||
MAX_RETRIES = 3
|
||||
CONSECUTIVE_FAIL_PAUSE = 60
|
||||
MAX_CONSECUTIVE_FAILS = 5
|
||||
HS300_FILE = Path("/Volumes/stock/A股数据/stock_info/hs300_constituents_latest.csv")
|
||||
ALL_STOCKS_FILE = Path("/Volumes/stock/A股数据/stock_info/stock_basic_info_raw_20260326_113530.csv")
|
||||
HS300_FILE = STOCK_ROOT / "A股数据" / "stock_info" / "hs300_constituents_latest.csv"
|
||||
ALL_STOCKS_FILE = STOCK_ROOT / "A股数据" / "stock_info" / "stock_basic_info_raw_20260326_113530.csv"
|
||||
|
||||
HEADERS = {"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)"}
|
||||
|
||||
@@ -141,7 +144,7 @@ def _aggregate_1m_to_15m(df: pd.DataFrame) -> pd.DataFrame:
|
||||
low=("price", "min"),
|
||||
close=("price", "last"),
|
||||
volume=("vol", "sum"),
|
||||
amount=("amount", "last"),
|
||||
amount=("amount", "sum"),
|
||||
).reset_index()
|
||||
|
||||
return pd.DataFrame({
|
||||
|
||||
Reference in New Issue
Block a user