Skip to main content

REST API

production environment: https://sapi.monochrome.exchange

Basic information of the interface

Due to reasons such as high latency and poor stability, it is not recommended to access the API through a proxy. GET request parameters are placed in query Params, POST request parameters are placed in request body Please set the request header information to:Content-Type=application/json For requests that start other than /public, the request message needs to be signed

Frequency Limiting Rules

Some interfaces will have limited flow control (the corresponding interface will have a limited flow description). The flow limit is mainly divided into gateway flow limit and WAF flow limit. If the interface request triggers the gateway flow limit, 429 will be returned, indicating that the access frequency exceeds the limit, and the IP or apiKey will be blocked. Gateway flow limiting is divided into IP and apiKey flow limiting. Example description of IP flow limit: 100/s/ip, indicating the limit of the number of requests per second for this interface per IP. apiKey current limit example description: 50/s/apiKey, indicating the limit of the number of requests per second for the interface per apiKey.

Signature Instructions

Since Monochrome needs to provide some open interfaces for third-party platforms,therefore, the issue of data security needs to be considered. Such as whether the data has been tampered with, whether the data is outdated, whether the data can be submitted repeatedly, and the access frequency of the interface, and whether data has been tampered with is the most important issue.
  1. Please apply for appkey and secretkey in the user center first, each user’s appkey and secretkey are different.
  2. Add timestamp, its value should be the unix timestamp (milliseconds) of the time when the request is sent, and the time of the data is calculated based on this value.
  3. Add signature, its value is obtained by a certain rule of signature algorithm.
  4. Add recvwindow (defining the valid time of the request), the valid time is currently relatively simple and uniformly fixed at a certain value.
When a request is received by the server, the timestamp in the request is checked to ensure it falls between 2 to 60 seconds. Any request with a timestamp older than 5,000 milliseconds is considered invalid. The time window value can be set using the optional parameter: “recvWindow”. Additionally, if the server determines that the client’s timestamp is more than one second ahead of the server, the request will also be invalid. Online conditions are not always 100% reliable in terms of the timeliness of trades, resulting in varying levels of latency between your local program and the Monochrome server. This is why we provide the “recvWindow” parameter - if you engage in high-frequency trading and require stricter transaction timeliness, you can adjust the “recvWindow” parameter to better meet your needs. Recvwindow longer than 5 seconds is not recommended. 5、Added algorithm (signature method/algorithm), the user calculates the signature according to the protocol of the hash, and HmacSHA256 is recommended. For those protocols that are supported, see the table below.

Signature generation

Take https://sapi.monochrome.exchange/v4/order as an example. The following is an example appkey and secret for placing an order using a call interface implemented by echo openssl and curl tools in the linux bash environment for demonstration purposes only: appKey: 3976eb88-76d0-4f6e-a6b2-a57980770085 secretKey: bc6630d0231fda5cd98794f52c4998659beda290 Header part data:
request data:
1.data part
Method example:
Path example:
Parameters passed query example:
Parameters via body example
Mixed use of query and body (divided into form and json format)
The most concatenated value of the entire data is spliced with method, path, query, and body by the # symbol to form #method, #path, #query, and #body, and the final spliced value is recorded as Y=#method#path#query#body. Notice:
2.request header part After the keys are in natural ascending alphabetical order, use & to join them together as X. like:
3.generate signature
4.example

API code library

Java connector A lightweight Java codebase that provides methods that allow users to directly call the API。 Sdks for each language:

response format

All interface returns are in JSON format.
Response

response code

Public module

Leader order request type

Copy trade user status

Leader type

Copy trade follow type

Copy stop loss position processing

FAQ

1.AUTH_ 105: The server verifies the request header parameters validate-timestamp (validTimeStamp) and validate-recvwindow (recvwindow) The following rules must be followed: dealTimeStamp (server time when the request is processed, in milliseconds) - validTimeStamp < recvwindow, otherwise AUTH_105 will be returned. To avoid this error, validate-timestamp recommends using the time when the request was sent, and it is measured in milliseconds. The validate-recvwindow is set a little larger