35 lines
788 B
Python
35 lines
788 B
Python
"""可选:手动回填到期结算 / 历史指数。"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
sys.path.insert(0, str(ROOT))
|
|
os.chdir(ROOT)
|
|
|
|
from apps.worker.settle import backfill_settlements
|
|
from packages.config import get_settings
|
|
from packages.db import Repository
|
|
|
|
|
|
def main() -> int:
|
|
s = get_settings()
|
|
repo = Repository(s.db_path)
|
|
try:
|
|
result = backfill_settlements(
|
|
repo,
|
|
underlying=s.underlying,
|
|
index_inst_id=s.index_inst_id,
|
|
)
|
|
print(result)
|
|
return 0 if not result["errors"] else 1
|
|
finally:
|
|
repo.close()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|