feat(hub): exchange price precision, entry price, and trend DCA display

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-03 21:25:24 +08:00
parent fac28c402b
commit f95118065d
5 changed files with 368 additions and 49 deletions
+32
View File
@@ -0,0 +1,32 @@
"""子代理持仓:四所开仓价字段统一解析。"""
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()