Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Websocket API V2 #16

Open
tomeroto opened this issue Aug 22, 2018 · 6 comments
Open

Websocket API V2 #16

tomeroto opened this issue Aug 22, 2018 · 6 comments

Comments

@tomeroto
Copy link

Hi all,

I try to use bitcoinaverage from NPM to using V2 method.
When I call API for get ticket by this URL: https://apiv2.bitcoinaverage.com/websocket/v2/get_ticket

and set header according to this docs https://apiv2.bitcoinaverage.com/?shell#requests

but it just take response to long and get bad gateway.

I read some notes from the docs for V2, it says:

This is an integer value representing the unix epoch. This needs to be no more than 15 seconds different than our server time for the request to pass. This prevents replay attacks. If you wish to check our server time please use the "/constants/time" endpoint.

After I follow the instruction, and test run, it just get same response (BAD GATEWAY).

Please help.

@KolevDarko
Copy link
Contributor

Hi @tomeroto
We just published a new version 1.2.1 of our npm package: https://www.npmjs.com/package/bitcoinaverage
There is an example on connecting to websocket v2 in the documentation on the same link.
Basically you just need to use the new method: connectToTickerWebsocketV2.

Hope this helps and let us know if you run into any trouble.

Best regards,
Darko, Lead developer at BitcoinAverage.

@tomeroto
Copy link
Author

Hi @KolevDarko

Thank you for your response. I was update the package to version 1.2.1, but still get response below:

Error in BA response. Status Code: 502 body: <html>
<head><title>502 Bad Gateway</title></head>
<body bgcolor="white">
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx/1.10.3 (Ubuntu)</center>
</body>
</html>

Do you have sample implementation or step to go with enterprise api key?

@tachiba
Copy link

tachiba commented Oct 2, 2018

Same here.
Is there any update?

@shaun-ba
Copy link
Member

shaun-ba commented Oct 2, 2018

@tachiba Did the steps in @KolevDarko 's post not work?

@KolevDarko
Copy link
Contributor

KolevDarko commented Oct 2, 2018

Hey guys @tachiba @tomeroto , here is a full working example.

const ba = require('bitcoinaverage');
symbols = ['BTCUSD', 'ETHEUR'];
var pub = <public_key>
var secret = <secret_key>
function connect_ticker_v2(market, symbols) {
  var ws = ba.websocketClient(pub, secret);
  ws.connectToTickerWebsocketV2(market, symbols, function (response) {
        console.log("BTCUSD");
        console.log(response.data[market].BTCUSD);
        console.log("ETHEUR");
        console.log(response.data[market].ETHEUR);
      }, function (error) {
        console.log(error)
      },
      function () {
        console.log("Closed")
      }
  )
}
connect_ticker_v2('global', symbols);

@KolevDarko
Copy link
Contributor

In the future you can also email us directly at: info@bitcoinaverage.com or create an Jira issue here: https://support.bitcoinaverage.com/servicedesk/customer/portal/1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants