将 TUSHARE_TOKEN 写死到代码中,移除 .env 引用
This commit is contained in:
@@ -1,16 +1,12 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
import tushare as ts
|
||||
|
||||
TUSHARE_TOKEN = "76efd8465f9f2591aa42a385268e06acf6b80b7a15be2267ad2281b7"
|
||||
|
||||
|
||||
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)
|
||||
ts.set_token(TUSHARE_TOKEN)
|
||||
pro = ts.pro_api()
|
||||
|
||||
df = pro.trade_cal(exchange="SHFE", start_date="20260101", end_date="20260110")
|
||||
|
||||
Reference in New Issue
Block a user