This script aims to be simple and to be used for any project. The script simply displays informations about the selected crypto.
- Python (3.x)
- coingecko API
Clone the repository and configure json settings in crypto_settings.json as follows:
currency
: string ("eur", "usd",...)polybar
: bool (set to true for 100% compatibility with polybar)balance
: int (amount of coins you have)balance_precision
: int (digits after decimal)name
: bool (true or false)image
: boolcurrent_price
: boolprice_precision
: intmarket_cap
: boolmarket_cap_rank
: boolfully_diluted_valuation
: booltotal_volume
: boolhigh_24h
: boollow_24h
: boolprice_change_24h
: boolprice_change_24h_precision
: int (digits after decimal)price_change_percentage_24h
: boolprice_change_percentage_24h_precision
: int (digits after decimal)market_cap_change_24h
: boolmarket_cap_change_percentage_24h
: boolcirculating_supply
: booltotal_supply
: boolmax_supply
: boolath
: boolath_change_percentage
: boolath_date
: boolatl
: boolatl_change_percentage
: boolatl_date
: boolroi
: boollast_updated
: bool
{
"polybar": true,
"url": "https://api.coingecko.com/api/v3/coins/markets?",
"currency": "eur",
"crypto-list":[
{
"id": "bitcoin",
"symbol": true,
"current_price": true,
"price_precision": 0
},
{
"id": "ripple",
"symbol": true,
"current_price": true,
"price_precision": 3,
"balance": 10,
"balance_precision": 0,
"price_change_percentage_24h": true,
"price_change_percentage_24h_precision": 2
}
]
}
Set polybar value to true in crypto_settings.json and add the following config in polybar config:
[module/crypto]
type = custom/script
interval = 1
exec = python /path/to/crypto/script
For more information on values(like available currencies or available crypto) or anything else, take a look here.
Important note: keep in mind that the coingecko API has a limit of 100 requests per minute so an interval of 0.5(120 requests per minute) in polybar will not work but an interval of 1(60 requests per minute) is perfectly fine.