Note
The original ticker.sh has been discontinued. This fork aims to help keep similar functionality alive.
ticker.sh is a Bash script that retrieves and displays live stock prices, along with precious metal prices (gold, silver, platinum) and the gold-to-silver ratio. It uses Yahoo Finance as the source for fetching data and can display results in color-coded output for better readability.
- Fetch live stock prices by providing stock symbols (e.g., AAPL, MSFT, GOOG).
- Display live spot prices for gold, silver, and platinum.
- Calculate and display the Gold/Silver ratio.
- Color-coded output for price changes and metal prices.
- Option to disable colorization by setting the
NO_COLORenvironment variable.
Ensure the following dependencies are installed:
-
Clone the repository or download the
ticker.shscript. -
Ensure the script is executable:
chmod +x ticker.sh
-
Install the required dependencies:
sudo apt-get install jq bc curl # For Debian-based systems
You can fetch live stock prices by passing the stock symbols as arguments in the order that you would like to see. For example, to retrieve the prices for Apple (AAPL), Microsoft (MSFT), and Google (GOOG), use the following command:
./ticker.sh AAPL MSFT GOOG BTC-USD
This will display the current price, the price change, and the percentage change.
To fetch the spot prices for gold, silver, platinum, and the gold-to-silver ratio, use the -g flag:
./ticker.sh -g
You can also fetch both stock prices and precious metal prices in a single command:
./ticker.sh -g AAPL MSFT GOOG BTC-USD
This will display both the spot prices for the metals and the prices for the given stock symbols.
You can also sort the stock prices by gain/loss percentage with the -s flag:
./ticker.sh -s AAPL MSFT GOOG BTC-USD
This will sort the stock prices for the given stock symbols.
If you are running the script in an environment that doesn't support color or if you prefer plain text output, you can disable colorization by setting the NO_COLOR environment variable:
NO_COLOR=1 ./ticker.sh AAPL MSFT GOOG BTC-USD
This fork adds an optional AI-powered alerting feature that analyzes recent price indicators and returns a compact recommendation. Take advice with CAUTION.
- Trigger an alert for each symbol with a timeframe using
-a TIMEFRAMEor--alert TIMEFRAME(e.g.1m,5m,1h,1d). - Include
-ror--rationaleto print a short rationale after the recommendation. - Use
-dor--debugto print the helper payload preview and raw model response for debugging.
Note: If you pass -r/--rationale without -a/--alert, the script will default to a 1d timeframe for the AI alert.
Examples:
# Request AI alert (compact recommendation)
./ticker.sh -a 5m RXT
# Include rationale and debug info
./ticker.sh -a 5m -r -d RXT
Environment and configuration
- Place your OpenAI API key in a
.envfile or exportOPENAI_API_KEY. - Optional environment variables:
OPENAI_MODEL(default:gpt-5-nano)OPENAI_MAX_COMPLETION_TOKENS(default:650)OPENAI_USE_RESPONSES(set to1to use the Responses API - recommended; default0)
Notes
- The helper script
ai_alert.pyperforms the indicator calculations (RSI, MACD, PPO) locally and sends a deterministic prompt to the OpenAI API. When no API key is present the helper returns a simple RSI-based heuristic (no network call). - The script rate-limits AI calls (configurable via
ALERT_DELAY) when processing multiple symbols to avoid overage.
When the script prints an AI recommendation inline it may include a status marker and a confidence score. The markers indicate whether the helper contacted the model:
- [S] — AI helper called the model successfully and returned a recommendation.
- [F] — AI helper failed to call the model (network or API error) and used local fallback heuristics to produce a recommendation.
Confidence score:
- Recommendations include an integer confidence score from 1 to 10 (10 = highest confidence). Use the score to weigh the recommendation.
Note
Use a foreloop for continious 5 minute monitoring and AI rationale:
while true; do ./ticker.sh -gs -r 5m SPY B HNST MSFT PFE PLG PYPL RXT WEAT; sleep 300; clear; doneThis script is provided as-is under the MIT License. You are free to modify and distribute it under the terms of the license.
Contributions are welcome! If you encounter bugs or have feature suggestions, feel free to submit an issue or pull request.
Created by @pstadler
Updated by @appatalks
