删除根目录旧 Chan 模块、策略、配置、文档及 wyckoff 相关代码;更新缠论 pipeline 与笔中枢计算;补充 research 研究与 web 测试。 Co-authored-by: Cursor <cursoragent@cursor.com>
33 lines
1007 B
Python
33 lines
1007 B
Python
from __future__ import annotations
|
|
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
WEB_ROOT = Path(__file__).resolve().parents[1]
|
|
if str(WEB_ROOT) not in sys.path:
|
|
sys.path.insert(0, str(WEB_ROOT))
|
|
|
|
from cn_stock_data import ChinaStockData
|
|
|
|
|
|
@pytest.mark.network
|
|
def test_cn_stock_data_fetch():
|
|
"""简单的联通性测试,确认能否通过 akshare 拉取A股K线数据。"""
|
|
data_client = ChinaStockData()
|
|
|
|
try:
|
|
df = data_client.get_kl_data(symbol="600519", timeframe="1d", limit=20)
|
|
except Exception as exc: # pragma: no cover - 旨在提示网络/依赖问题
|
|
pytest.skip(f"无法调用数据接口,可能是网络或依赖问题:{exc}")
|
|
|
|
if df is None or df.empty:
|
|
pytest.skip("未获取到任何数据,可能是网络异常或接口限制。")
|
|
|
|
expected_cols = {"date", "open", "high", "low", "close", "volume"}
|
|
missing_cols = expected_cols - set(df.columns)
|
|
assert not missing_cols, f"返回数据缺少列: {missing_cols}"
|
|
|
|
|