fix(hub): align Binance chart ticks and improve monitor mark price

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-03 22:33:59 +08:00
parent c1fda1e7d5
commit 2a9602610e
7 changed files with 275 additions and 30 deletions
+29
View File
@@ -54,6 +54,35 @@ class TestHubOhlcvLib(unittest.TestCase):
)
self.assertAlmostEqual(tick, 0.01)
def test_price_tick_from_binance_price_filter(self):
class _Ex:
markets = {
"BTC/USDT:USDT": {
"precision": {"price": 2},
"info": {
"filters": [
{"filterType": "PRICE_FILTER", "tickSize": "0.10"},
{"filterType": "LOT_SIZE", "stepSize": "0.001"},
]
},
"limits": {},
}
}
def load_markets(self):
return self.markets
def market(self, sym):
return self.markets[sym]
def price_to_precision(self, sym, price):
return "12345.6"
from hub_ohlcv_lib import price_tick_from_market
tick = price_tick_from_market(_Ex(), "BTC/USDT:USDT")
self.assertAlmostEqual(tick, 0.10)
def test_price_tick_from_info_tick_size(self):
class _Ex:
markets = {