> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pragma.build/llms.txt
> Use this file to discover all available pages before exploring further.

# Multi Stream

<Note>
  This is an SSE endpoint. Learn more about SSE [here](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events).
  You can think of SSE as an unidirectional channel from the server to the client.
  It is much more efficient than websocket to display real time data on a frontend and it is supported by most browsers as of today.
</Note>


## OpenAPI

````yaml open-apis/node.json get /node/v1/data/multi/stream
openapi: 3.1.0
info:
  title: pragma-node
  description: ''
  license:
    name: ''
  version: 0.1.0
servers:
  - url: https://{environment}.pragma.build
    variables:
      environment:
        default: api.devnet
security: []
tags:
  - name: pragma-node
    description: Pragma Node API
paths:
  /node/v1/data/multi/stream:
    get:
      tags:
        - Stream
      operationId: stream_entry_multi_pair
      parameters:
        - name: get_entry_params
          in: query
          description: >-
            Base parameters for entry requests including interval, aggregation
            mode, and routing options
          required: true
          schema:
            $ref: '#/components/schemas/GetEntryParams'
        - name: pairs[]
          in: query
          description: >-
            List of trading pairs to stream prices for (e.g. `["ETH/USD",
            "BTC/USD"]`)
          required: true
          schema:
            type: array
            items:
              type: string
          example:
            - ETH/USD
            - BTC/USD
        - name: historical_prices
          in: query
          description: >-
            Number of historical price entries to fetch on initial connection
            (default: 100)
          required: false
          schema:
            type:
              - integer
              - 'null'
            minimum: 0
          example: 100
      responses:
        '200':
          description: Server-sent events stream of price entries for multiple pairs
          content:
            text/event-stream: {}
components:
  schemas:
    GetEntryParams:
      type: object
      description: Parameters for retrieving price entries
      required:
        - timestamp
      properties:
        aggregation:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/AggregationMode'
              description: |-
                Method used to aggregate prices from multiple sources.

                # Available modes
                - `median`: Middle value (default, more manipulation resistant)
                - `mean`: Average of all values
                - `twap`: Time-Weighted Average Price
        entry_type:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/EntryType'
              description: |-
                Type of market entry to retrieve

                # Available types
                - `spot`: Spot market prices (default)
                - `perp`: Perpetual futures prices
                - `future`: Fixed-expiry futures prices
        expiry:
          type:
            - string
            - 'null'
          description: |-
            Expiry date for future contracts in ISO 8601 format.
            Only applicable when `entry_type` is "future".

            # Example
            - `"2024-12-31"`: December 31, 2024 expiry
            - `null`: Not applicable for spot/perp markets
          example: '2024-12-31'
        interval:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/Interval'
              description: >-
                Time interval for aggregated price data. Different intervals
                affect how price data is

                aggregated and can be used to get OHLC (Open/High/Low/Close)
                data at various timeframes.


                # Available intervals

                - `100ms`: 100 milliseconds - High frequency trading

                - `1s`: 1 second - Real-time trading

                - `5s`: 5 seconds - Short-term price movements

                - `1min`: 1 minute - Intraday trading

                - `15min`: 15 minutes - Medium-term analysis

                - `1h`: 1 hour - Daily trading patterns

                - `2h`: 2 hours (default) - Extended market analysis

                - `1d`: 1 day - Long-term trends

                - `1w`: 1 week - Strategic market overview
        routing:
          type:
            - boolean
            - 'null'
          description: >-
            Enable price routing through intermediate pairs.

            When true, if a direct price for the requested pair is not
            available,

            the system will attempt to calculate it using intermediate pairs.


            # Example

            For BTC/EUR when routing is enabled:

            - If direct BTC/EUR price is unavailable

            - System might route through BTC/USD and EUR/USD


            Default: true
          example: true
        timestamp:
          type: integer
          format: int64
          description: >-
            The unix timestamp in seconds to retrieve historical price data.

            This endpoint will return the first update whose timestamp is <= the
            provided value.


            If not provided, returns the latest available price.


            # Examples

            - `1_647_820_800`: Returns price data from March 21, 2022 00:00:00
            UTC

            - `null`: Returns the most recent price update


            NOTE: This only works for `median` aggregation
          example: 1647820800
        with_components:
          type:
            - boolean
            - 'null'
          description: >-
            Include source components in the response.

            When true, the response will include price data from individual
            sources.


            # Example

            - `true`: Include source breakdown in response

            - `false`: Return aggregated data only (default)
          example: false
    AggregationMode:
      type: string
      enum:
        - median
        - twap
    EntryType:
      type: string
      enum:
        - spot
        - perp
        - future
    Interval:
      type: string
      enum:
        - 100ms
        - 1s
        - 5s
        - 10s
        - 1min
        - 5min
        - 15min
        - 1h
        - 2h
        - 1d
        - 1w

````