Skip to content

A lightweight Waybar module written in Go to display stock and cryptocurrency prices with configurable colors and formatting.

License

Notifications You must be signed in to change notification settings

bautitobal/waybar-stocks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

waybar-stocks

A customizable Waybar module written in Go that displays real-time prices for stocks, cryptocurrencies and indices.
Supports price rotation, percent change indicators, custom colors, and YAML configuration — no external Python scripts or dependencies required.

Features

  • Display stock, crypto, or index prices (e.g. BTC-USD (or bitcoin like CoinGecko's naming), AAPL, SPY, ^GSPC), and Argentinian Dólar prices (dolar-oficial, dolar-blue, dolar-cripto, etc.).
  • Shows price + percent change + up/down icons for each asset.
  • Configurable via config.yml.
    • Supports color customization
    • Assets
    • Refresh & rotation interval!
    • Timeframe for each stock! (see Timeframe (per-asset))
  • Fast & lightweight (native Go binary, no runtime needed)
  • Includes CLI flags like --help and --config
  • Works perfectly with Waybar (Hyprland / Sway / niri / dwl)

Requirements

  • Go 1.20+ (or the version configured in go.mod)
  • Internet access to query Yahoo Finance and CoinGecko

Installation

  1. Clone the repository:
git clone https://github.com/bautitobal/waybar-stocks.git
cd waybar-stocks
  1. Build:
go build -o waybar-stocks

(Opcional) Move it to PATH:

sudo mv waybar-stocks ~/.local/bin/

Configuration

Create or edit the file config.yml in the project folder or any custom path.

refresh_interval: 60        # seconds between API updates
rotation_interval: 5        # seconds to display each asset
format: "{symbol} {price} ({change}%{icon})"

colors:
  up: "#00FF00"        # price increasing
  down: "#FF5555"      # price decreasing
  neutral: "#FFFFFF"   # no change

assets:
  - symbol: BTC-USD
    name: BTC
    timeframe: 1D
  - symbol: AAPL
    name: AAPL
    timeframe: 1W
  - symbol: SPY
    name: S&P500
    timeframe: 1M
  - symbol: dolar-oficial
    name: DÓLAR OFICIAL
    timeframe: 1D
  - symbol: dolar-cripto
    name: DÓLAR CRIPTO
    timeframe: 1D

Timeframe (per-asset)

You can optionally set a timeframe per asset to control which period the percent change is computed for. If omitted, the default is daily (1D). Examples:

  • 15m — 15 minutes
  • 1H or H — 1 hour
  • 1D or D — 1 day (default)
  • 3D — 3 days
  • 1W or W — 1 week
  • 1M — 1 month (approximated as 30 days)
  • 1Y or Y — 1 year (approximated as 365 days)

Notes:

  • For stocks the fetcher will prefer Yahoo's session metadata for daily change, or request Yahoo chart data for custom timeframes and compute the percent between "now" and "timeframe ago".
  • For cryptocurrencies the fetcher uses CoinGecko's 24h percent by default; for custom timeframes it queries CoinGecko's market_chart and computes the percent accordingly.
  • For dolar-* symbols the app fetches the latest venta (or compra) from DolarApi and computes change relative to the last saved value (persisted in the cache). If you need percent vs a fixed period (e.g. 24h), the app can be extended to keep a longer history or use historical endpoints.

You can include the {timeframe} token in your format string to show the timeframe explicitly. If {timeframe} is not present, the timeframe will be appended to the symbol automatically when set.

Add to Waybar

In your ~/.config/waybar/config.jsonc, add:

"custom/stocks": {
  "exec": "~/waybar-stocks --config ~/waybar-stocks/config.yml", // or ~/.local/bin/waybar-stocks --config ~/.local/bin/waybar-stocks/config.yml; could be ANY config PATH tbh.
  "return-type": "json",
  "interval": 1
}

Then reload waybar.

🛠 Command Line Usage

waybar-stocks --help

Contributing

Pull requests are welcome! Feel free to open an issue for feature requests or bugs.

License

This project is available under the MIT License — see the LICENSE file for details.

Support

If you have any questions or need help, feel free to open an issue or contact the maintainers.

Socials

LinkedIn Roadmap Instagram Behance X Medium Goodreads

Donate

Feel free to donate! (If you can afford and you want of course).

PayPal Ko-Fi

About

A lightweight Waybar module written in Go to display stock and cryptocurrency prices with configurable colors and formatting.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages