openapi: 3.0.3
info:
  title: API معاملات تعهدی نوبیتکس
  version: "1.0.0"
  description: |
    APIهای مربوط به معاملات تعهدی (Margin)، استخرهای مشارکت، انتقال به کیف‌پول تعهدی،
    سفارش‌گذاری تعهدی و مدیریت موقعیت‌ها.

servers:
  - url: https://apiv2.nobitex.ir
  - url: https://testnetapiv2.nobitex.ir

tags:
  - name: معاملات تعهدی
    description: بازار تعهدی، استخرها، سفارش‌ها و موقعیت‌ها

paths:
  /margin/markets/list:
    parameters:
      - $ref: "#/components/parameters/TraderBotUserAgent"
    get:
      tags:
        - معاملات تعهدی
      summary: مشاهده بازارهای معاملات تعهدی
      description: |
        لیست بازارهای پشتیبانی‌شده برای معاملات تعهدی را برمی‌گرداند. این متد هم در حالت
        عمومی و هم با توکن کاربر قابل استفاده است؛ در حالت دارای توکن، دسترسی کاربر به
        استخرهای خصوصی و سقف اهرم کاربر لحاظ می‌شود.

        - محدودیت فراخوانی: ۳۰ درخواست در دقیقه
      security:
        - {}
        - TokenAuth: []
      parameters:
        - name: details
          in: query
          required: false
          description: در صورت ارسال، اطلاعات تکمیلی بازار مانند محدودیت‌های وکالت را برمی‌گرداند.
          schema:
            type: boolean
        - name: leverage
          in: query
          required: false
          description: اهرم مورد نظر برای محاسبه محدودیت‌ها؛ هنگام ارسال `details` استفاده می‌شود.
          schema:
            type: string
        - name: vipLevel
          in: query
          required: false
          description: سطح VIP برای محاسبه محدودیت‌ها؛ مقدار پیش‌فرض ۰ است.
          schema:
            type: integer
            default: 0
      responses:
        "200":
          description: موفق
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    example: ok
                  markets:
                    type: object
                    additionalProperties:
                      $ref: "#/components/schemas/MarginMarketSetting"
        "400":
          description: ورودی نامعتبر
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MarginFailedResponse"

  /margin/fee-rates:
    parameters:
      - $ref: "#/components/parameters/TraderBotUserAgent"
    get:
      tags:
        - معاملات تعهدی
      summary: مشاهده نرخ کارمزد موقعیت‌ها
      description: |
        نرخ کارمزد موقعیت برای ارزهای دارای استخر فعال را برمی‌گرداند.

        - در صورت استفاده از API Key، دسترسی `READ` روی کلید الزامی است.
      security:
        - TokenAuth: []
      responses:
        "200":
          description: موفق
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    example: ok
                  feeRates:
                    type: array
                    items:
                      $ref: "#/components/schemas/MarginFeeRate"

  /liquidity-pools/list:
    parameters:
      - $ref: "#/components/parameters/TraderBotUserAgent"
    get:
      tags:
        - معاملات تعهدی
      summary: مشاهده استخرهای مشارکت ارزی
      description: |
        استخرهای مشارکت موجود برای معاملات تعهدی و ظرفیت آن‌ها. این متد در حالت عمومی
        استخرهای عمومی و در حالت دارای توکن، استخرهای قابل دسترسی کاربر را برمی‌گرداند.

        - محدودیت فراخوانی: ۱۲ درخواست در دقیقه
      security:
        - {}
        - TokenAuth: []
      parameters:
        - name: status
          in: query
          required: false
          description: فیلتر وضعیت استخر.
          schema:
            type: string
            default: active
            enum: [active, inactive, all]
      responses:
        "200":
          description: موفق
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    example: ok
                  pools:
                    type: object
                    additionalProperties:
                      $ref: "#/components/schemas/LiquidityPool"
        "400":
          description: ورودی نامعتبر
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MarginFailedResponse"

  /wallets/transfer:
    parameters:
      - $ref: "#/components/parameters/TraderBotUserAgent"
    post:
      tags:
        - معاملات تعهدی
      summary: انتقال پول به/از کیف‌پول تعهدی
      description: |
        انتقال وجه بین کیف‌پول اسپات و کیف‌پول تعهدی.

        - محدودیت فراخوانی: ۱۰ درخواست در دقیقه
      security:
        - TokenAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/WalletTransferRequest"
          application/x-www-form-urlencoded:
            schema:
              $ref: "#/components/schemas/WalletTransferRequest"
      responses:
        "200":
          description: موفق یا ناموفق
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: "#/components/schemas/WalletTransferResponse"
                  - $ref: "#/components/schemas/MarginFailedResponse"

  /margin/delegation-limit:
    parameters:
      - $ref: "#/components/parameters/TraderBotUserAgent"
    get:
      tags:
        - معاملات تعهدی
      summary: دریافت محدودیت کاربری در مقدار وکالت
      deprecated: true
      description: |
        حداکثر مقدار وکالت مجاز برای رمزارز مشخص را برمی‌گرداند. این نسخه قدیمی است؛
        برای بازار مشخص از `/margin/v2/delegation-limit` استفاده کنید.

        - محدودیت فراخوانی: ۱۲ درخواست در دقیقه
        - در صورت استفاده از API Key، دسترسی `READ` روی کلید الزامی است.
      security:
        - TokenAuth: []
      parameters:
        - name: currency
          in: query
          required: true
          schema:
            type: string
          description: رمزارز مورد نظر.
          example: btc
      responses:
        "200":
          description: موفق یا ناموفق
          content:
            application/json:
              schema:
                oneOf:
                  - type: object
                    properties:
                      status:
                        type: string
                        example: ok
                      limit:
                        type: string
                        example: "0.039062"
                  - $ref: "#/components/schemas/MarginFailedResponse"
        "400":
          description: ورودی نامعتبر
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MarginFailedResponse"

  /margin/v2/delegation-limit:
    parameters:
      - $ref: "#/components/parameters/TraderBotUserAgent"
    get:
      tags:
        - معاملات تعهدی
      summary: دریافت محدودیت وکالت بر اساس بازار
      description: |
        محدودیت‌های وکالت کاربر را برای بازار مشخص و برای هر سمت سفارش بر اساس اهرم برمی‌گرداند.

        - محدودیت فراخوانی: ۱۲ درخواست در دقیقه
        - در صورت استفاده از API Key، دسترسی `READ` روی کلید الزامی است.
      security:
        - TokenAuth: []
      parameters:
        - name: market
          in: query
          required: true
          schema:
            type: string
          description: نماد بازار، مانند `BTCIRT`.
          example: BTCIRT
      responses:
        "200":
          description: موفق یا ناموفق
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: "#/components/schemas/MarginDelegationLimitV2Response"
                  - $ref: "#/components/schemas/MarginFailedResponse"

  /margin/my-delegation-limit-details:
    parameters:
      - $ref: "#/components/parameters/TraderBotUserAgent"
    get:
      tags:
        - معاملات تعهدی
      summary: جزئیات محدودیت وکالت کاربر
      description: |
        جزئیات ظرفیت استخر، عمق بازار و مقدار استفاده‌شده کاربر را برای یک بازار و سمت سفارش برمی‌گرداند.

        - در صورت استفاده از API Key، دسترسی `READ` روی کلید الزامی است.
      security:
        - TokenAuth: []
      parameters:
        - name: side
          in: query
          required: true
          schema:
            type: string
            enum: [buy, sell]
        - name: market
          in: query
          required: true
          schema:
            type: string
          example: BTCIRT
        - name: leverage
          in: query
          required: true
          schema:
            type: string
          example: "5"
      responses:
        "200":
          description: موفق یا ناموفق
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: "#/components/schemas/MyDelegationLimitDetailsResponse"
                  - $ref: "#/components/schemas/MarginFailedResponse"

  /margin/orders/add:
    parameters:
      - $ref: "#/components/parameters/TraderBotUserAgent"
    post:
      tags:
        - معاملات تعهدی
      summary: درج سفارش تعهدی
      description: |
        ثبت سفارش در بازار تعهدی (Limit, Market, Stop, OCO).

        - محدودیت فراخوانی: ۳۰۰ درخواست در ۱۰ دقیقه
        - در صورت استفاده از API Key، دسترسی `TRADE` روی کلید الزامی است.
      security:
        - TokenAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/MarginOrderAddRequest"
          application/x-www-form-urlencoded:
            schema:
              $ref: "#/components/schemas/MarginOrderAddRequest"
      responses:
        "200":
          description: موفق یا ناموفق
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: "#/components/schemas/MarginOrderResponseSingle"
                  - $ref: "#/components/schemas/MarginOrderResponseOCO"
                  - $ref: "#/components/schemas/MarginFailedResponse"
        "400":
          description: ورودی نامعتبر
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MarginFailedResponse"

  /positions/list:
    parameters:
      - $ref: "#/components/parameters/TraderBotUserAgent"
    get:
      tags:
        - معاملات تعهدی
      summary: مشاهده لیست موقعیت‌ها
      description: |
        لیست موقعیت‌های باز (`active`) و تاریخچه موقعیت‌های بسته (`past`) را با فیلتر و صفحه‌بندی برمی‌گرداند.

        - محدودیت فراخوانی: ۳۰ درخواست در دقیقه
        - صفحه‌بندی: دارد
        - در صورت استفاده از API Key، دسترسی `READ` روی کلید الزامی است.
      security:
        - TokenAuth: []
      parameters:
        - name: srcCurrency
          in: query
          schema:
            type: string
          example: btc
        - name: dstCurrency
          in: query
          schema:
            type: string
          example: usdt
        - name: status
          in: query
          schema:
            type: string
            default: active
            enum: [active, past, all]
        - name: side
          in: query
          schema:
            type: string
            enum: [buy, sell]
        - name: page
          in: query
          schema:
            type: integer
        - name: pageSize
          in: query
          schema:
            type: integer
      responses:
        "200":
          description: موفق
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    example: ok
                  positions:
                    type: array
                    items:
                      $ref: "#/components/schemas/Position"
                  hasNext:
                    type: boolean
        "400":
          description: ورودی نامعتبر
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MarginFailedResponse"

  /positions/active-count:
    parameters:
      - $ref: "#/components/parameters/TraderBotUserAgent"
    get:
      tags:
        - معاملات تعهدی
      summary: تعداد موقعیت‌های باز
      description: |
        تعداد موقعیت‌های باز کاربر را برمی‌گرداند.

        - در صورت استفاده از API Key، دسترسی `READ` روی کلید الزامی است.
      security:
        - TokenAuth: []
      responses:
        "200":
          description: موفق
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    example: ok
                  count:
                    type: integer

  /positions/{positionId}/status:
    parameters:
      - $ref: "#/components/parameters/TraderBotUserAgent"
    get:
      tags:
        - معاملات تعهدی
      summary: مشاهده یک موقعیت
      description: |
        وضعیت یک موقعیت تعهدی خاص را برمی‌گرداند.

        - محدودیت فراخوانی: ۱۰۰ درخواست در ۱۰ دقیقه
        - در صورت استفاده از API Key، دسترسی `READ` روی کلید الزامی است.
      security:
        - TokenAuth: []
      parameters:
        - $ref: "#/components/parameters/PositionId"
      responses:
        "200":
          description: موفق یا ناموفق
          content:
            application/json:
              schema:
                oneOf:
                  - type: object
                    properties:
                      status:
                        type: string
                        example: ok
                      position:
                        $ref: "#/components/schemas/Position"
                  - $ref: "#/components/schemas/MarginFailedResponse"
        "404":
          description: موقعیت پیدا نشد

  /positions/{positionId}/close:
    parameters:
      - $ref: "#/components/parameters/TraderBotUserAgent"
    post:
      tags:
        - معاملات تعهدی
      summary: بستن موقعیت
      description: |
        ثبت سفارش در جهت عکس برای تسویه تعهد و بستن موقعیت.

        - محدودیت فراخوانی: ۳۰۰ درخواست در ۱۰ دقیقه
        - در صورت استفاده از API Key، دسترسی `TRADE` روی کلید الزامی است.
      security:
        - TokenAuth: []
      parameters:
        - $ref: "#/components/parameters/PositionId"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/PositionCloseRequest"
          application/x-www-form-urlencoded:
            schema:
              $ref: "#/components/schemas/PositionCloseRequest"
      responses:
        "200":
          description: موفق یا ناموفق
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: "#/components/schemas/MarginOrderResponseSingle"
                  - $ref: "#/components/schemas/MarginOrderResponseOCO"
                  - $ref: "#/components/schemas/MarginFailedResponse"
        "400":
          description: ورودی نامعتبر
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MarginFailedResponse"
        "404":
          description: موقعیت باز پیدا نشد

  /positions/{positionId}/edit-collateral/options:
    parameters:
      - $ref: "#/components/parameters/TraderBotUserAgent"
    get:
      tags:
        - معاملات تعهدی
      summary: بازه مجاز ویرایش وجه تضمین
      description: |
        کمینه و بیشینه وجه تضمین قابل انتخاب برای موقعیت باز را برمی‌گرداند.

        - در صورت استفاده از API Key، دسترسی `READ` روی کلید الزامی است.
      security:
        - TokenAuth: []
      parameters:
        - $ref: "#/components/parameters/PositionId"
      responses:
        "200":
          description: موفق
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PositionCollateralOptionsResponse"
        "404":
          description: موقعیت باز پیدا نشد

  /positions/{positionId}/edit-collateral:
    parameters:
      - $ref: "#/components/parameters/TraderBotUserAgent"
    post:
      tags:
        - معاملات تعهدی
      summary: ویرایش وجه تضمین موقعیت باز
      description: |
        افزایش یا کاهش وجه تضمین یک موقعیت باز.

        - محدودیت فراخوانی: ۶۰ درخواست در دقیقه
        - در صورت استفاده از API Key، دسترسی `TRADE` روی کلید الزامی است.
      security:
        - TokenAuth: []
      parameters:
        - $ref: "#/components/parameters/PositionId"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/PositionCollateralEditRequest"
          application/x-www-form-urlencoded:
            schema:
              $ref: "#/components/schemas/PositionCollateralEditRequest"
      responses:
        "200":
          description: موفق یا ناموفق
          content:
            application/json:
              schema:
                oneOf:
                  - type: object
                    properties:
                      status:
                        type: string
                        example: ok
                      position:
                        $ref: "#/components/schemas/Position"
                  - $ref: "#/components/schemas/MarginFailedResponse"
        "400":
          description: ورودی نامعتبر
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MarginFailedResponse"
        "404":
          description: موقعیت باز پیدا نشد

  /margin/predict/edit-collateral:
    parameters:
      - $ref: "#/components/parameters/TraderBotUserAgent"
    get:
      tags:
        - معاملات تعهدی
      summary: پیش‌بینی ویرایش وجه تضمین
      description: |
        اثر افزایش یا کاهش وجه تضمین را بدون اعمال تغییر روی موقعیت محاسبه می‌کند.

        - در صورت استفاده از API Key، دسترسی `READ` روی کلید الزامی است.
      security:
        - TokenAuth: []
      parameters:
        - name: positionId
          in: query
          required: true
          schema:
            type: integer
        - name: add
          in: query
          required: false
          description: مقدار افزایش وجه تضمین.
          schema:
            type: string
        - name: sub
          in: query
          required: false
          description: مقدار کاهش وجه تضمین.
          schema:
            type: string
      responses:
        "200":
          description: موفق
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PositionCollateralPredictResponse"
        "400":
          description: ورودی نامعتبر
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MarginFailedResponse"
        "404":
          description: موقعیت پیدا نشد

