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

# Get Market State

> Get detailed market state for a specific account and instrument



## OpenAPI

````yaml POST /api/v1/hosts/query/GetAccountMarketState
openapi: 3.1.0
info:
  title: Plurex Platform API
  description: >
    Plurex Platform API uses a Command & Query Separation (CQS) architecture.

    All state-changing operations are 'commands' and read-only operations are
    'queries'.

    Both use HTTP POST with JSON payloads.

    No conformity to REST, all inputs are in the body of the request.
  version: 1.0.0
servers:
  - url: https://api.plurex.io
    description: Production server
security:
  - ApiKeyAuth: []
    ApiSecretAuth: []
paths:
  /api/v1/hosts/query/GetAccountMarketState:
    post:
      tags:
        - Hosts
      summary: Get detailed market state for a specific account and instrument
      operationId: getAccountMarketState
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GetAccountMarketStateQuery'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/BaseSuccessResponseEnvelope'
                  - type: object
                    properties:
                      data:
                        $ref: '#/components/schemas/AccountMarketState'
components:
  schemas:
    GetAccountMarketStateQuery:
      type: object
      required:
        - accountId
        - instrument
      properties:
        accountId:
          type: string
        instrument:
          $ref: '#/components/schemas/Instrument'
    BaseSuccessResponseEnvelope:
      allOf:
        - $ref: '#/components/schemas/BaseResponse'
        - type: object
          required:
            - data
          properties:
            data:
              type: object
              description: The actual payload of the successful response.
    AccountMarketState:
      type: object
      required:
        - type
        - instrument
      properties:
        type:
          type: string
          description: The discriminator for market state types.
        instrument:
          $ref: '#/components/schemas/Instrument'
      discriminator:
        propertyName: type
        mapping:
          Perp:
            $ref: '#/components/schemas/AccountMarketStatePerp'
          SpotSimple:
            $ref: '#/components/schemas/AccountMarketStateSpotSimple'
          SpotMargined:
            $ref: '#/components/schemas/AccountMarketStateSpotMargined'
      oneOf:
        - $ref: '#/components/schemas/AccountMarketStatePerp'
        - $ref: '#/components/schemas/AccountMarketStateSpotSimple'
        - $ref: '#/components/schemas/AccountMarketStateSpotMargined'
    Instrument:
      type: object
      properties:
        base:
          type: string
        quote:
          type: string
        marketType:
          type: string
    BaseResponse:
      type: object
      required:
        - traceId
        - serverTime
      properties:
        traceId:
          type: string
          format: uuid
          description: Unique identifier for tracing.
        serverTime:
          type: string
          format: date-time
          description: RFC3339 timestamp of processing.
        warnings:
          type: array
          items:
            type: string
    AccountMarketStatePerp:
      type: object
      required:
        - type
        - instrument
        - currentLeverageSetting
        - collateral
        - position
      properties:
        type:
          type: string
          enum:
            - Perp
        instrument:
          $ref: '#/components/schemas/Instrument'
        currentLeverageSetting:
          $ref: '#/components/schemas/MarketLeverageSetting'
        collateral:
          $ref: '#/components/schemas/CollateralBasic'
        position:
          $ref: '#/components/schemas/MarketPosition'
    AccountMarketStateSpotSimple:
      type: object
      required:
        - type
        - instrument
        - base
        - quote
      properties:
        type:
          type: string
          enum:
            - SpotSimple
        instrument:
          $ref: '#/components/schemas/Instrument'
        base:
          $ref: '#/components/schemas/AssetBalance'
        quote:
          $ref: '#/components/schemas/AssetBalance'
    AccountMarketStateSpotMargined:
      type: object
      required:
        - type
        - instrument
        - currentLeverageSetting
        - collateral
        - base
        - quote
      properties:
        type:
          type: string
          enum:
            - SpotMargined
        instrument:
          $ref: '#/components/schemas/Instrument'
        currentLeverageSetting:
          $ref: '#/components/schemas/MarketLeverageSetting'
        collateral:
          $ref: '#/components/schemas/CollateralBasic'
        base:
          $ref: '#/components/schemas/AssetBalance'
        quote:
          $ref: '#/components/schemas/AssetBalance'
    MarketLeverageSetting:
      type: object
      required:
        - type
      properties:
        type:
          type: string
          description: The discriminator for leverage setting types.
      discriminator:
        propertyName: type
        mapping:
          Leveraged:
            $ref: '#/components/schemas/MarketLeverageSettingLeveraged'
          NoMarketSettings:
            $ref: '#/components/schemas/MarketLeverageSettingNoMarketSettings'
          Disabled:
            $ref: '#/components/schemas/MarketLeverageSettingDisabled'
          Unknown:
            $ref: '#/components/schemas/MarketLeverageSettingUnknown'
      oneOf:
        - $ref: '#/components/schemas/MarketLeverageSettingLeveraged'
        - $ref: '#/components/schemas/MarketLeverageSettingNoMarketSettings'
        - $ref: '#/components/schemas/MarketLeverageSettingDisabled'
        - $ref: '#/components/schemas/MarketLeverageSettingUnknown'
    CollateralBasic:
      type: object
      required:
        - collateralValueAsset
        - total
        - available
      properties:
        collateralValueAsset:
          type: string
        total:
          $ref: '#/components/schemas/MoneyValue'
        available:
          $ref: '#/components/schemas/MoneyValue'
    MarketPosition:
      type: object
      properties:
        instrument:
          $ref: '#/components/schemas/Instrument'
        long:
          $ref: '#/components/schemas/Position'
        short:
          $ref: '#/components/schemas/Position'
        mode:
          $ref: '#/components/schemas/PositionMode'
          nullable: true
    AssetBalance:
      type: object
      required:
        - available
      properties:
        available:
          $ref: '#/components/schemas/MoneyValue'
    MarketLeverageSettingLeveraged:
      type: object
      required:
        - type
        - leverage
      properties:
        type:
          type: string
          enum:
            - Leveraged
        leverage:
          type: number
          format: double
    MarketLeverageSettingNoMarketSettings:
      type: object
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - NoMarketSettings
    MarketLeverageSettingDisabled:
      type: object
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - Disabled
    MarketLeverageSettingUnknown:
      type: object
      required:
        - type
        - message
      properties:
        type:
          type: string
          enum:
            - Unknown
        message:
          type: string
    MoneyValue:
      type: string
      description: String-encoded BigDecimal for high precision monetary values.
    Position:
      type: object
      properties:
        size:
          $ref: '#/components/schemas/MoneyValue'
        entryPrice:
          $ref: '#/components/schemas/MoneyValue'
          nullable: true
    PositionMode:
      type: string
      enum:
        - TwoWay
        - OneWay
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY
    ApiSecretAuth:
      type: apiKey
      in: header
      name: X-API-SECRET

````