[docs]@classmethoddeffrom_ticker(cls,ticker:str)->"AssetConfig":""" Return a AssetConfig from a ticker. Raise UnsupportedAssetError if the ticker is not supported. :param ticker: Ticker :return: AssetConfig """assets=filter(lambdax:x.ticker==ticker,ALL_ASSETS_CONFIGS)try:asset=next(assets)returnassetexceptStopIteration:raiseUnsupportedAssetError(f"Asset with ticker {ticker} is not supported.")
[docs]@staticmethoddefget_coingecko_id_from_ticker(ticker:str)->str:""" Return the coingecko id from a ticker. Raise UnsupportedAssetError if the ticker is not supported. :param ticker: Ticker :return: Coingecko id """asset=AssetConfig.from_ticker(ticker)ifasset.coingecko_idisNone:raiseValueError(f"{ticker} does not have any coingecko id.")returnasset.coingecko_id