> ## 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.

# GetMarkets

> Returns the full configuration for every active market, ordered by
 `market_id` ascending.



## OpenAPI

````yaml /developers/api-reference/openapi.yaml post /market_service.v1.MarketService/GetMarkets
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:
  /market_service.v1.MarketService/GetMarkets:
    post:
      tags:
        - Markets
      summary: GetMarkets
      description: |-
        Returns the full configuration for every active market, ordered by
         `market_id` ascending.
      operationId: market_service.v1.MarketService.GetMarkets
      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/google.protobuf.Empty'
        required: true
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/market_service.v1.GetMarketsResponse'
              example:
                markets:
                  - marketId: '1'
                    marketName: BTC-PERP
                    minLeverage: 1
                    maxLeverage: 20
                    minTradeSize: 10
                    maxTradeSize: 500000
                    tickDecimals: 1
                    lotSize: 0.0001
                    sizeDecimals: 8
                    creator: '0x71c7656ec7ab88b098defb751b7401b5f6d8976'
                    feeConfig:
                      marketId: '1'
                      tradeFeePct: 45
                      maxEntitlement: 500
                      insuranceFundEntitlementPct: 20
                      maxImbalance: 100000
                    adlConfig:
                      maintenanceMarginRatio: 50
                      seizureThreshold: 66
                      adlThreshold: 10
                      shockFactor: 1
                      maxIfFractionAllowed: 10
                    maintenanceMarginRate: '50'
                    tradeFeePct: 45
                    longRevenue: 1234.5
                    shortRevenue: 987.6
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
    google.protobuf.Empty:
      type: object
      description: |-
        A generic empty message that you can re-use to avoid defining duplicated
         empty messages in your APIs. A typical example is to use it as the request
         or the response type of an API method. For instance:
             service Foo {
               rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
             }
    market_service.v1.GetMarketsResponse:
      type: object
      properties:
        markets:
          type: array
          items:
            $ref: '#/components/schemas/base_objects.v1.MarketConfig'
          title: markets
          description: >-
            Every active market's configuration, ordered by `market_id`
            ascending.
      title: GetMarketsResponse
      additionalProperties: false
    base_objects.v1.MarketConfig:
      type: object
      properties:
        marketId:
          type: string
          title: market_id
          format: int64
          description: On-chain market identifier.
        marketName:
          type: string
          title: market_name
          description: Human-readable market name, such as `BTC-PERP`.
        minLeverage:
          type: number
          title: min_leverage
          format: float
          description: >-
            Minimum leverage multiplier allowed when opening a position in this
            market.
        maxLeverage:
          type: number
          title: max_leverage
          format: float
          description: >-
            Maximum leverage multiplier allowed when opening a position in this
            market.
        minTradeSize:
          type: number
          title: min_trade_size
          format: float
          description: >-
            Minimum position notional allowed when opening a position in this
            market, in quote asset units.
        maxTradeSize:
          type: number
          title: max_trade_size
          format: float
          description: >-
            Maximum position notional allowed when opening a position in this
            market, in quote asset units.
        tickDecimals:
          type: integer
          title: tick_decimals
          description: >-
            Number of decimal places used to convert this market's raw on-chain
            prices to quote asset values.
        lotSize:
          type: number
          title: lot_size
          format: float
          description: >-
            Minimum position-size increment for this market, in the underlying
            asset's units.
        sizeDecimals:
          type: integer
          title: size_decimals
          description: >-
            Number of decimal places used to convert this market's raw on-chain
            size values to asset units.
        creator:
          type: string
          title: creator
          description: Address that created this market.
        feeConfig:
          $ref: '#/components/schemas/base_objects.v1.FeeConfig'
          title: fee_config
          description: Fee parameters for this market.
        adlConfig:
          $ref: '#/components/schemas/base_objects.v1.ADLConfig'
          title: adl_config
          description: ADL and liquidation threshold parameters for this market.
        maintenanceMarginRate:
          type: string
          title: maintenance_margin_rate
          description: |-
            Raw configured maintenance margin rate as a whole-number
            percentage string (e.g. `"50"` = 50%).
        tradeFeePct:
          type:
            - integer
            - 'null'
          title: trade_fee_pct
          description: |-
            Same value as `feeConfig.tradeFeePct`, kept for backwards
            compatibility.
        longRevenue:
          type:
            - number
            - 'null'
          title: long_revenue
          format: float
          description: |-
            Cumulative per-unit revenue accrued to long positions in this
            market
        shortRevenue:
          type:
            - number
            - 'null'
          title: short_revenue
          format: float
          description: |-
            Cumulative per-unit revenue accrued to short positions in this
            market
      title: MarketConfig
      additionalProperties: false
    base_objects.v1.FeeConfig:
      type: object
      properties:
        marketId:
          type: string
          title: market_id
          format: int64
          description: On-chain Market ID
        tradeFeePct:
          type: number
          title: tradeFeePct
          format: float
          description: Market Fee in basis points.
        maxEntitlement:
          type: number
          title: maxEntitlement
          format: float
          description: Max Entitlement percentage with 2 decimals (5 = 0.05%, 500 = 5%)
        insuranceFundEntitlementPct:
          type: number
          title: insuranceFundEntitlementPct
          format: float
          description: >-
            Insurance Fund Entitlement percentage with 2 decimals (5 = 0.05%,
            500 = 5%)
        maxImbalance:
          type: number
          title: maxImbalance
          format: float
          description: Max Imbalance allowed in quote asset terms
      title: FeeConfig
      additionalProperties: false
    base_objects.v1.ADLConfig:
      type: object
      properties:
        maintenanceMarginRatio:
          type: number
          title: maintenance_margin_ratio
          format: float
          description: |-
            Maintenance margin ratio as a whole-number percentage (e.g. `50`
            = 50%)
        seizureThreshold:
          type: number
          title: seizure_threshold
          format: float
          description: |-
            Margin-ratio threshold below which a position becomes eligible
            for seizure, as a whole-number percentage (e.g. `66` ≈ 2/3 =
            66%)
        adlThreshold:
          type: number
          title: adl_threshold
          format: float
          description: |-
            Margin-ratio threshold below which a position is scanned for
            ADL, as a whole-number percentage (e.g. `10` = 10%)
        shockFactor:
          type: number
          title: shock_factor
          format: float
          description: |-
            Shock factor used in ADL shock-test simulations, as a
            whole-number percentage
        maxIfFractionAllowed:
          type: number
          title: max_if_fraction_allowed
          format: float
          description: |-
            Maximum fraction of the insurance fund allowed to be spent on
            this market's close-outs, as a whole-number percentage
      title: ADLConfig
      additionalProperties: false
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````