changed __ varibles to _ to remove python3.10 warning

This commit is contained in:
Sam Germain 2021-08-01 21:56:46 -06:00
parent 14c345f6f6
commit 57ba31c09c

View File

@ -15,7 +15,7 @@ class LiqFormula(Enum):
FTX = "FTX" FTX = "FTX"
NONE = None NONE = None
def __exception(self, trading_mode: TradingMode, freq_specific: Optional[bool] = True): def _exception(self, trading_mode: TradingMode, freq_specific: Optional[bool] = True):
""" """
Raises an exception if exchange used doesn't support desired leverage mode Raises an exception if exchange used doesn't support desired leverage mode
:param trading_mode: cross, isolated, cross_futures or isolated_futures :param trading_mode: cross, isolated, cross_futures or isolated_futures
@ -29,45 +29,45 @@ class LiqFormula(Enum):
else: else:
raise OperationalException(f"{self.name} does not support {trading_mode.value} trading") raise OperationalException(f"{self.name} does not support {trading_mode.value} trading")
def __binance(self, trading_mode: TradingMode): def _binance(self, trading_mode: TradingMode):
# TODO-lev: Additional arguments, fill in formulas # TODO-lev: Additional arguments, fill in formulas
if trading_mode == TradingMode.CROSS_MARGIN: if trading_mode == TradingMode.CROSS_MARGIN:
# TODO-lev: perform a calculation based on this formula # TODO-lev: perform a calculation based on this formula
# https://www.binance.com/en/support/faq/f6b010588e55413aa58b7d63ee0125ed # https://www.binance.com/en/support/faq/f6b010588e55413aa58b7d63ee0125ed
self.__exception(trading_mode) self._exception(trading_mode)
elif trading_mode == TradingMode.ISOLATED_MARGIN: elif trading_mode == TradingMode.ISOLATED_MARGIN:
self.__exception(trading_mode) # Likely won't be implemented self._exception(trading_mode) # Likely won't be implemented
elif trading_mode == TradingMode.CROSS_FUTURES: elif trading_mode == TradingMode.CROSS_FUTURES:
# TODO-lev: perform a calculation based on this formula # TODO-lev: perform a calculation based on this formula
# https://www.binance.com/en/support/faq/b3c689c1f50a44cabb3a84e663b81d93 # https://www.binance.com/en/support/faq/b3c689c1f50a44cabb3a84e663b81d93
self.__exception(trading_mode) self._exception(trading_mode)
elif trading_mode == TradingMode.ISOLATED_FUTURES: elif trading_mode == TradingMode.ISOLATED_FUTURES:
# TODO-lev: perform a calculation based on this formula # TODO-lev: perform a calculation based on this formula
# https://www.binance.com/en/support/faq/b3c689c1f50a44cabb3a84e663b81d93 # https://www.binance.com/en/support/faq/b3c689c1f50a44cabb3a84e663b81d93
self.__exception(trading_mode) self._exception(trading_mode)
else: else:
self.__exception(trading_mode) self._exception(trading_mode)
def __kraken(self, trading_mode: TradingMode): def _kraken(self, trading_mode: TradingMode):
# TODO-lev: Additional arguments, fill in formulas # TODO-lev: Additional arguments, fill in formulas
if trading_mode == TradingMode.CROSS_MARGIN: if trading_mode == TradingMode.CROSS_MARGIN:
self.__exception(trading_mode) self._exception(trading_mode)
# TODO-lev: perform a calculation based on this formula # TODO-lev: perform a calculation based on this formula
# https://support.kraken.com/hc/en-us/articles/203325763-Margin-Call-Level-and-Margin-Liquidation-Level # https://support.kraken.com/hc/en-us/articles/203325763-Margin-Call-Level-and-Margin-Liquidation-Level
elif trading_mode == TradingMode.CROSS_FUTURES: elif trading_mode == TradingMode.CROSS_FUTURES:
# TODO-lev: implement # TODO-lev: implement
self.__exception(trading_mode) self._exception(trading_mode)
elif trading_mode == TradingMode.ISOLATED_MARGIN or \ elif trading_mode == TradingMode.ISOLATED_MARGIN or \
trading_mode == TradingMode.ISOLATED_FUTURES: trading_mode == TradingMode.ISOLATED_FUTURES:
self.__exception(trading_mode, True) self._exception(trading_mode, True)
else: else:
self.__exception(trading_mode) self._exception(trading_mode)
def __ftx(self, trading_mode: TradingMode): def _ftx(self, trading_mode: TradingMode):
# TODO-lev: Additional arguments, fill in formulas # TODO-lev: Additional arguments, fill in formulas
self.__exception(trading_mode) self._exception(trading_mode)
def __call__(self, **k): def __call__(self, **k):
@ -77,10 +77,10 @@ class LiqFormula(Enum):
return None return None
if self.name == "BINANCE": if self.name == "BINANCE":
return self.__binance(trading_mode) return self._binance(trading_mode)
elif self.name == "KRAKEN": elif self.name == "KRAKEN":
return self.__kraken(trading_mode) return self._kraken(trading_mode)
elif self.name == "FTX": elif self.name == "FTX":
return self.__ftx(trading_mode) return self._ftx(trading_mode)
else: else:
self.__exception(trading_mode) self._exception(trading_mode)