GET /companies(Free plan) — bulk price fetch for all holdings at onceGET /companies/:symbol(Starter plan) — single stock quote when needed
How it works
- Store each holding as
{ symbol, quantity, avg_cost }— either in a database or client-side - Fetch current prices for all held symbols in one call
- Calculate position value and P&L per stock
- Sum up for the total portfolio view
Step 1: Define your holdings
JavaScript
Python
Step 2: Fetch live prices for all holdings
Fetch the full company list and filter to your held symbols — one API call covers the whole portfolio.Step 3: Calculate P&L for each position
Step 4: Put it all together
Sample output
React component
React
Tips
Store holdings server-side. Keepingavg_cost and quantity in your own database means you can calculate P&L for any user without exposing API keys to the client.
Refresh on the same cadence as the ticker. Prices update every 20 minutes during trading hours — a 5-minute poll interval is a good balance between freshness and quota usage.
Handle missing prices gracefully. If a symbol isn’t in the response (e.g. suspended stock), fall back to avg_cost so the position still appears with a 0% change rather than crashing.
Companies list reference
All fields returned by
GET /companiesLive price ticker guide
How to keep prices updating automatically