feat: add "get_proxy_coin" method

used for BNFCR mode
This commit is contained in:
Matthias
2024-12-17 06:48:03 +01:00
parent ca9589b2e8
commit 0b9cca27e2
2 changed files with 19 additions and 1 deletions

View File

@@ -58,9 +58,19 @@ class Binance(Exchange):
# TradingMode.SPOT always supported and not required in this list
# (TradingMode.MARGIN, MarginMode.CROSS),
# (TradingMode.FUTURES, MarginMode.CROSS),
(TradingMode.FUTURES, MarginMode.ISOLATED)
(TradingMode.FUTURES, MarginMode.ISOLATED),
]
def get_proxy_coin(self) -> str:
"""
Get the proxy coin for the given coin
Falls back to the stake currency if no proxy coin is found
:return: Proxy coin or stake currency
"""
if self.margin_mode == MarginMode.CROSS:
return "BNFCR"
return self._config["stake_currency"]
def get_tickers(
self,
symbols: list[str] | None = None,

View File

@@ -1864,6 +1864,14 @@ class Exchange:
except ccxt.BaseError as e:
raise OperationalException(e) from e
def get_proxy_coin(self) -> str:
"""
Get the proxy coin for the given coin
Falls back to the stake currency if no proxy coin is found
:return: Proxy coin or stake currency
"""
return self._config["stake_currency"]
def get_conversion_rate(self, coin: str, currency: str) -> float | None:
"""
Quick and cached way to get conversion rate one currency to the other.