feat libs,sdk,trend

This commit is contained in:
2026-09-07 14:04:26 +08:00
parent d37f9edefc
commit e320de3241
30 changed files with 515 additions and 507 deletions

View File

@@ -9,6 +9,15 @@ import httpx
COLLECTOR_URL = "http://139.224.247.176:13499/collector"
def submit_trend_data() -> None:
"""每五分钟提交趋势策略的最新缓存,尚无快照时跳过。"""
from strategy.trend.boot import get_collector_snapshot
snapshot = get_collector_snapshot()
if snapshot is not None:
collector_push(*snapshot)
def _json_value(value: Any) -> Any:
"""Convert the QMT model values into values accepted by a JSON encoder."""
if is_dataclass(value) and not isinstance(value, type):
@@ -27,7 +36,7 @@ def _json_value(value: Any) -> Any:
def collector_push(account_id: str, assets: Any, positions: Any) -> None:
"""Best-effort collector upload; never propagate errors to the caller."""
"""[暂停] 数据收集提交太耗时超过200毫秒."""
try:
payload = _json_value(
{