add snapshot

This commit is contained in:
2026-09-11 13:35:21 +08:00
parent 6e554e1565
commit 2888126a3a
3 changed files with 36 additions and 24 deletions

View File

@@ -3,7 +3,7 @@ from datetime import date, datetime
from enum import Enum
import json
from typing import Any
from strategy.trend.boot import get_collector_snapshot
from libs.snapshot import get_collector_snapshot
import httpx
@@ -34,7 +34,7 @@ def _json_value(value: Any) -> Any:
return str(value)
def collector_push(account_id: str, assets: Any, positions: Any) -> None:
def collector_push(account_id: str, assets: Any, positions: Any, deals: Any = None) -> None:
"""[暂停] 数据收集提交太耗时超过200毫秒."""
try:
payload = _json_value(
@@ -42,6 +42,7 @@ def collector_push(account_id: str, assets: Any, positions: Any) -> None:
"account_id": account_id,
"assets": assets,
"positions": positions,
**({"deals": deals} if deals is not None else {}),
}
)
httpx.post(COLLECTOR_URL, json=payload, timeout=3.0)