FMP Node API Documentation
Quote Endpoints
The Quote Endpoints provide unified access to real-time quotes, historical data, and intraday data for all asset types including stocks, cryptocurrencies, forex pairs, commodities, and ETFs. This unified approach simplifies your code by using the same methods regardless of asset type.
Available Methods
Method | Endpoint | Description |
---|---|---|
GET | /quote/{symbol} | Get real-time quote for any asset type |
GET | /quote/{symbol1},{symbol2},... | Get multiple quotes at once |
GET | /historical-price-full/{symbol} | Get historical price data for any asset type |
GET | /historical-chart/{interval}/{symbol} | Get intraday data with various intervals |
Supported Asset Types
The unified quote endpoints work with all major asset types:
- Stocks:
AAPL
,MSFT
,GOOGL
, etc. - Cryptocurrencies:
BTCUSD
,ETHUSD
,ADAUSD
, etc. - Forex Pairs:
EURUSD
,GBPUSD
,USDJPY
, etc. - Commodities:
ZOUSX
(Gold),ZOUSX
(Silver), etc. - ETFs:
SPY
,QQQ
,VTI
, etc.
Get Quote
Retrieve real-time quote data for any asset type. The response structure is consistent across all asset types.
1const quote = await fmp.quote.getQuote('AAPL');
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
symbol | string | Yes | Asset symbol (e.g., "AAPL", "BTCUSD", "EURUSD") |
Example Response
1{
2 success: true,
3 data: {
4 symbol: 'AAPL',
5 name: 'Apple Inc.',
6 price: 150.25,
7 changesPercentage: 2.15,
8 change: 3.15,
9 dayLow: 147.50,
10 dayHigh: 151.75,
11 yearHigh: 198.23,
12 yearLow: 124.17,
13 marketCap: 2375000000000,
14 priceAvg50: 145.67,
15 priceAvg200: 142.89,
16 volume: 45678900,
17 avgVolume: 52345600,
18 exchange: 'NASDAQ',
19 open: 148.50,
20 previousClose: 147.10,
21 eps: 6.16,
22 pe: 24.39,
23 earningsAnnouncement: '2024-01-25T21:30:00.000+00:00',
24 sharesOutstanding: 15800000000,
25 timestamp: 1703123456
26 }
27}
Examples for Different Asset Types
1// Stock quote
2const stockQuote = await fmp.quote.getQuote('AAPL');
3
4// Cryptocurrency quote
5const cryptoQuote = await fmp.quote.getQuote('BTCUSD');
6
7// Forex quote
8const forexQuote = await fmp.quote.getQuote('EURUSD');
9
10// ETF quote
11const etfQuote = await fmp.quote.getQuote('SPY');
Get Multiple Quotes
Retrieve quotes for multiple symbols in a single request.
1const quotes = await fmp.quote.getQuotes(['AAPL', 'GOOGL', 'MSFT']);
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
symbols | string[] | Yes | Array of asset symbols |
Example Response
1{
2 success: true,
3 data: [
4 {
5 symbol: 'AAPL',
6 name: 'Apple Inc.',
7 price: 150.25,
8 changesPercentage: 2.15,
9 change: 3.15,
10 // ... other fields
11 },
12 {
13 symbol: 'GOOGL',
14 name: 'Alphabet Inc.',
15 price: 2750.50,
16 changesPercentage: 1.85,
17 change: 50.25,
18 // ... other fields
19 },
20 {
21 symbol: 'MSFT',
22 name: 'Microsoft Corporation',
23 price: 325.75,
24 changesPercentage: 0.95,
25 change: 3.05,
26 // ... other fields
27 }
28 ]
29}
Get Historical Data
Retrieve historical price data for any asset type with flexible date ranges.
1const historicalData = await fmp.quote.getHistoricalPrice({
2 symbol: 'AAPL',
3 from: '2023-01-01',
4 to: '2023-12-31'
5});
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
symbol | string | Yes | Asset symbol |
from | string | No | Start date (YYYY-MM-DD format) |
to | string | No | End date (YYYY-MM-DD format) |
Example Response
1{
2 success: true,
3 data: {
4 symbol: 'AAPL',
5 historical: [
6 {
7 date: '2023-12-29',
8 open: 193.58,
9 high: 194.66,
10 low: 192.73,
11 close: 193.58,
12 adjClose: 193.58,
13 volume: 45678900,
14 unadjustedVolume: 45678900,
15 change: 0.00,
16 changePercent: 0.00,
17 vwap: 193.58,
18 label: 'Dec 29, 23',
19 changeOverTime: 0.00
20 },
21 {
22 date: '2023-12-28',
23 open: 192.50,
24 high: 194.20,
25 low: 191.80,
26 close: 193.58,
27 adjClose: 193.58,
28 volume: 42345600,
29 unadjustedVolume: 42345600,
30 change: 1.08,
31 changePercent: 0.56,
32 vwap: 193.15,
33 label: 'Dec 28, 23',
34 changeOverTime: 0.56
35 }
36 ]
37 }
38}
Get Intraday Data
Retrieve intraday price data with various time intervals.
1const intradayData = await fmp.quote.getIntraday({
2 symbol: 'BTCUSD',
3 interval: '5min',
4 from: '2024-01-01',
5 to: '2024-01-02'
6});
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
symbol | string | Yes | Asset symbol |
interval | string | Yes | Time interval: "1min", "5min", "15min", "30min", "1hour", "4hour" |
from | string | No | Start date (YYYY-MM-DD format) |
to | string | No | End date (YYYY-MM-DD format) |
Example Response
1{
2 success: true,
3 data: [
4 {
5 date: '2024-01-01 09:30:00',
6 open: 108000.00,
7 high: 108500.00,
8 low: 107800.00,
9 close: 108250.00,
10 volume: 1250000000
11 },
12 {
13 date: '2024-01-01 09:35:00',
14 open: 108250.00,
15 high: 108750.00,
16 low: 108200.00,
17 close: 108600.00,
18 volume: 1350000000
19 }
20 ]
21}
Migration from Legacy Endpoints
The unified quote endpoints replace the separate quote methods in individual endpoint classes. The legacy methods are deprecated and will be removed in version 0.1.0.
Before (Deprecated)
1// Stock quotes
2const stockQuote = await fmp.stock.getQuote('AAPL');
3
4// Crypto quotes
5const cryptoQuote = await fmp.crypto.getQuote('BTCUSD');
6
7// Forex quotes
8const forexQuote = await fmp.forex.getQuote('EURUSD');
After (Recommended)
1// Unified quotes for all asset types
2const stockQuote = await fmp.quote.getQuote('AAPL');
3const cryptoQuote = await fmp.quote.getQuote('BTCUSD');
4const forexQuote = await fmp.quote.getQuote('EURUSD');
TypeScript Support
The quote endpoints include full TypeScript support with unified types:
1import { Quote, HistoricalPriceResponse } from 'fmp-node-api';
2
3// Quote response type
4const quote: Quote = await fmp.quote.getQuote('AAPL');
5
6// Historical data response type
7const historical: HistoricalPriceResponse = await fmp.quote.getHistoricalPrice({
8symbol: 'BTCUSD',
9from: '2024-01-01',
10to: '2024-01-31'
11});
Error Handling
Handle errors consistently across all asset types:
1try {
2const quote = await fmp.quote.getQuote('INVALID');
3
4if (quote.success) {
5 console.log('Quote data:', quote.data);
6} else {
7 console.error('API Error:', quote.error);
8 console.error('Status:', quote.status);
9}
10} catch (error) {
11console.error('Network Error:', error);
12}
Rate Limiting
The quote endpoints respect FMP's rate limits. For high-frequency trading applications, consider implementing your own rate limiting strategy.
Examples
Portfolio Tracker
1// Track a diverse portfolio
2const portfolio = ['AAPL', 'BTCUSD', 'EURUSD', 'SPY'];
3
4const quotes = await fmp.quote.getQuotes(portfolio);
5
6quotes.data?.forEach(quote => {
7console.log(`${quote.symbol}: ${quote.price} (${quote.changesPercentage}%)`);
8});
Price Alert System
1// Monitor price changes
2const checkPrice = async (symbol: string, threshold: number) => {
3const quote = await fmp.quote.getQuote(symbol);
4
5if (quote.success && quote.data) {
6 if (quote.data.price > threshold) {
7 console.log(`${symbol} is above ${threshold}!`);
8 }
9}
10};
11
12// Check multiple assets
13await checkPrice('BTCUSD', 100000);
14await checkPrice('AAPL', 200);
Historical Analysis
1// Analyze historical performance
2const analyzePerformance = async (symbol: string) => {
3const historical = await fmp.quote.getHistoricalPrice({
4 symbol,
5 from: '2023-01-01',
6 to: '2023-12-31'
7});
8
9if (historical.success && historical.data) {
10 const prices = historical.data.historical.map(h => h.close);
11 const maxPrice = Math.max(...prices);
12 const minPrice = Math.min(...prices);
13 const avgPrice = prices.reduce((a, b) => a + b, 0) / prices.length;
14
15 console.log(`${symbol} Analysis:`);
16 console.log(`Max: ${maxPrice}`);
17 console.log(`Min: ${minPrice}`);
18 console.log(`Average: ${avgPrice.toFixed(2)}`);
19}
20};
21
22await analyzePerformance('AAPL');
Ready to get started? Check out the Getting Started Guide or explore other API endpoints.