본문 바로가기
트레이딩/암호화폐

암호화폐 . 게이트아이오. API . 현물. 웹소켓 공통 사항

by i.got.it 2022. 5. 8.

 

개요

암호화폐 거래소 게이트아이오( gate.io ) 의  현물 종목들 ( 예 : BTCETHXRP  ,...  )   웹소켓 공통사항들. 

 

 

 

 

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.

 

 

 

연관 

 

 

 

암호화폐 . 게이트아이오. API . 현물. 실시간 시세

개요 - 암호화폐 거래소 게이트아이오( gate.io ) 의 현물 종목들 ( 예 : BTC, ETH, XRP ,... )  웹소켓 으로 실시간 시세 수신 웹소켓 subscribe 게이트아이오의 웹소켓 공통 규격 에서, channel 에 spot..

igotit.tistory.com

 

 

암호화폐. gate.io API 활용모음

API 주소정리 암호화폐 . 게이트아이오. API . 개요 . 주소 정리. 예제소스 게이트아이오 API 개요. - 암호화폐 거래소 게이트아이오 (gate.io) 에서 제공하는 API - 게이트아이오 거래소의 전체 종목(아

igotit.tistory.com

 

 

 


첫 등록 : 2022.05.08

최종 수정 : 

단축 주소 : https://igotit.tistory.com/3629

 


 

댓글



 

비트코인




암호화폐       외환/나스닥/골드         암호화폐/외환/나스닥/골드
     
현물 |선물 인버스 |선물 USDT       전략매니저(카피트레이딩)         프랍 트레이더 온라인 지원가능. MT4,MT5