Websocket-Futures Orders Position

The interface supports two connection methods: token connection and apikey connection. Regardless of the connection and subscription method, the returned data message body is the same.


1. Token Connection

Overview: Carry the token in the request header to establish a connection with the backend. After the connection is established, send a message to subscribe. Only after a successful subscription can you receive pushed messages.

1.1 Request URL

wss://futuresws.exchange1.com/position_order/ws

1.2 Request Headers

Parameter Name
Type
Required
Description

token

string

Yes

Token generated after login

1.3 Message Body to Send

Parameter Name
Type
Required
Description

event

string

Yes

`sub` : subscribe message `unsub` : unsubscribe message

token

string

Yes

Token generated after login

broker

Integer

Yes

SaaS merchant ID

Example:

{
    "event": "sub",
    "token": "9a2fce1e96cb42e76aa9519ee26468cd6d58efddd67d4bc1a9a0fa128734c0fe",
    "broker": 1003
}

2. Apikey Connection

Overview: Carry the api-key in the request header to establish a connection with the backend. After the connection is established, send a message to subscribe. Only after a successful subscription can you receive pushed messages.

2.1 Request URL

2.2 Request Headers

Parameter Name
Type
Required
Description

api-key

string

Yes

User's Apikey

2.3 Message Body to Send

Parameter Name
Type
Required
Description

event

string

Yes

`sub` : subscribe message `unsub` : unsubscribe message

apiKey

string

Yes

Token generated after login

broker

Integer

Yes

SaaS merchant ID

Example:


3. Receiving Messages

  • After a successful connection, the backend returns: connect success

  • After a successful subscription, the backend returns: sub success

The actual message body is GZIP-compressed binary data, which needs to be parsed before it can be displayed properly. You can implement the parsing tool in your own language. Here is an online reference tool: https://www.bejson.com/encrypt/gzip/#google_vignettearrow-up-right

For example, the received binary Base64 data:

After parsing:


Message Field Descriptions

3.1 When Position or Account Changes

3.2 When User Holds a Position

3.3 When the System Closes

A fixed message will be pushed:

3.4 Normal Order

3.5 Trigger Order Return Data


4. Heartbeat

Ping every 30 seconds. If the server does not receive a ping for more than 40 seconds, it will actively disconnect.

  • Parameter sent: {"ping":1713338308232}

  • Response: {"pong":1713338308233}