构建期货数据采集与三层打分系统
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
23
tushare/main.py
Normal file
23
tushare/main.py
Normal file
@@ -0,0 +1,23 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
import tushare as ts
|
||||
|
||||
|
||||
def main() -> int:
|
||||
token = os.environ.get("TUSHARE_TOKEN")
|
||||
if not token:
|
||||
print("[ERROR] 未设置 TUSHARE_TOKEN 环境变量", file=sys.stderr)
|
||||
return 1
|
||||
|
||||
ts.set_token(token)
|
||||
pro = ts.pro_api()
|
||||
|
||||
df = pro.trade_cal(exchange="SHFE", start_date="20260101", end_date="20260110")
|
||||
print(f"[OK] tushare 连通,返回 {len(df)} 行交易日历样本")
|
||||
print(df.head())
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
Reference in New Issue
Block a user