Market Data API

Get real-time and historical market data including quotes, price history, and detailed chart information with technical indicators.

Available Endpoints

Real-Time Quotes

Get current market data for any stock symbol.
GET /api/quote/{symbol}
Example Request:
curl -X GET "https://api.financialcontext.com/api/quote/AAPL" \
  -H "X-API-Key: your-api-key"
Response:
{
  "success": true,
  "data": {
    "symbol": "AAPL",
    "price": 185.50,
    "change": 2.30,
    "changePercent": 1.26,
    "volume": 45678900,
    "marketCap": 2890000000000,
    "pe": 28.5,
    "high52Week": 199.62,
    "low52Week": 124.17,
    "dayHigh": 186.25,
    "dayLow": 183.10,
    "timestamp": "2024-01-15T16:00:00Z"
  }
}

Combined Quotes

Get quotes for multiple symbols in a single request.
GET /api/quote-combine?symbols=AAPL,MSFT,GOOGL
Example Request:
curl -X GET "https://api.financialcontext.com/api/quote-combine?symbols=AAPL,MSFT,GOOGL" \
  -H "X-API-Key: your-api-key"

Historical Data

Get historical price data with customizable date ranges and intervals.
GET /api/historical/{symbol}
Query Parameters:
  • from: Start date (YYYY-MM-DD)
  • to: End date (YYYY-MM-DD)
  • interval: Data interval (1d, 1wk, 1mo)
Example Request:
curl -X GET "https://api.financialcontext.com/api/historical/AAPL?from=2024-01-01&to=2024-01-31&interval=1d" \
  -H "X-API-Key: your-api-key"
Response:
{
  "success": true,
  "data": {
    "symbol": "AAPL",
    "interval": "1d",
    "prices": [
      {
        "date": "2024-01-02",
        "open": 187.15,
        "high": 188.44,
        "low": 183.89,
        "close": 185.64,
        "volume": 37149570,
        "adjClose": 185.64
      }
    ]
  }
}

Chart Data

Get detailed chart data with technical indicators and customizable timeframes.
GET /api/chart/{symbol}
Query Parameters:
  • interval: Chart interval (1m, 5m, 15m, 30m, 1h, 1d)
  • range: Chart range (1d, 5d, 1mo, 3mo, 6mo, 1y, 2y, 5y)
  • indicators: Comma-separated technical indicators
  • includePrePost: Include pre/post market data (true/false)
Example Request:
curl -X GET "https://api.financialcontext.com/api/chart/AAPL?interval=1d&range=1mo&indicators=sma,ema" \
  -H "X-API-Key: your-api-key"

Market Data Types

Quote Data

  • Price: Current trading price
  • Change: Price change from previous close
  • Volume: Number of shares traded
  • Market Cap: Total market capitalization
  • P/E Ratio: Price-to-earnings ratio
  • 52-Week Range: Highest and lowest prices in the past year

Historical Data

  • OHLCV: Open, High, Low, Close, Volume data
  • Adjusted Close: Price adjusted for splits and dividends
  • Multiple Intervals: Daily, weekly, monthly data
  • Extended History: Up to 20 years of data

Chart Indicators

  • Moving Averages: SMA, EMA, WMA
  • Momentum: RSI, MACD, Stochastic
  • Volatility: Bollinger Bands, ATR
  • Volume: Volume SMA, OBV

Use Cases

Trading Applications

Build trading platforms and portfolio management tools

Market Analysis

Perform technical and fundamental market analysis

Price Alerts

Create price monitoring and alert systems

Backtesting

Test trading strategies with historical data

Real-Time vs Delayed Data

Data TypeDelayUpdate FrequencyUse Case
Real-Time0msLiveActive trading, alerts
Near Real-Time15minContinuousAnalysis, monitoring
End-of-Day1 dayDailyResearch, backtesting

Example Implementation

class MarketDataClient {
  constructor(apiKey) {
    this.apiKey = apiKey;
    this.baseUrl = 'https://api.financialcontext.com';
  }

  async getQuote(symbol) {
    const response = await fetch(`${this.baseUrl}/api/quote/${symbol}`, {
      headers: { 'X-API-Key': this.apiKey }
    });
    return response.json();
  }

  async getHistoricalData(symbol, options = {}) {
    const params = new URLSearchParams(options);
    const response = await fetch(
      `${this.baseUrl}/api/historical/${symbol}?${params}`,
      { headers: { 'X-API-Key': this.apiKey } }
    );
    return response.json();
  }

  async getMultipleQuotes(symbols) {
    const symbolsParam = symbols.join(',');
    const response = await fetch(
      `${this.baseUrl}/api/quote-combine?symbols=${symbolsParam}`,
      { headers: { 'X-API-Key': this.apiKey } }
    );
    return response.json();
  }
}

// Usage
const client = new MarketDataClient('your-api-key');

// Get single quote
const quote = await client.getQuote('AAPL');
console.log(`AAPL: $${quote.data.price}`);

// Get historical data
const history = await client.getHistoricalData('AAPL', {
  from: '2024-01-01',
  to: '2024-01-31',
  interval: '1d'
});

Data Quality & Coverage

  • Exchanges: NYSE, NASDAQ, AMEX, and major international exchanges
  • Asset Classes: Stocks, ETFs, indices
  • Update Frequency: Real-time during market hours
  • Historical Coverage: Up to 20 years of daily data
  • Data Sources: Multiple tier-1 market data providers
Market data is subject to exchange fees and licensing agreements. Real-time data requires appropriate subscription levels.
Always implement proper error handling and rate limiting when consuming market data APIs in production applications.