Archive legacy framework and utility modules that are no longer referenced by the active core (datasource/ and rotation/): - framework/ -> archive/framework/ - framework_v2/ -> archive/framework_v2/ - strategies/ -> archive/strategies/ - config/ -> archive/config/ - visualization/ -> archive/visualization/ - scripts/ -> archive/scripts/ - tests/ -> archive/tests/ - run_rotation.py, run_us_rotation.py -> archive/single_files/ - compare_*.py, test_api_dates.py -> archive/single_files/
26 lines
767 B
Python
26 lines
767 B
Python
"""测试 Flask API 日期参数"""
|
|
import os
|
|
from datasource.flask_api_source import FlaskAPIDataSource
|
|
|
|
# 设置环境变量
|
|
os.environ['FLASK_API_URL'] = 'https://k3s.tokenpluse.xyz'
|
|
|
|
api = FlaskAPIDataSource()
|
|
|
|
# 测试获取 2020-2024 年的数据
|
|
print("测试 1: 获取 2020-2024 年数据")
|
|
df = api.fetch("399006.SZ", "2020-01-01", "2024-12-31")
|
|
if df is not None:
|
|
print(f" 数据量: {len(df)}")
|
|
print(f" 日期范围: {df.index[0]} ~ {df.index[-1]}")
|
|
else:
|
|
print(" 获取失败")
|
|
|
|
print("\n测试 2: 获取 2023-2024 年数据")
|
|
df2 = api.fetch("399006.SZ", "2023-01-01", "2024-12-31")
|
|
if df2 is not None:
|
|
print(f" 数据量: {len(df2)}")
|
|
print(f" 日期范围: {df2.index[0]} ~ {df2.index[-1]}")
|
|
else:
|
|
print(" 获取失败")
|