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

so many changes

This commit is contained in:
2021-02-27 17:14:55 -07:00
parent 6e37e541d6
commit e08f3c4275
5 changed files with 130 additions and 57 deletions

27
Symbol.py Normal file
View File

@@ -0,0 +1,27 @@
import requests as r
class Symbol:
currency = "usd"
pass
class Stock(Symbol):
def __init__(self, symbol) -> None:
self.symbol = symbol
class Coin(Symbol):
def __init__(self, symbol) -> None:
self.symbol = symbol
self.get_data()
def get_data(self) -> None:
data = r.get("https://api.coingecko.com/api/v3/coins/" + self.symbol).json()
self.id = data["id"]
self.name = data["name"]
self.description = data["description"]
self.price = data["market_data"]["current_price"][self.currency]
self.data = data