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",
|
PriceType.MARK: "MARK_PRICE",
|
||||||
},
|
},
|
||||||
"ws_enabled": False,
|
"ws_enabled": False,
|
||||||
|
"proxy_coin_mapping": {
|
||||||
|
"BNFCR": "USDC",
|
||||||
|
"BFUSD": "USDT",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
_supported_trading_mode_margin_pairs: list[tuple[TradingMode, MarginMode]] = [
|
_supported_trading_mode_margin_pairs: list[tuple[TradingMode, MarginMode]] = [
|
||||||
|
|||||||
@@ -156,6 +156,7 @@ class Exchange:
|
|||||||
# Override createMarketBuyOrderRequiresPrice where ccxt has it wrong
|
# Override createMarketBuyOrderRequiresPrice where ccxt has it wrong
|
||||||
"marketOrderRequiresPrice": False,
|
"marketOrderRequiresPrice": False,
|
||||||
"exchange_has_overrides": {}, # Dictionary overriding ccxt's "has".
|
"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}
|
# Expected to be in the format {"fetchOHLCV": True} or {"fetchOHLCV": False}
|
||||||
"ws_enabled": False, # Set to true for exchanges with tested websocket support
|
"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
|
:returns: Conversion rate from coin to currency
|
||||||
:raises: ExchangeErrors
|
:raises: ExchangeErrors
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
if (proxy_coin := self._ft_has["proxy_coin_mapping"].get(coin, None)) is not None:
|
||||||
|
coin = proxy_coin
|
||||||
if coin == currency:
|
if coin == currency:
|
||||||
return 1.0
|
return 1.0
|
||||||
tickers = self.get_tickers(cached=True)
|
tickers = self.get_tickers(cached=True)
|
||||||
|
|||||||
@@ -47,6 +47,8 @@ class FtHas(TypedDict, total=False):
|
|||||||
needs_trading_fees: bool
|
needs_trading_fees: bool
|
||||||
order_props_in_contracts: list[Literal["amount", "cost", "filled", "remaining"]]
|
order_props_in_contracts: list[Literal["amount", "cost", "filled", "remaining"]]
|
||||||
|
|
||||||
|
proxy_coin_mapping: dict[str, str]
|
||||||
|
|
||||||
# Websocket control
|
# Websocket control
|
||||||
ws_enabled: bool
|
ws_enabled: bool
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user