fr
eef
olioAs you may know, a famous application capable of tracking the allocation of cryptocurrencies has suffered an attack some days ago. This time there seem to be only trivial problems, but who knows what could have happened. The usual problem is using other people's services for things that a simple spreadsheet would do better.
Leaving aside spreadsheets which, unless you use the phenomenal scim
or (even better) sc
, are a waste of graphical interface libraries, the best solution is always to use a script.
Here I have decided to make a python script. The script is so simple that it could probably be the ultimate solution. The complete script can be found here (you don't even need to make a repository out of it). The script is based on the CoinGecko API, and to install the library in python just do:
pip3 install pycoingecko
The important part are those lines of code:
#!/usr/bin/env python
from pycoingecko import CoinGeckoAPI
curr='eur'
thre=0.8
principal_coin='xmr'
cg=CoinGeckoAPI()
[...]
amounts={ 'btc':3.92, 'eth':0.3, 'xmr':246.43, 'bake': 118.79, 'bnb':131,}
[...]
data=cg.get_price(ids=coinsid,vs_currencies=curr)
for i in coinsid:
price=data[i][curr]
amount=amountsid[i]
partial=price*amount
if (i == principal_coin):
principal_partial=partial
sum=sum+partial
print("total of funds is",sum,curr )
[...]
(In case you were wondering, those are not the real amounts I own)
The script also gives the possibility to insert a principal coin and decide a threshold. If the value in terms of curr
(eur, or usd or whatever) exceeds by percentage the value of thre
, then the scripts prints a warning. So unlike the attacked application, my script is also capable of doing trivial fund allocation analysis.
Finally, in my opinion, the best way to call this script is frf
, and the code is released under the GPLv3+ license.