Use hub exchange instances for calculator contract precision.

Load enabled instances from settings, fetch market info via /api/hub/market, and apply exchange-specific amount and price precision in trend and roll calculators.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-23 18:13:02 +08:00
parent d938bc6c59
commit 5e507d0b66
14 changed files with 1140 additions and 204 deletions
+14
View File
@@ -9255,6 +9255,19 @@ def _hub_account_bundle():
}
def _hub_fetch_market(base=""):
from hub_market_info_lib import fetch_usdt_swap_market_info
return fetch_usdt_swap_market_info(
base_or_symbol=base,
normalize_symbol_input=normalize_symbol_input,
normalize_exchange_symbol=normalize_exchange_symbol,
ensure_markets_loaded=ensure_markets_loaded,
exchange=exchange,
exchange_id="gate",
)
def _hub_fetch_ohlcv(symbol, timeframe, since_ms=None, limit=500):
from hub_ohlcv_lib import fetch_ohlcv_for_hub
@@ -9303,6 +9316,7 @@ try:
views={"add_order": add_order, "add_key": add_key},
ohlcv_fn=_hub_fetch_ohlcv,
volume_rank_fn=_hub_fetch_volume_rank,
market_fn=_hub_fetch_market,
reconcile_hub_flat_fn=reconcile_hub_external_close,
risk_status_fn=hub_account_risk_status,
user_close_fn=hub_user_initiated_close,