9f67de3677
删除 crypto_monitor_gate_bot 目录,中控与子代理改为 binance/okx/gate 三账户; 文档与 UI 文案「四所」改为「三所」;新增清库前一次性配置备份脚本。 Co-authored-by: Cursor <cursoragent@cursor.com>
33 lines
987 B
Python
33 lines
987 B
Python
"""子代理持仓:三所开仓价字段统一解析。"""
|
|
from __future__ import annotations
|
|
|
|
import sys
|
|
import unittest
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
sys.path.insert(0, str(ROOT / "manual_trading_hub"))
|
|
|
|
from agent import _position_entry_price # noqa: E402
|
|
|
|
|
|
class TestHubAgentEntryPrice(unittest.TestCase):
|
|
def test_binance_entry_price(self):
|
|
px = _position_entry_price({"entryPrice": 65851.6, "info": {}})
|
|
self.assertAlmostEqual(px, 65851.6)
|
|
|
|
def test_okx_avg_px(self):
|
|
px = _position_entry_price({"info": {"avgPx": "72.731"}})
|
|
self.assertAlmostEqual(px, 72.731)
|
|
|
|
def test_gate_info_entry(self):
|
|
px = _position_entry_price({"info": {"entry_price": "0.2232"}})
|
|
self.assertAlmostEqual(px, 0.2232)
|
|
|
|
def test_missing_returns_none(self):
|
|
self.assertIsNone(_position_entry_price({"info": {}}))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|