API

获取市场的官方费率表

GET /websites/{code}/fee-schedule — 获取市场的官方费率表

操作

GET /websites/{code}/fee-schedule

行为

返回平台当前为某个市场发布的费率,每种用途一个槽位:deposit、sale 和 withdraw。

  • 每个已发布的槽位都带有完全展开的官方计算链:包含每个费用算子、换币算子和换币算子组及其数值与货币,因此一次请求就足以复现平台的计算。
  • 如果槽位的计算链 id 为 0,则明确表示免费:平台不对该用途收取任何费用,且该计算链没有步骤。
  • 如果平台尚未为某种用途发布官方计算链,对应槽位为 null:费用未知,或该市场不提供此用途。null 绝不表示免费。
  • 每条计算链都会注明其 start_currency:价格必须采用该货币,计算链才适用(null:任意货币)。
  • 不包含归属和管理类字段。

404 表示没有使用该代码的市场。

用量

{
  "authentication": "public",
  "credit_cost": 0,
  "premium": false,
  "recommended_interval_seconds": 300,
  "rate_limit": null,
  "unit_pricing": null
}

请求

{
  "parameters": [
    {
      "name": "code",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "description": "市场代码,即 `GET /websites` 列出的代码。",
        "title": "Code"
      },
      "description": "市场代码,即 `GET /websites` 列出的代码。"
    }
  ]
}

响应

{
  "200": {
    "description": "请求成功",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/Envelope_FeeScheduleOut_"
        }
      }
    }
  },
  "404": {
    "description": "请求的资源不存在",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorEnvelope"
        }
      }
    }
  },
  "422": {
    "description": "参数或请求体无效",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorEnvelope"
        }
      }
    }
  },
  "503": {
    "description": "服务暂时不可用;请稍后重试",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorEnvelope"
        }
      }
    }
  }
}

模型

