Initial commit: stock analysis backend and prototype UI.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
33
backend/cli.py
Normal file
33
backend/cli.py
Normal file
@@ -0,0 +1,33 @@
|
||||
"""命令行入库工具。
|
||||
|
||||
用法:
|
||||
python cli.py init # 仅建库建表
|
||||
python cli.py ingest # 全量入库(默认股票池)
|
||||
python cli.py ingest 600519 000001 # 指定股票入库(含快照)
|
||||
"""
|
||||
import sys
|
||||
|
||||
from db import init_db
|
||||
import ingest
|
||||
|
||||
|
||||
def main():
|
||||
init_db()
|
||||
args = sys.argv[1:]
|
||||
if not args or args[0] == "init":
|
||||
print("init done")
|
||||
return
|
||||
if args[0] == "ingest":
|
||||
codes = args[1:] or None
|
||||
res = ingest.run_daily_ingest(universe=codes)
|
||||
print(res)
|
||||
elif args[0] == "ingest_all":
|
||||
days = int(args[1]) if len(args) > 1 else 250
|
||||
# 先抓快照类数据,再全市场日线
|
||||
ingest.run_daily_ingest(with_quotes=False)
|
||||
res = ingest.ingest_quotes_all(days=days)
|
||||
print(res)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user