A command-line application for real-time monitoring of stock and cryptocurrency prices from multiple data sources.
- Real-time price monitoring for stocks and cryptocurrencies
- Support for multiple data sources:
- Coinbase (cryptocurrencies)
- Yahoo Finance (stocks)
- Configurable update intervals
- Support for monitoring multiple symbols simultaneously
- Graceful shutdown handling
- Optional monitoring duration setting
- Go 1.21 or later
- Internet connection for accessing price data
- Clone the repository
- Navigate to the project directory
- Run:
go mod download
go buildThe application accepts the following command-line flags:
-source: Data source to use (required)- Options:
coinbase,yahoo
- Options:
-symbols: Comma-separated list of symbols to monitor (required)- For Coinbase: Use format like "BTC-USD,ETH-USD"
- For Yahoo: Use stock symbols like "AAPL,GOOGL"
-interval: Update interval (optional, default: 5s)- Format: Use Go duration format (e.g., "5s", "1m")
-duration: How long to run the monitoring (optional, default: 0 = indefinite)- Format: Use Go duration format (e.g., "1h", "30m")
Monitor Bitcoin and Ethereum prices from Coinbase:
./stock_monitoring -source coinbase -symbols BTC-USD,ETH-USDMonitor Apple and Google stocks from Yahoo Finance with 1-minute updates:
./stock_monitoring -source yahoo -symbols AAPL,GOOGL -interval 1mMonitor Bitcoin for 1 hour with 30-second updates:
./stock_monitoring -source coinbase -symbols BTC-USD -interval 30s -duration 1h- Uses both REST API and WebSocket for real-time updates
- Provides cryptocurrency prices
- Format:
{CRYPTO}-{CURRENCY}(e.g., BTC-USD, ETH-USD)
- Uses REST API for price updates
- Provides stock market data
- Format: Standard stock symbols (e.g., AAPL, GOOGL)
The application outputs price updates in the following format:
{Source} Update: {Symbol: "symbol", Price: price}
Error messages are displayed as:
{Source} Error: error message
The application can be terminated in two ways:
- Press Ctrl+C for manual termination
- Specify a duration using the
-durationflag for automatic termination
- Connection errors are reported but don't terminate the application
- Invalid symbols are reported as errors in the output
- Invalid source names are reported immediately and terminate the application
Feel free to submit issues and enhancement requests!