I'm trying to do something like this:
```
class CryptoTicker(GenPollUrl):
QUERY_URL = "https://api.coinbase.com/v2/prices/{}-{}/spot"
defaults = [
(
"currency",
"USD",
"The baseline currency that the value of the crypto is
displayed in.",
),
("symbol", "$", "The symbol for the baseline currency."),
("crypto", "BTC", "The cryptocurrency to display."),
("format", "{crypto}: {symbol}{amount:.2f}", "Display string
formatting."),
]
def __init__(self, **config):
GenPollUrl.__init__(self, **config)
_, min = map(int, time.strftime("%H %M").split())
cryptos = [
"BTC",
"ETH",
"ADA",
"AVAX",
]
self.currency = "USD"
self.symbol = "$"
self.crypto = cryptos[min % len(cryptos)]
self.format = "{crypto}:{symbol}{amount:.2f}"
@property
def url(self):
return self.QUERY_URL.format(self.crypto, self.currency)
def parse(self, body):
variables = dict()
variables["crypto"] = self.crypto
variables["symbol"] = self.symbol
variables["amount"] = float(body["data"]["amount"])
return self.format.format(**variables)
```
It is stuck with one of the cryptos on the list instead of updating to the
new one. Please advise thanks
--
You received this message because you are subscribed to the Google Groups
"qtile-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/qtile-dev/c94cc4fe-594b-4b20-a149-048a816047c2n%40googlegroups.com.