Extend the crypto currency code list

Hi Tidbyt team,

I see the list is currently limited to around 10, including Doge coin!

Can this be extended to include the option to choose from at least the top50, maybe SHIB(!)

Thanks,
SR

Here’s an example using coingecko to pull Matic/USD:

load(“render.star”, “render”)
load(“http.star”, “http”)
load(“encoding/base64.star”, “base64”)

PRICE_URL = “https://api.coingecko.com/api/v3/simple/price?ids=matic-network&vs_currencies=usd”
ICON = base64.decode(“”“iVBORw0KGgoAAAANSUhEUgAAACAAAAAfCAYAAACGVs+MAAAAAXNSR0IArs4c6QAACZ5JREFUWEfFl2mQFOUZx3/TPdM9Mzv3zN6zFyjH7grLtfECpZBAFC1CeXAkVoyFkKAxVfmSVCqmKh80lpjD8iTGaBIRI6VWMJQBBYRg1AVcYHe5ZGHvc+57ero7Nb0cIho1X9JVUzXV1TP9e/7v8/6f/2tCkHT+j5fp6wKIJisOsQYJGQsCGqCikSdHUu1D1bNfq5yvBGAWnDjECrxSgHJ3kEpbBVNKK3H7XMbLYqEUJ8YGGE0PMRrrJ1QIkVCHKGiJL4X5rwA2wYfPWkdTsJlZtY1k4zm6R8ZIqhl0NQNCsX5AFxBNNkrMdurKS7G6JNp7u+js6yCS6yGjhb8Q5AsBrIKfWkcj86pnU+mtYCQVZyDSw9loD0k9gVJIoeka6CCIIpJgxyE4qfPWE/TUUmZ3MRgd4sDAIXqSXeS+AOJzAXyWGq50ziLomIzFYmIk38fpeDcmk5mgdxo5NU1By52rXsdkEjCLMpJJpj96ApNeoME1Cb9cg6rAUPw0J5KHiCj9lylxGYBV8DHDdz3X1MwlmolzYOgwebOCpySAYBLw26rIq1nyWg5dK24gHZMgIIlWLKKFcHoYTVeJpsYxqxLzKmbis7l4v+8jjoT3k9Uil0BcAmAT/AQdjTT55+C2mekKtzOaTRD0TcUj+UkpMdL5JDktR17Ngaai62ASRayijEWUsFuc2CUXsVyI/vApyqxOGv0ziKYVjoUO0Zc8RkYLXYC4BKDaNov5DfMpFAS6RjtIk6DS04BT8pPIhUnn4ySVOHk1T76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osZQppeziR5Es0yDtwlFy1HQ82h64RyAaABIoszpSAeaUqDBWUuFLYimifQlzvBJ7BBhpefLQ+n5J4pK1DmbuLpmLhXOMvpjEfpjfQxE+0jpxWXIojCRjC3FU5JgpcTkIuipIeiuocbjYTA+ygd9B+lNdJL9OrH8PITNFMBvraepZiazaptRkinOjI0SyyfI5pJAUQETui5ilx04ZCcNZeVYS6y093bQ0XeE8WwPGf3imn9Wgq90NLOILhxiJT6zjzJ3NQG5gjqbj+r6CtBE+nsH6M2MMZ4fYyQ6QKQQIqkOo6jxyyT/nwA+/SOxKLWlDlmzYtFFoxEVVBQypP6Hw+l/AHj1YzXovjxGAAAAAElFTkSuQmCC”“”)

def main(config):
font = config.get(“font”, “tb-8”)
rep = http.get(PRICE_URL)
if rep.status_code != 200:
fail(“Coingecko request failed with status %d”, rep.status_code)

rate = rep.json()["matic-network"]["usd"]

print(rate)


return render.Root(
child = render.Box( # This Box exists to provide vertical centering
    render.Row(
        expanded=True, # Use as much horizontal space as possible
        main_align="space_evenly", # Controls horizontal alignment
        cross_align="center", # Controls vertical alignment
        children = [
            render.Image(src=ICON),
            render.Text("$%s" % rate, color="#FFFFFF", font = font),
        ],
    ),
),

)

2 Likes

This topic was automatically closed after 365 days. New replies are no longer allowed.