Market API

Login#

Request Parameters#

ParameterTypeRequiredDescription
opStringYesOperation, login
argsArrayYesList of subscribed channels
> apiKeyStringYesAPI Key
> passphraseStringYesAPI Key password
> timestampStringYesUnix Epoch time, the unit is seconds
> signStringYesSignature string

Response Parameters#

ParameterTypeDescription
eventStringOperation.login or error
codeStringError code
msgStringError message
connIdStringWebSocket connection ID

apiKey: Unique identification for invoking API. Requires users to apply one manually in the developer portal.

passphrase: API Key password

timestamp: the Unix Epoch time, the unit is seconds, e.g. 1704876947

sign: signature string, the signature algorithm is as follows:

First concatenate timestamp, method, requestPath, strings, then use HMAC SHA256 method to encrypt the concatenated string with SecretKey, and then perform Base64 encoding.

secretKey: The security key generated when the user applies for API Key, e.g. : 22582BD0CFF14C41EDBF1AB98506286D

Example of timestamp: const timestamp = '' + Date.now() / 1,000
Among sign example: sign=CryptoJS.enc.Base64.stringify(CryptoJS.HmacSHA256(timestamp +'GET'+'/users/self/verify', secretKey))
method: always 'GET'.
requestPath: always '/users/self/verify'

Tips

The request will expire 30 seconds after the timestamp. If your server time differs from the API server time, we recommend using the REST API to query the API server time and then set the timestamp.

Request Example#

shell
{
	"op": "login",
	"args": [{
		"apiKey": "985d5b66-57ce-40fb-b714-afc0b9787083",
		"passphrase": "123456",
		"timestamp": "1538054050",
		"sign": "7L+zFQ+CEgGu5rzCj4+BdV2/uUHGqddA9pI6ztsRRPs="
	}]
}

Response Example#

200

Successful Response Example

{
  "event": "login",
  "code": "0",
  "msg": "",
  "connId": "a4d3ae55"
}

Failure Response Example

{
  "event": "error",
  "code": "60009",
  "msg": "Login failed.",
  "connId": "a4d3ae55"
}