Live Quotes
June 25, 2026 · View on GitHub
A Cloudflare Workers app that streams live stock quotes from Yahoo Finance using Hono, yahoo-finance2, and Server-Sent Events (SSE).
This project relies on the yahoo-finance2 library for all quote retrieval and market state data. The package is community-maintained Yahoo Finance client available at https://github.com/gadicc/yahoo-finance2.
Features
GET /redirects to the staticindex.htmlanding pageGET /live-quotesstreams live quote updates via SSE- Supports one or more comma-separated symbols via
s - Supports custom polling interval via
i(milliseconds) - Uses
yahoo-finance2to fetch latest market, pre-market, and post-market prices - Powered by
yahoo-finance2for live quote retrieval and market state detection
Project structure
src/index.ts— main Worker applicationstatic/index.htm— static client page served from the asset directorywrangler.jsonc— Cloudflare Workers configurationpackage.json— scripts, dependencies, and dev dependencies
Requirements
- Node.js
- npm
- Cloudflare Wrangler
Install
npm install
Local development
npm run dev
Then open the local Worker URL printed by Wrangler.
Usage
Open the UI
Visit:
/
This redirects to the static index.htm client.
Subscribe to quote events
Request:
/live-quotes?s=AAPL,MSFT&i=2000
Query parameters:
s— comma-separated symbol list (default:AAPL)i— poll interval in milliseconds (default:1000)
SSE event payload
Each SSE event is emitted with type quote and JSON payload containing:
t— timestampsymbol— requested ticker symbolprice— current pricechange— numeric change amountchangePercent— percentage changestate— market state (PRE,REGULAR, orPOST)
Scripts
npm run dev— run Wrangler in development modenpm run deploy— deploy the Worker using Wranglernpm test— run a dry-run deploy plus Vitest tests
Cloudflare configuration
The project uses:
compatibility_date: 2026-05-11nodejs_compatcompatibility flag- static assets from
./static
Notes
- No external environment variables are required for the basic quote stream.
- The app relies on the
yahoo-finance2package for live quote retrieval.
License
MIT