feat: add "get_proxy_coin" method
used for BNFCR mode
This commit is contained in:
@@ -58,9 +58,19 @@ class Binance(Exchange):
|
|||||||
# TradingMode.SPOT always supported and not required in this list
|
# TradingMode.SPOT always supported and not required in this list
|
||||||
# (TradingMode.MARGIN, MarginMode.CROSS),
|
# (TradingMode.MARGIN, MarginMode.CROSS),
|
||||||
# (TradingMode.FUTURES, 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(
|
def get_tickers(
|
||||||
self,
|
self,
|
||||||
symbols: list[str] | None = None,
|
symbols: list[str] | None = None,
|
||||||
|
|||||||
@@ -1864,6 +1864,14 @@ class Exchange:
|
|||||||
except ccxt.BaseError as e:
|
except ccxt.BaseError as e:
|
||||||
raise OperationalException(e) from 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:
|
def get_conversion_rate(self, coin: str, currency: str) -> float | None:
|
||||||
"""
|
"""
|
||||||
Quick and cached way to get conversion rate one currency to the other.
|
Quick and cached way to get conversion rate one currency to the other.
|
||||||
|
|||||||
Reference in New Issue
Block a user