Ondo Finance Fills API

The Fills API from Ondo Finance — 3 operation(s) for fills.

OpenAPI Specification

ondo-finance-fills-api-openapi.yml Raw ↑
openapi: 3.0.4
info:
  title: GM Backend Account Fills API
  description: An API spec for the Ondo GM Backend API.
  version: 1.0.0
servers:
- url: https://api.gm.ondo.finance
  description: GM Backend API
tags:
- name: Fills
paths:
  /v1/perps/fills:
    get:
      summary: Get Fills
      description: Returns a paginated list of fills for the authenticated account.
      operationId: getFills
      tags:
      - Fills
      security:
      - BearerAuth: []
      - ApiKeyAuth: []
      parameters:
      - name: market
        in: query
        description: Filter by trading market
        required: false
        schema:
          type: string
          example: AAPL-USD.P
      - name: limit
        in: query
        description: Maximum number of results to return
        required: false
        schema:
          type: integer
          example: 1000
      - name: cursor
        in: query
        description: Pagination cursor
        required: false
        schema:
          type: string
          example: NQ5WWO3THN3Q====
      - name: startTime
        in: query
        description: Filter by start time (UTC milliseconds)
        required: false
        schema:
          type: integer
          example: 1684814400000
      - name: endTime
        in: query
        description: Filter by end time (UTC milliseconds)
        required: false
        schema:
          type: integer
          example: 1672549200000
      responses:
        '200':
          description: Paginated list of fills, most recent first
          content:
            application/json:
              schema:
                allOf:
                - $ref: '#/components/schemas/GenericResponse'
                - type: object
                  properties:
                    result:
                      type: array
                      items:
                        $ref: '#/components/schemas/ApiFill'
                    pageInfo:
                      $ref: '#/components/schemas/PageInfo'
              example:
                success: true
                result:
                - id: 70a37d8f972f2494837f9dba8364cbb4
                  orderId: 197ec08e001658690721be129e7fa595
                  market: AAPL-USD.P
                  price: '227.50'
                  size: '5.00'
                  side: buy
                  direction: open long
                  filledCost: '1137.50'
                  fee: '0.57'
                  time: '2025-03-05T14:30:00Z'
                  isMaker: false
                pageInfo:
                  nextCursor: NQ5WWO3THN3Q====
        '400':
          description: Bad request. The request was malformed or failed validation.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    description: Human-readable error message
                  error_code:
                    type: string
                    enum:
                    - bad_query_param
                    - failed_to_parse_timestamp
                    - invalid_cursor
              example:
                success: false
                error: Description of the error
                error_code: bad_query_param
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /v1/perps/orders/{orderID}/fills:
    get:
      summary: Get Fills by Order ID
      description: 'Returns all fills for a given order. The `orderID` path parameter can be: - An internal order ID (e.g. `197ec08e001658690721be129e7fa595`) - A client order ID prefixed with `client:` (e.g. `client:abc123`)

        '
      operationId: getFillsByOrderID
      tags:
      - Fills
      security:
      - BearerAuth: []
      - ApiKeyAuth: []
      parameters:
      - name: orderID
        in: path
        description: Internal order ID, or `client:{clientOrderID}` for client order ID lookup
        required: true
        schema:
          type: string
          example: 197ec08e001658690721be129e7fa595
      responses:
        '200':
          description: List of fills for the order
          content:
            application/json:
              schema:
                allOf:
                - $ref: '#/components/schemas/GenericResponse'
                - type: object
                  properties:
                    result:
                      type: array
                      items:
                        $ref: '#/components/schemas/ApiFill'
              example:
                success: true
                result:
                - id: 70a37d8f972f2494837f9dba8364cbb4
                  orderId: 197ec08e001658690721be129e7fa595
                  market: AAPL-USD.P
                  price: '227.50'
                  size: '5.00'
                  side: buy
                  direction: open long
                  filledCost: '1137.50'
                  fee: '0.57'
                  time: '2025-03-05T14:30:00Z'
                  isMaker: true
        '400':
          description: Bad request. The request was malformed or failed validation.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    description: Human-readable error message
                  error_code:
                    type: string
                    enum:
                    - order_not_found
              example:
                success: false
                error: Description of the error
                error_code: order_not_found
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /v1/perps/fills/csv:
    get:
      summary: Get Fills CSV
      description: Export fills as CSV, sorted reverse chronologically.
      operationId: getFillsCSV
      tags:
      - Fills
      security:
      - BearerAuth: []
      - ApiKeyAuth: []
      parameters:
      - name: market
        in: query
        description: Filter by trading market
        required: false
        schema:
          type: string
          example: AAPL-USD.P
      - name: startTime
        in: query
        description: Filter by start time (UTC milliseconds)
        required: false
        schema:
          type: integer
          example: 1684814400000
      - name: endTime
        in: query
        description: Filter by end time (UTC milliseconds)
        required: false
        schema:
          type: integer
          example: 1672549200000
      responses:
        '200':
          description: CSV formatted fills
          content:
            text/csv:
              schema:
                type: string
        '400':
          description: Bad request. The request was malformed or failed validation.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    description: Human-readable error message
                  error_code:
                    type: string
                    enum:
                    - bad_query_param
                    - failed_to_parse_timestamp
              example:
                success: false
                error: Description of the error
                error_code: bad_query_param
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  responses:
    Forbidden:
      description: Access denied. The authenticated account does not have permission.
      content:
        application/json:
          schema:
            type: object
            properties:
              success:
                type: boolean
                example: false
              error:
                type: string
                description: Human-readable error message
              error_code:
                type: string
                enum:
                - account_closed
                - account_not_allowed
                - forbidden
                - ip_not_permitted
                - key_doesnt_have_scope
          example:
            success: false
            error: Description of the error
            error_code: account_not_allowed
    TooManyRequests:
      description: Rate limit exceeded. Slow down request frequency.
      content:
        application/json:
          schema:
            type: object
            properties:
              success:
                type: boolean
                example: false
              error:
                type: string
                description: Human-readable error message
              error_code:
                type: string
                enum:
                - too_many_requests
          example:
            success: false
            error: Description of the error
            error_code: too_many_requests
    Unauthorized:
      description: Authentication required. Provide a valid JWT or API key.
      content:
        application/json:
          schema:
            type: object
            properties:
              success:
                type: boolean
                example: false
              error:
                type: string
                description: Human-readable error message
              error_code:
                type: string
                enum:
                - api_key_not_found
                - auth_expired
                - auth_invalid
                - auth_missing
                - failed_to_decode_hex_signature
                - failed_to_parse_timestamp
                - signature_mismatch
                - timestamp_too_far
          example:
            success: false
            error: Description of the error
            error_code: auth_missing
    InternalServerError:
      description: Internal server error.
      content:
        application/json:
          schema:
            type: object
            properties:
              success:
                type: boolean
                example: false
              error:
                type: string
                description: Human-readable error message
              error_code:
                type: string
                enum:
                - server_is_busy
                - service_unavailable
                - unknown
          example:
            success: false
            error: Description of the error
            error_code: unknown
  schemas:
    ApiFill:
      type: object
      required:
      - id
      - orderId
      - market
      - price
      - size
      - side
      - filledCost
      - fee
      - time
      - isMaker
      properties:
        id:
          type: string
          description: Fill ID
          example: 70a37d8f972f2494837f9dba8364cbb4
        orderId:
          type: string
          description: Order ID this fill belongs to
          example: 197ec08e001658690721be129e7fa595
        clientOrderId:
          type: string
          description: Client order ID (if set on the order)
          example: order123
        parentOrderID:
          type: string
          description: Parent order ID (e.g. for TWAP child orders)
          example: ''
        market:
          type: string
          description: Trading market
          example: AAPL-USD.P
        price:
          type: string
          description: Fill price
          example: '1.55'
        size:
          type: string
          description: Fill quantity in base currency
          example: '5.403'
        side:
          type: string
          description: buy or sell
          enum:
          - buy
          - sell
          example: buy
        direction:
          type: string
          description: 'Trade direction for perps fills. One of: "open long", "open short", "close long", "close short", "flip long to short", "flip short to long"

            '
          example: openLong
          enum:
          - openLong
          - openShort
          - closeLong
          - closeShort
          - flipLongToShort
          - flipShortToLong
        filledCost:
          type: string
          description: Total cost of the fill in quote currency
          example: '8.37465'
        fee:
          type: string
          description: Fees incurred on this fill
          example: '0.0837'
        feeRebate:
          type: string
          description: Fee rebate earned on this fill (perps only)
          example: '0.0042'
        pnl:
          type: string
          description: Realized PNL for this fill (perps only)
          example: '1.2345'
        time:
          type: string
          format: date-time
          description: Time the fill occurred
          example: '2022-06-16T12:35:11.123456Z'
        isMaker:
          type: boolean
          description: True if this was a maker (resting) fill
          example: false
        isADL:
          type: boolean
          description: True if this was an auto-deleveraging fill (perps only)
          example: false
    PageInfo:
      type: object
      properties:
        prevCursor:
          type: string
          description: Cursor value to get the previous page of results
          example: O4ZTGM3RGM2DG===
        nextCursor:
          type: string
          description: Cursor value to get the next page of results
          example: NQ5WWO3THN3Q====
    GenericResponse:
      type: object
      required:
      - success
      properties:
        success:
          type: boolean
          description: Whether the request was successful
          example: true
        error:
          type: string
          description: Error message, present only on failure
          example: ''
        error_code:
          type: string
          description: Semantic error code. See each endpoint's error responses for the specific codes it can return.
        deprecated:
          type: string
          description: Deprecation notice, if applicable
          example: ''
  securitySchemes:
    apiKey:
      type: apiKey
      name: x-api-key
      in: header