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:
27
Symbol.py
Normal file
27
Symbol.py
Normal 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
|
Reference in New Issue
Block a user