2017-09-23 8 views
0

나는 GDAX API에 대한 Coinbase의 Github에서의 문서를보고 하트 비트 채널에 가입,하지만이 코드를 이용하면 아래의 오류와 함께 반환 유지하기 위해 노력하고있어 :GDAX 하트 비트 채널

var websocket = new Gdax.WebsocketClient(
    ['BTC-USD'], 
    'wss://ws-feed.gdax.com', 
    { 
     key: API_KEY, 
     secret: API_SECRET, 
     passphrase: API_PASSPHRASE, 
    }, 
    { heartbeat: true } 
) 
    webSocket.on('message', data => { 
    console.log(data); 
    }); 

을 오류 :

{ 
    type: 'error', 
    message: 'Failed to subscribe', 
    reason: 'You need to specify at least one product ID for channel heartbeat' 
} 

답변

0

Json 요청에 필드로 "product_ids" : ["BTC-GBP"]을 반드시 포함하십시오.

따라서이 같은 작동합니다 (자신의 API 문서에서)

{ 
    "type": "subscriptions", 
    "channels": [   
     { 
      "name": "heartbeat", 
      "product_ids": [ 
       "ETH-USD", 
       "ETH-EUR" 
      ], 
     } 
    ] 
} 

https://docs.gdax.com/#subscribe

여기를 참조하십시오