개요
- 암호화폐 거래소 게이트아이오( gate.io ) 의 현물 종목들 ( 예 : BTC, ETH, XRP ,... ) 웹소켓 공통사항들.
Client Request
subscribe or unsubscribe requests initiated from the client follow a common JSON format, which contains the following fields:
Field | Type | Required | Description |
time | Integer | Yes | Request time in seconds. Gap between request time and server time must not exceed 60 seconds |
id | Integer | No | Optional request id which will be sent back by the server to help you identify which request the server responds to |
channel | String | Yes | WebSocket channel to subscribe to. |
auth | Auth | No | Authentication credentials for private channels. See Authentication section for details |
event | String | Yes | Channel operation event, i.e. subscribe, unsubscribe |
payload | Any | No | Optional request detail parameters |
Note that the type of payload is channel specific, but subscribe and unsubscribe payloads in one channel are in the same format. Take spot.orders for example, the payload format is a list of currency pairs interested. You can specify ["foo", "bar", "etc"] as subscribe payload to receive order updates about them. Then specify ["etc"] in unsubscribe payload later to exclude it from futures order updates.
Channel specific description below only gives the channel specific payload format for simplicity, but you need to send the full request to do channel subscription operations.
Request Example
{
"time": 1611541000,
"id": 123456789,
"channel": "spot.orders",
"event": "subscribe",
"payload": [
"BTC_USDT",
"GT_USDT"
],
"auth": {
"method": "api_key",
"KEY": "xxxx",
"SIGN": "xxxx"
}
}
Server Response
Server response includes both response to client requests and server-initiated message updates. Similar with request, server responses follow almost the same JSON format with client requests:
Field | Type | Description |
time | Integer | Response time in seconds. |
id | Integer | Request ID extracted from the client request payload if client request has one |
channel | String | WebSocket channel name |
event | String | Server side channel event(i.e., update) or event used in requests initiated from the client |
error | Error | Null if the server accepts the client request; otherwise, the detailed reason why request is rejected. |
result | Any | New data notification from the server, or response to client requests. Null if error is not null. |
Note: type of result is channel specific if it's server-initiated data update notification, but response to client subscription request always set the result to {"status": "success"}. To verify if subscription request is successful or not, you only need to check if error field is null. Parsing result field is not necessary.
Channel specific description below will only give the server-initiated data update notification format for simplicity.
server response example
{
"time": 1611541000,
"channel": "spot.orders",
"event": "subscribe",
"error": null,
"result": {
"status": "success"
}
}
Error
Error object has the following format:
Field | Type | Description |
code | Integer | Error code |
message | String | Detailed error reason |
In case of errors, you receive a message containing the proper error code and message within an error object. Possible errors includes:
code | message |
1 | Invalid request body format |
2 | Invalid argument provided |
3 | Server side error happened. |
연관
첫 등록 : 2022.05.08
최종 수정 :
단축 주소 : https://igotit.tistory.com/3629
'트레이딩 > 암호화폐' 카테고리의 다른 글
암호화폐 . 게이트아이오. API . 현물. 실시간 호가 (0) | 2022.05.08 |
---|---|
암호화폐 . 게이트아이오. API . 현물. 실시간 시세 (0) | 2022.05.08 |
암호화폐. 바이비트. API. 현물. 웹소켓. 잔고 실시간, outboundAccountInfo (0) | 2022.04.19 |
암호화폐. 바이비트. API. 현물. 잔고 요청. Get Wallet Balance (0) | 2022.04.18 |
암호화폐. 바이비트. API. 현물. 주문 송신. Place Active Order (1) | 2022.04.15 |
댓글