[POST] Create Spot exchange limit orders

Allow user to place buy / sell orders with particular ticker Body

Table of Contents

Changelogs

Version

Date

Changes by

Description of change

V1.0

Jul 18, 2024

Que Nguyen

  • Added Table of Contents.

  • Added Changelogs.

Order Resource

OrderId number

订单唯一标识符

Order unique Identifier

订单唯一标识符

Status text - enum (Active - Filled - Cancelled)

状态 文本 - 枚举(有效 - 已完成 - 取消)

Order status

订单类型

TickerId text

绿证行情唯一标识符

Ticker unique id

绿证行情唯一标识符,可类比“股票代码”,组成格式: “国家代码.生效年.能源类型.注册处”

Side text - enum (Buy - Sell)

订单方 文本类型 - 枚举(买方 - 卖方)

Order side enum

订单方枚举

Type text

订单类型

Order type: Limit

订单类型:限制

TimeInForce text

有效时间

Time in force:

有效时间 - 在进行交易时使用的一种特殊指标,用于指示订单在执行或到期前将保持多长时间有效

  • GTC: Good till Cancel - 取消前有效

Price number

价格

Order Price

订单价格

Quantity number

数量

Order’s quantity

订单数量

ActiveQuantity number

有效数量

Order’s active quantity

订单有效数量

FilledQuantity number

已完成订单量

Order’s filled quantity

已完成订单量

Currency text

货币

Currency code

货币代码

CreatedTime datetime

创建时间

Order’s created time

订单创建时间

MatchedTime datetime

匹配时间

Order’s matched time

订单匹配时间

FilledTime datetime

完成时间

Order’s filled time

订单完成时间

CancelledTime datetime

取消时间

Order’s cancellation time

订单取消时间

{ "OrderId": 1677, "Status": "Active", "TickerId": "MY.24.GTM.t", "Side": "Buy", "Type": "Limit", "TimeInForce": "GTC", "Price": 100, "Quantity": 10, "ActiveQuantity": 5, "FilledQuantity": 5, "Currency": "USD", "CreatedTime": "2024-07-24T04:10:24.44Z", "MatchedTime": "2024-07-24T05:10:24.44Z", "FilledTime": "2024-07-24T06:10:24.44Z", "CancelledTime": null }

API Definition

POST /public/v2/exchange/spot/limit-orders

Request

Headers

Content-Type

application/json

Authorization

Bearer {{access_token}}

Payload

DeliveryType (required) text

交易类型(必须)

Delivery type enum

  • Spot - 即时交易

Quantity (required) number

数量(必须)

Order quantity.

订单数量

Price (required) number

价格 (必须)

Order price.

订单价格

OrderSide (required) text - enum

订单方 (必须) 文本类型

  • Buy - Buy Order

  • 买方 - 买方订单

  • Sell - Sell Order

  • 卖方-卖方订单

TickerId (required) text

绿证行情唯一标识符 (必须)

Ticker Unique Identifier

绿证行情唯一标识符,可类比“股票代码”,组成格式: “国家代码.生效年.能源类型.注册处”

curl --location --request POST 'https://uat-api.redex.eco/public/v2/exchanges/spots/limit-orders' \ --header 'Authorization: Bearer {{access_token}}' --data '{ "DeliveryType": "Spot", "Quantity": 10.012123, "Price": 5.00, "OrderSide": "Sell", "TickerId": "MY.24.SLR.i" }'

 

Response

Response Body

Data:OrderId number

Order Unique Identifier

Errors list of error objects

Please see "Getting Started - #Error Object" for more details

请查看Getting Started - #Error Object以获得更多信息。

Meta pagination resource

Return Pagination Resource

返回分页信息

StatusCode integer

Http Status codes standard. Example 200, 201, 400, 422.

http状态码,如200,201,400, 422

Message text

Response message: Success or error message.

返回成功或错误的信息。

201 Success

{ "Data": { "OrderId": 1677, "Status": "Active", "TickerId": "MY.24.GTM.t", "Side": "Buy", "Type": "Limit", "TimeInForce": "GTC", "Price": 100, "Quantity": 10, "ActiveQuantity": 5, "FilledQuantity": 5, "Currency": "USD", "CreatedTime": "2024-07-24T04:10:24.44Z", "MatchedTime": null, "FilledTime": null, "CancelledTime": null }, "StatusCode": 201, "Errors": null, "Meta": null, "Message": "Create Order successfully." }

 

400 Bad Request

 

422 Unprocessable Entity

 

 

Rate limit

Rate Limit Algorithm: Fixed Window

In fixed window rate limiting, a fixed time window (e.g., one minute, one hour) is used to track the number of requests or actions allowed within that window. Requests exceeding the limit are either rejected or throttled until the window resets.

Rate Limiting Overview

Our API employs rate limiting to ensure fair usage and protect the performance and availability of the service. Combination of Global Policy and Operation Policy

Global Policy

  • Rate Limit: 3000 requests per 5 minute(s)

  • Renewal Period: 300 second(s)

  • Key: IP Address

  • Increment Condition: Any Request

Operation Policy

  • Rate Limit: 10 requests per 1 minute(s)

  • Renewal Period: 60 second(s)

  • Key: accound-id business account Id.

  • Increment Condition: Any Request.

Rate Limit Details

  1. Rate Limit by Key:

    1. Key: This ensures that rate limits are applied uniquely for each business account id.

    2. Request Limit: Each key is allowed to make up to 10 requests per minute.

    3. Reset Interval: The limit resets every 60 seconds.

  2. Response Headers:

    1. Retry-After: Sent when the rate limit is exceeded, indicating how long to wait before making another request.

Exceeding the Rate Limit

When the rate limit is exceeded, the API will return a 429 Too Many Requests status code. The response will include a Retry-After header specifying the number of seconds to wait before making a new request.

Example Response When Rate Limit is Exceeded