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

# private/get_margins

> Calculates margin requirements for a hypothetical order on a given instrument. Returns initial margin and maintenance margin for the specified instrument, quantity, and price.

This method is useful for estimating margin requirements before placing an order, helping to ensure sufficient funds are available and understanding the margin impact of potential trades.

**Scope:** `rat#view` or `wallet:accounts:read`

[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fget_margins)





## OpenAPI

````yaml /api-reference/coinbase-deribit-app-api/adv-starbase-openapi.json get /private/get_margins
openapi: 3.0.0
info:
  description: Coinbase Retail Advanced Trade API for derivatives trading.
  title: Coinbase Retail Advanced Trade (Deribit) API
  version: 2.1.1
servers:
  - url: https://drb.coinbase.com/api/v2
security: []
tags:
  - description: Can only be used over websockets.
    name: WebSocket Only
  - description: Public methods can be used without authentication.
    name: Public
  - description: >-
      <p>Private methods require authentication. All requests must include a
      valid OAuth2 token.</p>

      <p>A token can be requested using the <a
      href="#public-auth">/public/auth</a> method.</p>

      <p>When using the websockets protocol, the token must be included as a
      parameter <code>access_token</code> in the message. When using REST (HTTP
      GET), the token may also be passed in the <code>Authorization</code>
      header.</p>
    name: Private
  - name: Authentication
  - name: Session Management
  - description: >-
      Subscription works as [notifications](#notifications), so users will
      automatically (after subscribing) receive messages from the server.
      Overview for each channel response format is described in
      [subscriptions](#subscriptions) section.
    name: Subscription Management
  - name: Account Management
  - name: Trading
  - name: Market Data
paths:
  /private/get_margins:
    get:
      tags:
        - Trading
        - Private
      description: >+
        Calculates margin requirements for a hypothetical order on a given
        instrument. Returns initial margin and maintenance margin for the
        specified instrument, quantity, and price.


        This method is useful for estimating margin requirements before placing
        an order, helping to ensure sufficient funds are available and
        understanding the margin impact of potential trades.


        **Scope:** `rat#view` or `wallet:accounts:read`


        [Try in API
        console](https://test.deribit.com/api_console?method=%2Fprivate%2Fget_margins)

      parameters:
        - description: Instrument name
          in: query
          name: instrument_name
          required: true
          schema:
            $ref: '#/components/schemas/instrument_name'
        - description: >-
            It represents the requested order size. For perpetual and inverse
            futures the amount is in USD units. For options and linear futures
            it is the underlying base currency coin.
          in: query
          name: amount
          required: true
          schema:
            type: number
        - description: Price
          in: query
          name: price
          required: true
          schema:
            example: 3725
            type: number
      requestBody:
        content:
          application/json:
            examples:
              request:
                description: JSON-RPC Request Example
                value:
                  id: 7
                  jsonrpc: '2.0'
                  method: private/get_margins
                  params:
                    amount: 10000
                    instrument_name: BTC-PERPETUAL
                    price: 3725
        description: JSON-RPC request body
      responses:
        '200':
          $ref: '#/components/responses/PrivateGetMarginsResponse'
components:
  schemas:
    instrument_name:
      description: Unique instrument identifier
      example: BTC-PERPETUAL
      type: string
    PrivateGetMarginsResponse:
      properties:
        id:
          description: The id that was sent in the request
          type: integer
        jsonrpc:
          description: The JSON-RPC version (2.0)
          enum:
            - '2.0'
          type: string
        result:
          properties:
            buy:
              description: Margin when buying
              example: 0.01681367
              type: number
            max_price:
              $ref: '#/components/schemas/max_price'
            min_price:
              $ref: '#/components/schemas/min_price'
            sell:
              description: Margin when selling
              example: 0.01680479
              type: number
          required:
            - buy
            - sell
            - min_price
            - max_price
          type: object
      required:
        - jsonrpc
        - result
      type: object
    max_price:
      description: >-
        The maximum price for the future. Any buy orders you submit higher than
        this price, will be clamped to this maximum.
      type: number
    min_price:
      description: >-
        The minimum price for the future. Any sell orders you submit lower than
        this price will be clamped to this minimum.
      type: number
  responses:
    PrivateGetMarginsResponse:
      content:
        application/json:
          examples:
            response:
              description: Response example
              value:
                id: 7
                jsonrpc: '2.0'
                result:
                  buy: 0.0219949
                  max_price: 3759.24
                  min_price: 3684.8
                  sell: 0
          schema:
            $ref: '#/components/schemas/PrivateGetMarginsResponse'
      description: Success response

````