QuantJourney
Quant Journey Documentation
Main Site

Market Data API

Access real-time and historical market data for stocks, forex, crypto, and commodities

Market Data API

The Market Data API provides access to real-time and historical market data across multiple asset classes including stocks, forex, cryptocurrency, and commodities.

Authentication

All market data endpoints require authentication. Include your API key in the Authorization header:

Authorization: Bearer YOUR_API_KEY

Base URL

https://api.quantjourney.com/v2/market-data

Rate Limits

TierRequests/HourReal-time Updates
Free1,000
Pro10,000
EnterpriseUnlimited

Stock Market Data

Get Stock Quote

Retrieve the latest quote for a specific stock symbol.

GET /market-data/stocks/{symbol}/quote

Parameters

ParameterTypeRequiredDescription
symbolstringStock symbol (e.g., AAPL, TSLA)

Example Request

curl -H "Authorization: Bearer YOUR_API_KEY" \
  "https://api.quantjourney.com/v2/market-data/stocks/AAPL/quote"

Example Response

{
  "symbol": "AAPL",
  "name": "Apple Inc.",
  "price": 182.52,
  "change": 1.84,
  "change_percent": 1.02,
  "volume": 45234567,
  "market_cap": 2847392847392,
  "pe_ratio": 28.4,
  "day_high": 183.91,
  "day_low": 180.12,
  "week_52_high": 198.23,
  "week_52_low": 124.17,
  "timestamp": "2024-12-20T21:00:00Z",
  "market_status": "closed"
}

Get Historical Data

Retrieve historical price data for a stock symbol.

GET /market-data/stocks/{symbol}/history

Parameters

ParameterTypeRequiredDefaultDescription
symbolstring-Stock symbol
periodstring1moTime period (1d, 5d, 1mo, 3mo, 6mo, 1y, 2y, 5y, 10y, ytd, max)
intervalstring1dData interval (1m, 2m, 5m, 15m, 30m, 60m, 90m, 1h, 1d, 5d, 1wk, 1mo, 3mo)
adjustbooleantrueWhether to adjust for splits and dividends

Example Request

curl -H "Authorization: Bearer YOUR_API_KEY" \
  "https://api.quantjourney.com/v2/market-data/stocks/AAPL/history?period=1mo&interval=1d"

Example Response

{
  "symbol": "AAPL",
  "period": "1mo",
  "interval": "1d",
  "data": [
    {
      "timestamp": "2024-11-20T14:30:00Z",
      "open": 180.25,
      "high": 182.91,
      "low": 179.87,
      "close": 182.52,
      "volume": 45234567,
      "adj_close": 182.52
    },
    {
      "timestamp": "2024-11-21T14:30:00Z",
      "open": 182.52,
      "high": 184.15,
      "low": 181.23,
      "close": 183.47,
      "volume": 38291847,
      "adj_close": 183.47
    }
  ],
  "meta": {
    "currency": "USD",
    "exchange": "NASDAQ",
    "exchange_timezone": "America/New_York",
    "total_records": 22
  }
}

Get Multiple Quotes

Retrieve quotes for multiple stocks in a single request.

POST /market-data/stocks/quotes

Request Body

{
  "symbols": ["AAPL", "GOOGL", "MSFT", "TSLA"],
  "fields": ["price", "change", "change_percent", "volume"]
}

Example Response

{
  "quotes": {
    "AAPL": {
      "symbol": "AAPL",
      "price": 182.52,
      "change": 1.84,
      "change_percent": 1.02,
      "volume": 45234567
    },
    "GOOGL": {
      "symbol": "GOOGL", 
      "price": 2847.39,
      "change": -12.84,
      "change_percent": -0.45,
      "volume": 1923847
    }
  },
  "timestamp": "2024-12-20T21:00:00Z"
}

Cryptocurrency Data

Get Crypto Quote

GET /market-data/crypto/{symbol}/quote

Parameters

ParameterTypeRequiredDescription
symbolstringCrypto symbol (e.g., BTC, ETH, ADA)
vs_currencystringQuote currency (default: USD)

Example Request

curl -H "Authorization: Bearer YOUR_API_KEY" \
  "https://api.quantjourney.com/v2/market-data/crypto/BTC/quote?vs_currency=USD"

Example Response

{
  "symbol": "BTC",
  "name": "Bitcoin",
  "price": 42847.92,
  "change_24h": 1247.83,
  "change_percent_24h": 3.01,
  "volume_24h": 23847293847,
  "market_cap": 847293847293,
  "circulating_supply": 19789234,
  "total_supply": 21000000,
  "ath": 69045.22,
  "ath_date": "2021-11-10T14:24:00Z",
  "timestamp": "2024-12-20T21:00:00Z"
}

Forex Data

Get Currency Quote

GET /market-data/forex/{pair}/quote

Parameters

ParameterTypeRequiredDescription
pairstringCurrency pair (e.g., EURUSD, GBPJPY)

Example Request

