This commit is contained in:
2026-09-10 20:13:10 +08:00
parent d837250bcb
commit 2b6fe2ffbc
2 changed files with 8 additions and 12 deletions

View File

@@ -44,8 +44,6 @@ def collector_push(account_id: str, assets: Any, positions: Any) -> None:
"positions": positions,
}
)
pretty_json = json.dumps(payload, indent=4, ensure_ascii=False)
print(pretty_json)
httpx.post(COLLECTOR_URL, json=payload, timeout=3.0)
except BaseException:
# Collection must never interrupt or affect the trading workflow.

View File

@@ -1,7 +1,7 @@
from datetime import datetime
import json
from sdk import Client
from libs.collector import collector_push
from sdk import Assets, Client, PositionItem
BASE_URL = "http://127.0.0.1:10086"
@@ -9,17 +9,15 @@ TOKEN = "QMTbyYanweidong"
STOCK_CODE = "000021.SZ"
VOLUME = 100
def main() -> None:
"""只读查询四类原始数据,输出 JSON 便于核对字段。"""
with Client(BASE_URL, TOKEN) as client:
for datatype in ("account", "order", "deal", "position"):
print(f"\n=== {datatype} ===")
try:
result = client.org(datatype)
print(f"记录数:{len(result)}")
print(json.dumps(result, ensure_ascii=False, indent=2, default=str))
except Exception as exc:
print(f"查询失败:{exc}")
portfolio = client.portfolio()
assets = portfolio.assets
positions = list(portfolio.positions.values())
collector_push("86037237", assets, positions)
def main1() -> None: