Binance · Capability

Binance Margin Trading API — Trading

Binance Margin Trading API — Trading. 4 operations. Lead operation: Query margin account open orders. Self-contained Naftiko capability covering one Binance business surface.

Run with Naftiko BinanceTrading

What You Can Do

GET
Getmarginopenorders — Query margin account open orders
/v1/sapi/v1/margin/openorders
POST
Createmarginorder — Margin account new order
/v1/sapi/v1/margin/order
GET
Getmarginorder — Query margin account order
/v1/sapi/v1/margin/order
DELETE
Cancelmarginorder — Cancel margin account order
/v1/sapi/v1/margin/order

MCP Tools

query-margin-account-open-orders

Query margin account open orders

read-only idempotent
margin-account-new-order

Margin account new order

query-margin-account-order

Query margin account order

read-only idempotent
cancel-margin-account-order

Cancel margin account order

idempotent

Capability Spec

margin-trading-trading.yaml Raw ↑
naftiko: 1.0.0-alpha2
info:
  label: Binance Margin Trading API — Trading
  description: 'Binance Margin Trading API — Trading. 4 operations. Lead operation: Query margin account open orders. Self-contained
    Naftiko capability covering one Binance business surface.'
  tags:
  - Binance
  - Trading
  created: '2026-05-19'
  modified: '2026-05-19'
binds:
- namespace: env
  keys:
    BINANCE_API_KEY: BINANCE_API_KEY
capability:
  consumes:
  - type: http
    namespace: margin-trading-trading
    baseUri: https://api.binance.com
    description: Binance Margin Trading API — Trading business capability. Self-contained, no shared references.
    resources:
    - name: sapi-v1-margin-openOrders
      path: /sapi/v1/margin/openOrders
      operations:
      - name: getmarginopenorders
        method: GET
        description: Query margin account open orders
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: symbol
          in: query
          type: string
        - name: isIsolated
          in: query
          type: string
        - name: recvWindow
          in: query
          type: integer
        - name: timestamp
          in: query
          type: integer
          required: true
        - name: signature
          in: query
          type: string
          required: true
    - name: sapi-v1-margin-order
      path: /sapi/v1/margin/order
      operations:
      - name: createmarginorder
        method: POST
        description: Margin account new order
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: symbol
          in: query
          type: string
          required: true
        - name: isIsolated
          in: query
          type: string
          description: TRUE for isolated margin, FALSE for cross margin.
        - name: side
          in: query
          type: string
          required: true
        - name: type
          in: query
          type: string
          required: true
        - name: quantity
          in: query
          type: string
        - name: quoteOrderQty
          in: query
          type: string
        - name: price
          in: query
          type: string
        - name: stopPrice
          in: query
          type: string
        - name: newClientOrderId
          in: query
          type: string
        - name: newOrderRespType
          in: query
          type: string
        - name: timeInForce
          in: query
          type: string
        - name: sideEffectType
          in: query
          type: string
          description: NO_SIDE_EFFECT, MARGIN_BUY, or AUTO_REPAY.
        - name: recvWindow
          in: query
          type: integer
        - name: timestamp
          in: query
          type: integer
          required: true
        - name: signature
          in: query
          type: string
          required: true
      - name: getmarginorder
        method: GET
        description: Query margin account order
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: symbol
          in: query
          type: string
          required: true
        - name: isIsolated
          in: query
          type: string
        - name: orderId
          in: query
          type: integer
        - name: origClientOrderId
          in: query
          type: string
        - name: recvWindow
          in: query
          type: integer
        - name: timestamp
          in: query
          type: integer
          required: true
        - name: signature
          in: query
          type: string
          required: true
      - name: cancelmarginorder
        method: DELETE
        description: Cancel margin account order
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: symbol
          in: query
          type: string
          required: true
        - name: isIsolated
          in: query
          type: string
        - name: orderId
          in: query
          type: integer
        - name: origClientOrderId
          in: query
          type: string
        - name: recvWindow
          in: query
          type: integer
        - name: timestamp
          in: query
          type: integer
          required: true
        - name: signature
          in: query
          type: string
          required: true
    authentication:
      type: apikey
      key: X-MBX-APIKEY
      value: '{{env.BINANCE_API_KEY}}'
      placement: header
  exposes:
  - type: rest
    namespace: margin-trading-trading-rest
    port: 8080
    description: REST adapter for Binance Margin Trading API — Trading. One Spectral-compliant resource per consumed operation,
      prefixed with /v1.
    resources:
    - path: /v1/sapi/v1/margin/openorders
      name: sapi-v1-margin-openorders
      description: REST surface for sapi-v1-margin-openOrders.
      operations:
      - method: GET
        name: getmarginopenorders
        description: Query margin account open orders
        call: margin-trading-trading.getmarginopenorders
        with:
          symbol: rest.symbol
          isIsolated: rest.isIsolated
          recvWindow: rest.recvWindow
          timestamp: rest.timestamp
          signature: rest.signature
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/sapi/v1/margin/order
      name: sapi-v1-margin-order
      description: REST surface for sapi-v1-margin-order.
      operations:
      - method: POST
        name: createmarginorder
        description: Margin account new order
        call: margin-trading-trading.createmarginorder
        with:
          symbol: rest.symbol
          isIsolated: rest.isIsolated
          side: rest.side
          type: rest.type
          quantity: rest.quantity
          quoteOrderQty: rest.quoteOrderQty
          price: rest.price
          stopPrice: rest.stopPrice
          newClientOrderId: rest.newClientOrderId
          newOrderRespType: rest.newOrderRespType
          timeInForce: rest.timeInForce
          sideEffectType: rest.sideEffectType
          recvWindow: rest.recvWindow
          timestamp: rest.timestamp
          signature: rest.signature
        outputParameters:
        - type: object
          mapping: $.
      - method: GET
        name: getmarginorder
        description: Query margin account order
        call: margin-trading-trading.getmarginorder
        with:
          symbol: rest.symbol
          isIsolated: rest.isIsolated
          orderId: rest.orderId
          origClientOrderId: rest.origClientOrderId
          recvWindow: rest.recvWindow
          timestamp: rest.timestamp
          signature: rest.signature
        outputParameters:
        - type: object
          mapping: $.
      - method: DELETE
        name: cancelmarginorder
        description: Cancel margin account order
        call: margin-trading-trading.cancelmarginorder
        with:
          symbol: rest.symbol
          isIsolated: rest.isIsolated
          orderId: rest.orderId
          origClientOrderId: rest.origClientOrderId
          recvWindow: rest.recvWindow
          timestamp: rest.timestamp
          signature: rest.signature
        outputParameters:
        - type: object
          mapping: $.
  - type: mcp
    namespace: margin-trading-trading-mcp
    port: 9090
    transport: http
    description: MCP adapter for Binance Margin Trading API — Trading. One tool per consumed operation, routed inline through
      this capability's consumes block.
    tools:
    - name: query-margin-account-open-orders
      description: Query margin account open orders
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: margin-trading-trading.getmarginopenorders
      with:
        symbol: tools.symbol
        isIsolated: tools.isIsolated
        recvWindow: tools.recvWindow
        timestamp: tools.timestamp
        signature: tools.signature
      outputParameters:
      - type: object
        mapping: $.
    - name: margin-account-new-order
      description: Margin account new order
      hints:
        readOnly: false
        destructive: false
        idempotent: false
      call: margin-trading-trading.createmarginorder
      with:
        symbol: tools.symbol
        isIsolated: tools.isIsolated
        side: tools.side
        type: tools.type
        quantity: tools.quantity
        quoteOrderQty: tools.quoteOrderQty
        price: tools.price
        stopPrice: tools.stopPrice
        newClientOrderId: tools.newClientOrderId
        newOrderRespType: tools.newOrderRespType
        timeInForce: tools.timeInForce
        sideEffectType: tools.sideEffectType
        recvWindow: tools.recvWindow
        timestamp: tools.timestamp
        signature: tools.signature
      outputParameters:
      - type: object
        mapping: $.
    - name: query-margin-account-order
      description: Query margin account order
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: margin-trading-trading.getmarginorder
      with:
        symbol: tools.symbol
        isIsolated: tools.isIsolated
        orderId: tools.orderId
        origClientOrderId: tools.origClientOrderId
        recvWindow: tools.recvWindow
        timestamp: tools.timestamp
        signature: tools.signature
      outputParameters:
      - type: object
        mapping: $.
    - name: cancel-margin-account-order
      description: Cancel margin account order
      hints:
        readOnly: false
        destructive: true
        idempotent: true
      call: margin-trading-trading.cancelmarginorder
      with:
        symbol: tools.symbol
        isIsolated: tools.isIsolated
        orderId: tools.orderId
        origClientOrderId: tools.origClientOrderId
        recvWindow: tools.recvWindow
        timestamp: tools.timestamp
        signature: tools.signature
      outputParameters:
      - type: object
        mapping: $.