curl -H "Authorization: Bearer YOUR_API_KEY" \
  "https://api.quantjourney.com/v2/market-data/forex/EURUSD/quote"

Example Response

{
  "pair": "EURUSD",
  "bid": 1.0847,
  "ask": 1.0849,
  "spread": 0.0002,
  "change_24h": 0.0012,
  "change_percent_24h": 0.11,
  "timestamp": "2024-12-20T21:00:00Z"
}

Options Data

Get Options Chain

GET /market-data/options/{symbol}/chain

Parameters

ParameterTypeRequiredDescription
symbolstringUnderlying symbol
expirationstringExpiration date (YYYY-MM-DD)
strikenumberStrike price filter
option_typestringcall, put, or both (default)

Example Request

curl -H "Authorization: Bearer YOUR_API_KEY" \
  "https://api.quantjourney.com/v2/market-data/options/AAPL/chain?expiration=2024-01-19"

Example Response

{
  "symbol": "AAPL",
  "expiration": "2024-01-19",
  "calls": [
    {
      "strike": 180.0,
      "last_price": 5.45,
      "bid": 5.30,
      "ask": 5.60,
      "volume": 2847,
      "open_interest": 15847,
      "implied_volatility": 0.234,
      "delta": 0.67,
      "gamma": 0.023,
      "theta": -0.045,
      "vega": 0.18
    }
  ],
  "puts": [
    {
      "strike": 180.0,
      "last_price": 2.15,
      "bid": 2.05,
      "ask": 2.25,
      "volume": 1923,
      "open_interest": 8472,
      "implied_volatility": 0.198,
      "delta": -0.33,
      "gamma": 0.023,
      "theta": -0.032,
      "vega": 0.18
    }
  ]
}

Technical Indicators

Get Technical Analysis

GET /market-data/stocks/{symbol}/indicators

Parameters

ParameterTypeRequiredDescription
symbolstringStock symbol
indicatorsstringComma-separated list of indicators
periodintegerPeriod for calculation (default: 14)

Available Indicators

  • sma - Simple Moving Average
  • ema - Exponential Moving Average
  • rsi - Relative Strength Index
  • macd - MACD
  • bollinger - Bollinger Bands
  • stoch - Stochastic Oscillator

Example Request

curl -H "Authorization: Bearer YOUR_API_KEY" \
  "https://api.quantjourney.com/v2/market-data/stocks/AAPL/indicators?indicators=sma,rsi,macd&period=14"

Example Response

{
  "symbol": "AAPL",
  "indicators": {
    "sma": {
      "value": 178.92,
      "period": 14
    },
    "rsi": {
      "value": 67.34,
      "period": 14,
      "signal": "neutral"
    },
    "macd": {
      "macd": 2.47,
      "signal": 1.83,
      "histogram": 0.64,
      "signal": "bullish"
    }
  },
  "timestamp": "2024-12-20T21:00:00Z"
}

Error Handling

The API uses standard HTTP status codes and returns detailed error information:

Error Response Format

{
  "error": {
    "code": "SYMBOL_NOT_FOUND",
    "message": "The requested symbol 'INVALID' was not found",
    "details": {
      "symbol": "INVALID",
      "suggestion": "Did you mean 'NVDA'?"
    }
  },
  "timestamp": "2024-12-20T21:00:00Z"
}

Common Error Codes

CodeStatusDescription
INVALID_API_KEY401API key is missing or invalid
RATE_LIMIT_EXCEEDED429Too many requests
SYMBOL_NOT_FOUND404Symbol not found
INVALID_PARAMETERS400Invalid request parameters
MARKET_CLOSED400Requested operation not available when market is closed

WebSocket Real-time Data

For real-time streaming data, use our WebSocket API:

const ws = new WebSocket('wss://ws.quantjourney.com/v2/market-data');

ws.on('open', function() {
  // Subscribe to real-time quotes
  ws.send(JSON.stringify({
    action: 'subscribe',
    channel: 'quotes',
    symbols: ['AAPL', 'GOOGL', 'MSFT']
  }));
});

ws.on('message', function(data) {
  const quote = JSON.parse(data);
  console.log(`${quote.symbol}: $${quote.price}`);
});

For more details, see the WebSocket Streams Guide.


SDKs and Libraries

Python

from quantjourney import QuantJourney

client = QuantJourney(api_key="your_api_key")

# Get quote
quote = client.get_stock_quote("AAPL")
print(f"AAPL: ${quote.price}")

# Get historical data
history = client.get_stock_history("AAPL", period="1mo")
for day in history:
    print(f"{day.date}: ${day.close}")

JavaScript

const { QuantJourney } = require('@quantjourney/sdk');

const client = new QuantJourney({ apiKey: 'your_api_key' });

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

// Get multiple quotes
const quotes = await client.getMultipleQuotes(['AAPL', 'GOOGL', 'MSFT']);
quotes.forEach(quote => {
  console.log(`${quote.symbol}: $${quote.price}`);
});

For complete SDK documentation, visit our SDK Reference.


Need Help?