Skip to main content
Access OHLCV (Open, High, Low, Close, Volume) candlestick data via REST API for historical queries and WebSocket for real-time streaming. Build price charts, analytics, and trading indicators with complete market data.

Overview

Monaco Protocol provides comprehensive candlestick data through two complementary methods:
  • REST API - Fetch historical candlestick data for any time range
  • WebSocket - Stream real-time candlestick updates as they form
Perfect for building live price charts, technical analysis tools, and market monitoring dashboards.

Use Cases

  • Live Price Charts - Build real-time candlestick charts with historical context
  • Technical Analysis - Calculate indicators on historical and live data
  • Market Monitoring - Track price movements across timeframes
  • Trading Bots - Analyze historical patterns and react to live price action
  • Data Export - Download historical price data for backtesting

Key Features

  • Multiple Timeframes - 1m, 5m, 15m, 1h, 4h, 1d intervals
  • Real-time Updates - Instant candlestick updates as they form
  • Multiple Subscriptions - Subscribe to multiple pairs and intervals simultaneously
  • No Authentication - OHLCV streaming is public, no login required
  • Automatic Reconnection - Built-in connection reliability
  • TypeScript Support - Fully typed candlestick interfaces

Supported Intervals

REST API Query Parameters

The candlestick REST API supports flexible querying through optional parameters that can be used independently or in combination:

Parameters

  • startTime (optional) - Unix timestamp in milliseconds (UTC) defining the beginning of the time range
  • endTime (optional) - Unix timestamp in milliseconds (UTC) defining the end of the time range
  • limit (optional) - Maximum number of candlesticks to return
    • Default: 350 bars
    • Maximum: 500 bars per request
  • priceType (optional) - Which price series to chart
    • trade (default) - the trade-derived OHLCV series
    • mark - the mark-price series, available for margin pairs only. This series is close-only: each candle’s open, high, low, and close are all the bucket’s closing mark and volume is 0. Requesting mark on a spot pair returns a 400.
    • Omit for the trade series.

Query Behavior

Time Constraints: Time parameters can be used independently—you may specify startTime only, endTime only, both together, or neither. When both are provided, startTime must be less than endTime. Time Bounds: startTime and endTime are both inclusive, and the window is absolute — no bar outside it is ever returned. A window holding fewer bars than limit comes back short rather than being padded with earlier history. Response Size: limit is a hard cap on the number of bars in the response, gap-filled bars included. When a time range contains more bars than the limit, the API returns the first limit bars from the range, enabling pagination through large datasets. Gap Filling: Buckets with no trades in them are returned as flat bars carrying the previous close, so a response has no holes. These bars count towards limit. Ordering: All candlesticks are returned in ascending chronological order (oldest to newest).

Query Patterns

Pagination

For large time ranges exceeding the 500-bar maximum, retrieve data incrementally using the timestamp of the last received candlestick:

Fetching Historical Data

Use the REST API to fetch historical candlestick data for any time range:

Common Time Ranges

Real-time OHLCV Streaming

Subscribe to live candlestick updates via WebSocket. No authentication required.

Basic Subscription

Candlestick Structure

Usage Examples

Multiple Timeframes

Subscribe to multiple intervals for the same pair:

Calculate Price Change

Building a Chart

Technical Indicators

Calculate a simple moving average:

Combining Historical + Live Data

Initialize charts with historical data, then stream live updates:

Complete Example

React Integration

Best Practices

1. Use Trading Pair IDs

2. Clean Up Subscriptions

3. Parse Prices Correctly

4. Handle Timestamps

Next Steps