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

# Place market order

> Prepare a market order on a global markets perps market.

Returns EIP-712 typed data for the user to sign. After signing, submit
the signature via the /execute endpoint. Executes as an IOC order at the
current mark price with slippage protection.



## OpenAPI

````yaml /v2/combined_spec.json post /v2/global_markets_perps/market_order
openapi: 3.1.0
info:
  title: Compass API
  description: Compass Labs DeFi API
  version: 0.0.1
servers:
  - url: https://api.compasslabs.ai
    description: Production server
security:
  - ApiKeyAuth: []
paths:
  /v2/global_markets_perps/market_order:
    post:
      tags:
        - Global Markets Perps
      summary: Place market order
      description: |-
        Prepare a market order on a global markets perps market.

        Returns EIP-712 typed data for the user to sign. After signing, submit
        the signature via the /execute endpoint. Executes as an IOC order at the
        current mark price with slippage protection.
      operationId: v2_global_markets_perps_market_order
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GlobalMarketsPerpsMarketOrderRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GlobalMarketsPerpsSignableActionResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      x-codeSamples:
        - lang: python
          label: Python (SDK)
          source: |-
            from compass_api_sdk import CompassAPI


            with CompassAPI(
                api_key_auth="<YOUR_API_KEY_HERE>",
            ) as compass_api:

                res = compass_api.global_markets_perps.global_markets_perps_market_order(owner="0x06A9aF046187895AcFc7258450B15397CAc67400", asset="AAPL", side="buy", size="10.0", slippage_percent=1, reduce_only=False)

                # Handle response
                print(res)
        - lang: typescript
          label: Typescript (SDK)
          source: |-
            import { CompassApiSDK } from "@compass-labs/api-sdk";

            const compassApiSDK = new CompassApiSDK({
              apiKeyAuth: "<YOUR_API_KEY_HERE>",
            });

            async function run() {
              const result = await compassApiSDK.globalMarketsPerps.globalMarketsPerpsMarketOrder({
                owner: "0x06A9aF046187895AcFc7258450B15397CAc67400",
                asset: "AAPL",
                side: "buy",
                size: "10.0",
                slippagePercent: 1,
                reduceOnly: false,
              });

              console.log(result);
            }

            run();
components:
  schemas:
    GlobalMarketsPerpsMarketOrderRequest:
      properties:
        owner:
          type: string
          title: Owner
          description: Owner of the global markets perps product account
          default: '0x06A9aF046187895AcFc7258450B15397CAc67400'
          examples:
            - '0x06A9aF046187895AcFc7258450B15397CAc67400'
        asset:
          type: string
          title: Asset
          description: Asset ticker symbol (e.g. AAPL, GOLD, EUR)
          default: AAPL
          examples:
            - AAPL
        side:
          type: string
          title: Side
          description: 'Order side: ''buy'' or ''sell'''
          default: buy
          examples:
            - buy
        size:
          type: string
          title: Size
          description: Number of contracts (human-readable)
          default: '10.0'
          examples:
            - '10.0'
        slippage_percent:
          type: number
          maximum: 100
          minimum: 0
          title: Slippage Percent
          description: Max slippage percentage for price protection
          default: 1
          examples:
            - 1
        reduce_only:
          type: boolean
          title: Reduce Only
          description: If true, order can only reduce an existing position
          default: false
          examples:
            - false
        builder:
          anyOf:
            - $ref: '#/components/schemas/Builder'
            - type: 'null'
          description: >-
            Optional builder fee. When provided, the order action carries the
            builder address and fee — the end-user must have already approved
            this builder via /approve_builder_fee up to at least this rate. Omit
            (or pass null) to place the order with no builder fee.
      type: object
      required:
        - owner
        - asset
        - side
        - size
      title: GlobalMarketsPerpsMarketOrderRequest
      description: Request to place a market order on a global markets perps market.
      default:
        owner: '0x06A9aF046187895AcFc7258450B15397CAc67400'
        asset: AAPL
        side: buy
        size: '10.0'
        slippage_percent: 1
        reduce_only: false
    GlobalMarketsPerpsSignableActionResponse:
      properties:
        typed_data:
          additionalProperties: true
          type: object
          title: Typed Data
          description: >-
            EIP-712 typed data for wallet signing (domain, types, primaryType,
            message)
        action:
          additionalProperties: true
          type: object
          title: Action
          description: Raw Hyperliquid action (passed back to the execute endpoint)
        nonce:
          type: integer
          title: Nonce
          description: Timestamp-based nonce used during signing
      type: object
      required:
        - typed_data
        - action
        - nonce
      title: GlobalMarketsPerpsSignableActionResponse
      description: >-
        Returned by prepare endpoints — contains EIP-712 typed data for the user
        to sign.
      example:
        action:
          grouping: na
          orders:
            - a: 12
              b: true
              p: '213.50'
              r: false
              s: '5.00'
              t:
                limit:
                  tif: Gtc
          type: order
        nonce: 1747010983250
        typed_data:
          domain:
            chainId: 1337
            name: Exchange
            verifyingContract: '0x0000000000000000000000000000000000000000'
            version: '1'
          message:
            connectionId: '0xc4e1f04d6b1bf2f2f7a6c0e8a5f3b1d2c9e0a4b7d1c3e5f7a9b1d3e5f7a9e9a2'
            source: a
          primaryType: Agent
          types:
            Agent:
              - name: source
                type: string
              - name: connectionId
                type: bytes32
            EIP712Domain:
              - name: name
                type: string
              - name: version
                type: string
              - name: chainId
                type: uint256
              - name: verifyingContract
                type: address
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    Builder:
      properties:
        address:
          type: string
          title: Address
          description: >-
            Builder address that receives the fee. The address must hold ≥100
            USDC on Hyperliquid perps and must not be the zero address.
        max_fee_rate:
          type: string
          title: Max Fee Rate
          description: >-
            Maximum fee rate the end-user authorizes for this builder, in
            Hyperliquid grammar (e.g. '0.01%'). Must end with '%' and parse to a
            value in [0, 100].
      type: object
      required:
        - address
        - max_fee_rate
      title: Builder
      description: Builder address + max fee rate the end-user authorizes.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        Your Compass API Key. Get your key
        [here](https://www.compasslabs.ai/dashboard).

````