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

# StreamPrice

> Server-streaming endpoint. Opens a long-lived Connect/gRPC-Web stream
 and, on a fixed interval, sends one `GetPriceResponse` message per
 market in `market` (not one combined message) — requesting 3
 markets means 3 messages per tick.

 If any single market in the list fails to resolve, the
 entire stream terminates rather than skipping that market.

 `update_interval_ms` defaults to 250ms when omitted, and is clamped
 to the 100–60000ms range rather than rejected.

 NOTE: Mintlify's request-based API explorer cannot exercise a real
 streaming response.



## OpenAPI

````yaml /developers/api-reference/openapi.yaml post /price_service.v1.PriceService/StreamPrice
openapi: 3.1.0
info:
  title: Fairground.Fi API
  description: |
    API for the Fairground Perpetuals trading platform.

    This API uses ConnectRPC which accepts JSON over HTTP POST requests.
    All service endpoints follow the pattern: `/package.ServiceName/MethodName`
  version: 1.0.0
  contact:
    name: Forte Service Company
    url: https://github.com/Forte-Service-Company-Ltd/perpetuals-api-server
  license:
    name: Proprietary
    identifier: UNLICENSED
servers:
  - url: https://api.fairground.fi
    description: Production API server
security:
  - bearerAuth: []
tags:
  - name: Trades
    description: Wallet trade/fill history
  - name: Markets
    description: Market configuration and summary endpoints
  - name: Orderbook
    description: Orderbook data retrieval
  - name: Orders
    description: Order management operations
  - name: Portfolio
    description: Aggregated per-wallet portfolio data
  - name: Positions
    description: Position management operations
  - name: Prices
    description: Oracle price and historical price data
paths:
  /price_service.v1.PriceService/StreamPrice:
    post:
      tags:
        - Prices
      summary: StreamPrice
      description: |-
        Server-streaming endpoint. Opens a long-lived Connect/gRPC-Web stream
         and, on a fixed interval, sends one `GetPriceResponse` message per
         market in `market` (not one combined message) — requesting 3
         markets means 3 messages per tick.

         If any single market in the list fails to resolve, the
         entire stream terminates rather than skipping that market.

         `update_interval_ms` defaults to 250ms when omitted, and is clamped
         to the 100–60000ms range rather than rejected.

         NOTE: Mintlify's request-based API explorer cannot exercise a real
         streaming response.
      operationId: price_service.v1.PriceService.StreamPrice
      parameters:
        - name: Connect-Protocol-Version
          in: header
          required: true
          schema:
            $ref: '#/components/schemas/connect-protocol-version'
        - name: Connect-Timeout-Ms
          in: header
          schema:
            $ref: '#/components/schemas/connect-timeout-header'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/price_service.v1.StreamPriceRequest'
        required: true
      responses:
        '200':
          description: >-
            One streamed message, for one market (the server sends a sequence of
            these, not a single response).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/price_service.v1.GetPriceResponse'
              example:
                price:
                  marketId: '1'
                  marketName: BTC-PERP
                  symbol: BTC-PERP
                  price: 65420
                  volume24h: 0
                  priceChange24h: 0
                  timestamp: '2026-07-11T14:32:07Z'
                  source: ''
                signedPricePayload: null
components:
  schemas:
    connect-protocol-version:
      type: number
      title: Connect-Protocol-Version
      enum:
        - 1
      description: Define the version of the Connect protocol. If omitted, use 1.
      const: 1
      default: 1
    connect-timeout-header:
      type: number
      title: Connect-Timeout-Ms
      description: Define the timeout, in ms
    price_service.v1.StreamPriceRequest:
      type: object
      properties:
        market:
          type: array
          items:
            oneOf:
              - type: object
                title: market_id
                properties:
                  marketId:
                    type: string
                    format: int64
                    title: market_id
                required:
                  - marketId
                additionalProperties: false
              - type: object
                title: market_symbol
                properties:
                  marketSymbol:
                    $ref: '#/components/schemas/base_objects.v1.MarketSymbol'
                    title: market_symbol
                required:
                  - marketSymbol
                additionalProperties: false
          title: market
          description: |-
            Markets to stream prices for. Must be non-empty —
            one streamed message is sent per market, per tick.
        updateIntervalMs:
          type:
            - integer
            - 'null'
          title: update_interval_ms
          description: |-
            Interval between stream ticks, in milliseconds. Defaults to 250
            when omitted or zero, and is clamped to the 100–60000 range.
      title: StreamPriceRequest
      required:
        - market
      additionalProperties: false
    price_service.v1.GetPriceResponse:
      type: object
      properties:
        price:
          $ref: '#/components/schemas/base_objects.v1.Price'
          title: price
          description: Current price data for the requested market.
        signedPricePayload:
          type:
            - string
            - 'null'
          title: signed_price_payload
          description: |-
            Signed price attestation from the upstream pricing oracle,
            suitable for on-chain submission (e.g. to settle trades or
            trigger liquidations). Opaque/encoded; format is defined by the
            pricing oracle, not by this API.
      title: GetPriceResponse
      additionalProperties: false
    base_objects.v1.MarketSymbol:
      type: object
      properties:
        assetSymbol:
          type: string
          title: asset_symbol
          description: |-
            Underlying asset symbol, e.g. `"BTC"`. Matched case-insensitively
            and trimmed.
        quoteSymbol:
          type: string
          title: quote_symbol
          description: |-
            Quote symbol, e.g. `"PERP"`. Technically optional, but omitting
            it looks up a market named exactly by `assetSymbol` alone (e.g.
            `"BTC"`) rather than `"BTC-PERP"`, which will not resolve to any
            real market. In practice, always set this.
      title: MarketSymbol
      additionalProperties: false
    base_objects.v1.Price:
      type: object
      properties:
        marketId:
          type: string
          title: market_id
          format: int64
          description: On-chain market identifier.
        marketName:
          type: string
          title: market_name
          description: |-
            Same value as `symbol` on this object (both are set from
            whichever selector form the request used — see `symbol`).
        symbol:
          type: string
          title: symbol
          description: |-
            Echoes back however the market was identified in the request:
            the bare asset symbol (e.g. `"BTC"`) if the request used
            `market_symbol`, or the full market name (e.g. `"BTC-PERP"`) if
            the request used `market_id`. `marketName` always mirrors this
            same value.
        price:
          type: number
          title: price
          format: float
          description: Current price in USD.
        volume24h:
          type: number
          title: volume_24h
          format: float
          description: 24-hour trading volume in the market's quote units.
        priceChange24h:
          type: number
          title: price_change_24h
          format: float
          description: 24-hour price change, as a percentage.
        timestamp:
          $ref: '#/components/schemas/google.protobuf.Timestamp'
          title: timestamp
          description: When the price was recorded by the upstream pricing service.
        source:
          type: string
          title: source
          description: Price feed source
      title: Price
      additionalProperties: false
    google.protobuf.Timestamp:
      type: string
      examples:
        - '2023-01-15T01:30:15.01Z'
        - '2024-12-25T12:00:00Z'
      format: date-time
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````