components:
  parameters:
    TraderBotUserAgent:
      name: User-Agent
      in: header
      required: false
      description: |
        برای شناسایی بات، این هدر را در همه درخواست‌های HTTP بات با الگوی
        `TraderBot/<name-and-version>` ارسال کنید. این هدر هنگام ورود خودکار با
        `captcha=api` الزامی و در سایر فراخوانی‌های بات اکیداً توصیه می‌شود.
      schema:
        type: string
      example: TraderBot/MyBot-1.0.0

    PositionId:
      name: positionId
      in: path
      required: true
      schema:
        type: integer
      example: 128

  securitySchemes:
    TokenAuth:
      type: apiKey
      in: header
      name: Authorization
      description: |
        توکن کاربر در قالب `Authorization: Token <token>`.

  schemas:
    MarginMarketSetting:
      type: object
      properties:
        srcCurrency:
          type: string
          example: btc
        dstCurrency:
          type: string
          example: usdt
        positionFeeRate:
          type: string
          nullable: true
          example: "0.001"
        maxLeverage:
          type: string
          example: "5"
        sellEnabled:
          type: boolean
        buyEnabled:
          type: boolean
        sellPositionFeeRate:
          type: string
          nullable: true
        buyPositionFeeRate:
          type: string
          nullable: true
        sellMaxDelegation:
          type: string
          nullable: true
        buyMaxDelegation:
          type: string
          nullable: true
        buyMaxDelegationInSrcCurrency:
          type: string
          nullable: true

    MarginFeeRate:
      type: object
      properties:
        currency:
          type: string
          example: btc
        positionFeeRate:
          type: string
          example: "0.001"

    LiquidityPool:
      type: object
      properties:
        capacity:
          type: string
        filledCapacity:
          type: string
        currentProfit:
          type: string
        APR:
          type: string
          nullable: true
        minDelegation:
          type: string
          nullable: true
        maxDelegation:
          type: string
        startDate:
          type: string
          format: date-time
        endDate:
          type: string
          format: date-time
        profitPeriod:
          type: integer
        profitDate:
          type: string
          format: date-time

    WalletTransferRequest:
      type: object
      required:
        - currency
        - amount
        - src
        - dst
      properties:
        currency:
          type: string
          example: btc
        amount:
          type: string
          example: "0.01"
        src:
          type: string
          enum: [spot, margin]
        dst:
          type: string
          enum: [spot, margin]

    WalletTransferResponse:
      type: object
      properties:
        status:
          type: string
          example: ok
        srcWallet:
          type: object
          additionalProperties: true
        dstWallet:
          type: object
          additionalProperties: true

    MarginDelegationLimitV2Response:
      type: object
      properties:
        status:
          type: string
          example: ok
        limits:
          type: object
          properties:
            buy:
              type: array
              items:
                $ref: "#/components/schemas/DelegationLimitItem"
            sell:
              type: array
              items:
                $ref: "#/components/schemas/DelegationLimitItem"

    DelegationLimitItem:
      type: object
      properties:
        leverage:
          type: string
          example: "5"
        limit:
          type: string
          example: "0.039062"

    MyDelegationLimitDetailsResponse:
      type: object
      properties:
        status:
          type: string
          example: ok
        currency:
          type: string
          example: btc
        poolCapacity:
          type: string
        depth:
          type: string
        vipLevel:
          type: integer
        isExceptedUser:
          type: boolean
        limit:
          type: string
        usedAmount:
          type: string

    MarginOrderAddRequest:
      type: object
      properties:
        mode:
          type: string
          enum: [oco]
          description: برای سفارش OCO مقدار `oco` ارسال شود.
        execution:
          type: string
          default: limit
          enum: [limit, market, stop_limit, stop_market]
        srcCurrency:
          type: string
          example: btc
        dstCurrency:
          type: string
          example: usdt
        type:
          type: string
          default: sell
          enum: [buy, sell]
        leverage:
          type: string
          default: "1"
        amount:
          type: string
        price:
          type: string
        stopPrice:
          type: string
        stopLimitPrice:
          type: string
        clientOrderId:
          type: string

    PositionCloseRequest:
      type: object
      properties:
        mode:
          type: string
          enum: [oco]
        execution:
          type: string
          default: limit
          enum: [limit, market, stop_limit, stop_market]
        amount:
          type: string
        price:
          type: string
        stopPrice:
          type: string
        stopLimitPrice:
          type: string
        clientOrderId:
          type: string

    MarginOrder:
      type: object
      properties:
        id:
          type: integer
        type:
          type: string
          enum: [buy, sell]
        execution:
          type: string
          enum: [limit, market, stop_limit, stop_market]
        tradeType:
          type: string
          enum: [spot, margin, credit, debit]
        srcCurrency:
          type: string
        dstCurrency:
          type: string
        price:
          type: string
          description: قیمت سفارش یا مقدار `market` برای سفارش بازار.
        amount:
          type: string
        totalPrice:
          type: string
        totalOrderPrice:
          type: string
        matchedAmount:
          type: string
        unmatchedAmount:
          type: string
        status:
          type: string
          enum: [New, Active, Done, Canceled, Inactive]
        partial:
          type: boolean
        fee:
          type: string
        created_at:
          type: string
          format: date-time
        averagePrice:
          type: string
        clientOrderId:
          type: string
          nullable: true
        param1:
          type: string
          description: قیمت توقف در سفارش‌های حد ضرر.
        pairId:
          type: integer
          nullable: true
        leverage:
          type: string
        side:
          type: string
          enum: [open, close]

    MarginOrderResponseSingle:
      type: object
      properties:
        status:
          type: string
          example: ok
        order:
          $ref: "#/components/schemas/MarginOrder"

    MarginOrderResponseOCO:
      type: object
      properties:
        status:
          type: string
          example: ok
        orders:
          type: array
          items:
            $ref: "#/components/schemas/MarginOrder"

    Position:
      type: object
      properties:
        id:
          type: integer
        createdAt:
          type: string
          format: date-time
        side:
          type: string
          enum: [buy, sell]
        srcCurrency:
          type: string
        dstCurrency:
          type: string
        status:
          type: string
          enum: [New, Open, Closed, Liquidated, Canceled, Expired]
        marginType:
          type: string
          example: Isolated Margin
        collateral:
          type: string
        leverage:
          type: string
        openedAt:
          type: string
          format: date-time
          nullable: true
        closedAt:
          type: string
          format: date-time
          nullable: true
        liquidationPrice:
          type: string
          nullable: true
        entryPrice:
          type: string
          nullable: true
        exitPrice:
          type: string
          nullable: true
        delegatedAmount:
          type: string
          nullable: true
        liability:
          type: string
          nullable: true
        totalAsset:
          type: string
          nullable: true
        marginRatio:
          type: string
          nullable: true
        maintenanceMarginRatio:
          type: string
          nullable: true
        marginCallRatio:
          type: string
          nullable: true
        liabilityInOrder:
          type: string
          nullable: true
        assetInOrder:
          type: string
          nullable: true
        unrealizedPNL:
          type: string
          nullable: true
        unrealizedPNLPercent:
          type: string
          nullable: true
        expirationDate:
          type: string
          format: date
          nullable: true
        extensionFee:
          type: string
          nullable: true
        markPrice:
          type: string
          nullable: true
        PNL:
          type: string
          nullable: true
        PNLPercent:
          type: string
          nullable: true

    PositionCollateralEditRequest:
      type: object
      required:
        - collateral
      properties:
        collateral:
          type: string
          description: وجه تضمین جدید.
          example: "230000"

    PositionCollateralOptionsResponse:
      type: object
      properties:
        status:
          type: string
          example: ok
        collateral:
          type: object
          properties:
            min:
              type: string
            max:
              type: string

    PositionCollateralPredictResponse:
      type: object
      properties:
        status:
          type: string
          example: ok
        collateral:
          type: string
        marginRatio:
          type: string
        liquidationPrice:
          type: string

    MarginFailedResponse:
      type: object
      properties:
        status:
          type: string
          example: failed
        code:
          type: string
        message:
          type: string
