1
0
mirror of https://gitlab.com/simple-stock-bots/simple-telegram-stock-bot.git synced 2025-07-25 07:31:48 +00:00

search now works with crypto

This commit is contained in:
2021-03-28 22:37:09 -07:00
parent f1838ba012
commit a4befde8ce
4 changed files with 46 additions and 12 deletions

View File

@@ -47,7 +47,9 @@ class cg_Crypto:
raw_symbols = r.get("https://api.coingecko.com/api/v3/coins/list").json()
symbols = pd.DataFrame(data=raw_symbols)
symbols["description"] = symbols["symbol"] + ": " + symbols["name"]
symbols["description"] = "$$" + symbols["symbol"] + ": " + symbols["name"]
symbols = symbols[["id", "symbol", "name", "description"]]
self.symbol_list = symbols
if return_df:
return symbols, datetime.now()
@@ -131,6 +133,8 @@ class cg_Crypto:
name = data["name"]
price = data["market_data"]["current_price"][self.vs_currency]
change = data["market_data"]["price_change_percentage_24h"]
if change is None:
change = 0
except KeyError:
return f"{symbol} returned an error."