fix(hub): align Binance chart ticks and improve monitor mark price
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -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 = {
|
||||
|
||||
Reference in New Issue
Block a user