Order Process
Subscription Trade Messages:
1.Obtain token
Call the API: Get Token
Extract the `data` field from the response; this is the token.
2.Subscribe to Trade Messages:
Refer to the API documentation: Message Subscription
2.1 Establish Connection
PRE environment address: wss://pre-api-test.cmfbl.com/openapi-c/openMsg/{appId}
2.2 Send Login Message:
{"device":1,"head":{"lang":"en-US","msgType":"login","sendTime":1698299047686,"token":"dbe3d3e6-0b10-4bdc-9778-dfc76c6d9341app"},"seqId":3,"trace":"x-1698299047686-4"} 2.3 Send Subscription Message:
{"data":{"tradeTypes":"2"},"device":1,"head":{"lang":"en-US","msgType":"subscribe_asset","sendTime":1698299047686,"token":"dbe3d3e6-0b10-4bdc-9778-dfc76c6d9341app"},"seqId":5,"trace":"x-1698299047686-6"} 2.4 Send Heartbeat Message Every 15 Seconds to Maintain Connection:
{"device":1,"head":{"lang":"en-US","msgType":"ping","sendTime":1698299057667,"token":"dbe3d3e6-0b10-4bdc-9778-dfc76c6d9341app"},"seqId":7,"trace":"x-1698299057667-8"}Order Process:
1.Request Product Information:
Call the API: Product Brief DataExtract symbolId and symbolDigits for later use.
2.Request Customer Information:
Call the API: Query Customer InformationExtract accountId, digits, and currency from the entry in accountList with trade_type=2.
3.Place Order:
Call the API: Place Order
Example: http header:
http body:
4.Handle Response
Upon receiving a response from step 3, check if code is “0”. If it is, the order placement is successful. Extract the orderId field from the data and match it with the orderId in the trade message.
Trade Message Fields:
Last updated