Skip to content

Commit 1c93d9b

Browse files
committed
display option: change30d
1 parent 19fa18c commit 1c93d9b

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ volume_precision = 2
7777
- **change1h:** Displays the price change over the past hour.
7878
- **change24h:** Displays the price change over the past 24 hours.
7979
- **change7d:** Displays the price change over the past week.
80+
- **change30d:** Displays the price change over the past month.
8081
- **volume24h:** Displays the volume in your chosen currency, over the past 24 hours.
8182
- **api_key:** CoinmarketCap API key obtained from their [new api](https://coinmarketcap.com/api/) (The public API is discontinuing :'()
8283

config.ini.example

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[general]
22
currency = eur
33
currency_symbol = €
4-
# options are {price,change1h,change24h,change7d,volume24h}
4+
# options are {price,change1h,change24h,change7d,change30d,volume24h}
55
display = price,change24h
66
api_key = some_coinmarketcap_key
77

@@ -15,4 +15,4 @@ volume_precision = 2
1515
icon = 
1616
price_precision = 2
1717
change_precision = 2
18-
volume_precision = 2
18+
volume_precision = 2

waybar_crypto.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,12 @@ def get_json(self) -> str:
270270
)
271271
output += f"7d:{percentage_change:+}% "
272272

273+
if "change30d" in display_options:
274+
percentage_change = round(
275+
Decimal(pair_info["percent_change_30d"]), change_precision
276+
)
277+
output += f"30d:{percentage_change:+}% "
278+
273279
output_obj["text"] += output
274280
output_obj["tooltip"] += output
275281

0 commit comments

Comments
 (0)