Utilising the πͺNomics API to get crypto prices.
Queues 1 crypto price at a time and gradually increments every 0.1 seconds to "smoothly" update portfolio values, since nomics api has 1 second rate limit, and the actual data their api returns is only updated every ~7 seconds. Because of this, the SLEEP_TIME constant interval is set to 7, but you can decrease that if you would like more up-to-date valuation, or increase it to reduce the likelihood of the nomics api returning the same values (which causes the "smooth" updating to pause until nomics returns new data).
Add as many portfolios as you want π€
Some example portfolios are already present in the code:
-
Create a new dictionary where the keys are crypto tags, and the values are the amount of that crypto the portfolio owns.
-
Add the new dictionary to the
peoplelist.
The script will aggregate unique cryptocurrency tags to generate params for the api call so the api will only need to be called once for every loop π
Crypto going up but you never learnt how to count? Not a problem! The script will automatically format each portfolio with colours depending on their current performance.
π’ The latest API call returned bigger numbers than the previous API call. You're in the money π€ At least for now π€‘
π‘ The latest API call returned the same numbers. Darn π If you want this to happen less often you could try raising the TIME_SLEEP constant.
π΄ Aw, shucks! You're bleeding money π You should've just put your money under your bed like your grandma told you π΅
-
This script was built with
Python3.9but I'm pretty sure it'd still run if you have any version of Python3. No promises though. -
You'll have to replace the
KEYconstant with your own key, which you can get from πͺNomics. -
You should also probably replace the example portfolios, unless you want to imagine how much crypto Keanu Reeves has, or track the exact value of the πΆ SHIB Vitalik cast into a volcano (4,635,734,563.52 dollarydoos π΅π¦ at the time of the screenshot above taken on June 1st).
-
Oh yeah, and you should probably change the CURRENCY constant from
"AUD"to"USD"or something if you're not from Australia π¦πΊ, but I'm kinda assuming anyone reading this is from here since I'm not applying for jobs anywhere else π€·ββοΈ