{
  "CreditMeta": {
    "properties": {
      "cost": {
        "type": "integer",
        "title": "Cost",
        "description": "本次请求花费的点数。"
      },
      "remaining": {
        "type": "integer",
        "title": "Remaining",
        "description": "本次请求后的预估剩余点数。仅作参考而非账目:并发请求可能导致其略有偏差。"
      }
    },
    "type": "object",
    "required": [
      "cost",
      "remaining"
    ],
    "title": "CreditMeta",
    "description": "计费请求的点数结算信息。"
  },
  "Envelope_FeeScheduleOut_": {
    "properties": {
      "data": {
        "$ref": "#/components/schemas/FeeScheduleOut",
        "description": "端点返回的数据。"
      },
      "meta": {
        "$ref": "#/components/schemas/Meta",
        "description": "请求元数据。"
      }
    },
    "type": "object",
    "required": [
      "data",
      "meta"
    ],
    "title": "Envelope[FeeScheduleOut]"
  },
  "ErrorBody": {
    "properties": {
      "code": {
        "type": "string",
        "title": "Code",
        "description": "稳定的机器可读错误代码。请根据此值进行分支处理,而不是 `message`。"
      },
      "message": {
        "type": "string",
        "title": "Message",
        "description": "面向人类阅读的说明。措辞可能变化。"
      },
      "details": {
        "anyOf": [
          {
            "additionalProperties": true,
            "type": "object"
          },
          {
            "type": "null"
          }
        ],
        "title": "Details",
        "description": "可选的结构化上下文,例如校验错误列表;对于 `credit_insufficient`,则为所需点数和剩余点数。"
      }
    },
    "type": "object",
    "required": [
      "code",
      "message"
    ],
    "title": "ErrorBody",
    "description": "失败请求的详细信息。"
  },
  "ErrorEnvelope": {
    "properties": {
      "error": {
        "$ref": "#/components/schemas/ErrorBody",
        "description": "出了什么问题。"
      },
      "meta": {
        "$ref": "#/components/schemas/Meta",
        "description": "请求元数据。"
      }
    },
    "type": "object",
    "required": [
      "error",
      "meta"
    ],
    "title": "ErrorEnvelope",
    "description": "错误响应:`error` 中为错误信息,`meta` 中为请求元数据。"
  },
  "FeeScheduleOut": {
    "properties": {
      "website_code": {
        "type": "string",
        "title": "Website Code",
        "description": "市场代码。"
      },
      "slots": {
        "$ref": "#/components/schemas/FeeScheduleSlotsOut",
        "description": "每种用途已发布的官方计算链。"
      }
    },
    "additionalProperties": false,
    "type": "object",
    "required": [
      "website_code",
      "slots"
    ],
    "title": "FeeScheduleOut",
    "description": "平台当前为某个市场发布的官方费率,按用途划分。某种用途尚未发布官方计算链时,其值为 `null`。"
  },
  "FeeScheduleSlotOut": {
    "properties": {
      "purpose": {
        "type": "string",
        "enum": [
          "deposit",
          "sale",
          "withdraw"
        ],
        "title": "Purpose",
        "description": "用途:`deposit`、`sale` 或 `withdraw`。"
      },
      "calculation_chain": {
        "$ref": "#/components/schemas/PublicCalculationChainOut",
        "description": "该用途的官方计算链。"
      }
    },
    "additionalProperties": false,
    "type": "object",
    "required": [
      "purpose",
      "calculation_chain"
    ],
    "title": "FeeScheduleSlotOut",
    "description": "为某一用途发布的官方计算链。"
  },
  "FeeScheduleSlotsOut": {
    "properties": {
      "deposit": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/FeeScheduleSlotOut"
          },
          {
            "type": "null"
          }
        ],
        "description": "充值费用;未发布时为 `null`。"
      },
      "sale": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/FeeScheduleSlotOut"
          },
          {
            "type": "null"
          }
        ],
        "description": "出售费用;未发布时为 `null`。"
      },
      "withdraw": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/FeeScheduleSlotOut"
          },
          {
            "type": "null"
          }
        ],
        "description": "提现费用;未发布时为 `null`。"
      }
    },
    "additionalProperties": false,
    "type": "object",
    "required": [
      "deposit",
      "sale",
      "withdraw"
    ],
    "title": "FeeScheduleSlotsOut",
    "description": "某个市场已发布的官方计算链,按用途划分。"
  },
  "Meta": {
    "properties": {
      "request_id": {
        "type": "string",
        "title": "Request Id",
        "description": "本次请求的唯一标识符,与响应头 `X-Request-ID` 相同。联系支持时请提供。"
      },
      "billable": {
        "anyOf": [
          {
            "type": "boolean"
          },
          {
            "type": "null"
          }
        ],
        "title": "Billable",
        "description": "该请求是否以点数计费。仅出现在计量端点上;`false` 表示该请求免费,例如因为它本身不收费,或已被你的订阅覆盖。"
      },
      "credit": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/CreditMeta"
          },
          {
            "type": "null"
          }
        ],
        "description": "本次请求的费用和你的预估剩余余额。仅在 `billable` 为 `true` 时出现。"
      }
    },
    "type": "object",
    "required": [
      "request_id"
    ],
    "title": "Meta",
    "description": "每个带信封的响应中都包含的请求元数据。"
  },
  "PublicCalculationChainOut": {
    "properties": {
      "id": {
        "anyOf": [
          {
            "type": "integer"
          },
          {
            "type": "null"
          }
        ],
        "title": "Id",
        "description": "计算链的唯一 ID。`0` 是内置的免费计算链:平台不对该用途收取任何费用。"
      },
      "name": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ],
        "title": "Name",
        "description": "显示名称(如已设置)。"
      },
      "start_currency": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ],
        "title": "Start Currency",
        "description": "计算链所期望的价格货币;适用于任意货币时为 `null`。采用其他货币的价格不在其适用范围内。"
      },
      "steps": {
        "items": {
          "oneOf": [
            {
              "$ref": "#/components/schemas/PublicFeeOperatorOut"
            },
            {
              "$ref": "#/components/schemas/PublicConvertOperatorOut"
            },
            {
              "$ref": "#/components/schemas/PublicConvertOperatorGroupOut"
            }
          ],
          "discriminator": {
            "propertyName": "kind",
            "mapping": {
              "convert": "#/components/schemas/PublicConvertOperatorOut",
              "convert_operator_group": "#/components/schemas/PublicConvertOperatorGroupOut",
              "fee": "#/components/schemas/PublicFeeOperatorOut"
            }
          }
        },
        "type": "array",
        "title": "Steps",
        "description": "按执行顺序排列的步骤,以 `kind` 区分类型。"
      }
    },
    "additionalProperties": false,
    "type": "object",
    "required": [
      "id",
      "name",
      "start_currency",
      "steps"
    ],
    "title": "PublicCalculationChainOut",
    "description": "费率表中发布的一条官方计算链。"
  },
  "PublicConvertOperatorGroupOut": {
    "properties": {
      "kind": {
        "type": "string",
        "const": "convert_operator_group",
        "title": "Kind",
        "description": "步骤类型:始终为 `convert_operator_group`。"
      },
      "id": {
        "anyOf": [
          {
            "type": "integer"
          },
          {
            "type": "null"
          }
        ],
        "title": "Id",
        "description": "组的唯一 ID。"
      },
      "name": {
        "type": "string",
        "title": "Name",
        "description": "显示名称。"
      },
      "rule": {
        "type": "string",
        "enum": [
          "min",
          "max",
          "avg"
        ],
        "title": "Rule",
        "description": "如何从换算成功的成员中选出结果:`min`、`max` 或 `avg`。"
      },
      "members": {
        "items": {
          "$ref": "#/components/schemas/PublicConvertOperatorOut"
        },
        "type": "array",
        "title": "Members",
        "description": "成员换算,按顺序排列。"
      }
    },
    "additionalProperties": false,
    "type": "object",
    "required": [
      "kind",
      "id",
      "name",
      "rule",
      "members"
    ],
    "title": "PublicConvertOperatorGroupOut",
    "description": "已发布费率表中的一组备选换算。"
  },
  "PublicConvertOperatorOut": {
    "properties": {
      "kind": {
        "type": "string",
        "const": "convert",
        "title": "Kind",
        "description": "步骤类型:始终为 `convert`。"
      },
      "id": {
        "anyOf": [
          {
            "type": "integer"
          },
          {
            "type": "null"
          }
        ],
        "title": "Id",
        "description": "换币算子的唯一 ID。"
      },
      "name": {
        "type": "string",
        "title": "Name",
        "description": "显示名称。"
      },
      "from": {
        "$ref": "#/components/schemas/PublicCurrencyOut",
        "description": "源货币。"
      },
      "to": {
        "$ref": "#/components/schemas/PublicCurrencyOut",
        "description": "目标货币。"
      },
      "mode": {
        "type": "string",
        "enum": [
          "auto",
          "fixed"
        ],
        "title": "Mode",
        "description": "`auto` 通过两种货币各自的 `usd_rate` 换算;`fixed` 乘以 `rate`。"
      },
      "rate": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ],
        "title": "Rate",
        "description": "每一单位源货币对应的目标货币数量,以十进制字符串表示;用于 `fixed` 模式。"
      }
    },
    "additionalProperties": false,
    "type": "object",
    "required": [
      "kind",
      "id",
      "name",
      "from",
      "to",
      "mode",
      "rate"
    ],
    "title": "PublicConvertOperatorOut",
    "description": "已发布费率表中的一个货币换算步骤。"
  },
  "PublicCurrencyOut": {
    "properties": {
      "id": {
        "anyOf": [
          {
            "type": "integer"
          },
          {
            "type": "null"
          }
        ],
        "title": "Id",
        "description": "货币的唯一 ID。"
      },
      "code": {
        "type": "string",
        "title": "Code",
        "description": "货币代码,例如 `USD`。"
      },
      "name": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ],
        "title": "Name",
        "description": "显示名称。"
      },
      "kind": {
        "type": "string",
        "title": "Kind",
        "description": "货币种类,例如 `fiat`。"
      },
      "usd_rate": {
        "type": "string",
        "title": "Usd Rate",
        "description": "一单位对应的美元价值,以十进制字符串表示。"
      }
    },
    "additionalProperties": false,
    "type": "object",
    "required": [
      "id",
      "code",
      "name",
      "kind",
      "usd_rate"
    ],
    "title": "PublicCurrencyOut",
    "description": "已发布费率表所使用的一种货币。"
  },
  "PublicFeeOperatorOut": {
    "properties": {
      "kind": {
        "type": "string",
        "const": "fee",
        "title": "Kind",
        "description": "步骤类型:始终为 `fee`。"
      },
      "id": {
        "anyOf": [
          {
            "type": "integer"
          },
          {
            "type": "null"
          }
        ],
        "title": "Id",
        "description": "费用算子的唯一 ID。"
      },
      "name": {
        "type": "string",
        "title": "Name",
        "description": "显示名称。"
      },
      "operator": {
        "type": "string",
        "enum": [
          "add",
          "sub",
          "mul",
          "div"
        ],
        "title": "Operator",
        "description": "作用于当前金额的算术运算:`add`、`sub`、`mul` 或 `div`。"
      },
      "value": {
        "type": "string",
        "title": "Value",
        "description": "算术运算的操作数,以十进制字符串表示。"
      },
      "currency_code": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ],
        "title": "Currency Code",
        "description": "`add` 和 `sub` 金额的货币;`mul` 和 `div` 时为 `null`。"
      }
    },
    "additionalProperties": false,
    "type": "object",
    "required": [
      "kind",
      "id",
      "name",
      "operator",
      "value",
      "currency_code"
    ],
    "title": "PublicFeeOperatorOut",
    "description": "已发布费率表中的一个费用步骤。"
  }
}

下载公开 OpenAPI schema