mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-12-15 20:31:43 +00:00
feat: support dynamic proxy coin conversion
This commit is contained in:
@@ -48,6 +48,10 @@ class Binance(Exchange):
|
||||
PriceType.MARK: "MARK_PRICE",
|
||||
},
|
||||
"ws_enabled": False,
|
||||
"proxy_coin_mapping": {
|
||||
"BNFCR": "USDC",
|
||||
"BFUSD": "USDT",
|
||||
},
|
||||
}
|
||||
|
||||
_supported_trading_mode_margin_pairs: list[tuple[TradingMode, MarginMode]] = [
|
||||
|
||||
@@ -156,6 +156,7 @@ class Exchange:
|
||||
# Override createMarketBuyOrderRequiresPrice where ccxt has it wrong
|
||||
"marketOrderRequiresPrice": False,
|
||||
"exchange_has_overrides": {}, # Dictionary overriding ccxt's "has".
|
||||
"proxy_coin_mapping": {}, # Mapping for proxy coins
|
||||
# Expected to be in the format {"fetchOHLCV": True} or {"fetchOHLCV": False}
|
||||
"ws_enabled": False, # Set to true for exchanges with tested websocket support
|
||||
}
|
||||
@@ -1872,6 +1873,9 @@ class Exchange:
|
||||
:returns: Conversion rate from coin to currency
|
||||
:raises: ExchangeErrors
|
||||
"""
|
||||
|
||||
if (proxy_coin := self._ft_has["proxy_coin_mapping"].get(coin, None)) is not None:
|
||||
coin = proxy_coin
|
||||
if coin == currency:
|
||||
return 1.0
|
||||
tickers = self.get_tickers(cached=True)
|
||||
|
||||
@@ -47,6 +47,8 @@ class FtHas(TypedDict, total=False):
|
||||
needs_trading_fees: bool
|
||||
order_props_in_contracts: list[Literal["amount", "cost", "filled", "remaining"]]
|
||||
|
||||
proxy_coin_mapping: dict[str, str]
|
||||
|
||||
# Websocket control
|
||||
ws_enabled: bool
|
||||
|
||||
|
||||
Reference in New Issue
Block a user