fix format symbol in all markets
This commit is contained in:
@@ -57,7 +57,9 @@ class BinanceWrapper(MarketWrapper):
|
||||
"""
|
||||
Formatta l'asset_id nel formato richiesto da Binance.
|
||||
"""
|
||||
return asset_id.replace('-', '') if '-' in asset_id else f"{asset_id}{self.currency}"
|
||||
i = asset_id.index('-')
|
||||
if i != -1: asset_id = asset_id[:i]
|
||||
return f"{asset_id}{self.currency}" if self.currency not in asset_id else asset_id
|
||||
|
||||
def get_product(self, asset_id: str) -> ProductInfo:
|
||||
symbol = self.__format_symbol(asset_id)
|
||||
|
||||
@@ -61,7 +61,9 @@ class CoinBaseWrapper(MarketWrapper):
|
||||
)
|
||||
|
||||
def __format(self, asset_id: str) -> str:
|
||||
return asset_id if '-' in asset_id else f"{asset_id}-{self.currency}"
|
||||
i = asset_id.index('-')
|
||||
if i != -1: asset_id = asset_id[:i]
|
||||
return f"{asset_id}-{self.currency}"
|
||||
|
||||
def get_product(self, asset_id: str) -> ProductInfo:
|
||||
asset_id = self.__format(asset_id)
|
||||
|
||||
@@ -47,8 +47,9 @@ class YFinanceWrapper(MarketWrapper):
|
||||
Formatta il simbolo per yfinance.
|
||||
Per crypto, aggiunge '-' e la valuta (es. BTC -> BTC-USD).
|
||||
"""
|
||||
asset_id = asset_id.upper()
|
||||
return f"{asset_id}-{self.currency}" if '-' not in asset_id else asset_id
|
||||
i = asset_id.index('-')
|
||||
if i != -1: asset_id = asset_id[:i]
|
||||
return f"{asset_id}-{self.currency}"
|
||||
|
||||
def get_product(self, asset_id: str) -> ProductInfo:
|
||||
symbol = self._format_symbol(asset_id)
|
||||
|
||||
Reference in New Issue
Block a user