-
Notifications
You must be signed in to change notification settings - Fork 30
Websocket
martin-nginio edited this page May 27, 2019
·
3 revisions
Note: this version of the WebSocket is being deprecated. Please refer to V2 for the latest documentation.
BTC Markets provides real-time public market as well as account related trading events using websocket.
endpoint: https://socket.btcmarkets.net
var socket = require('socket.io-client')('https://socket.btcmarkets.net', {secure: true, transports: ['websocket'], upgrade: false});
var instrument = 'BTC';
var currency = 'AUD';
var eventName = 'newTicker';
var channelName = 'Ticker-BTCMarkets-' + instrument + "-" + currency;
socket.on('connect', function(){
console.log('connected');
socket.emit('join', channelName);
});
socket.on(eventName, function(data){
console.log(data);
});
socket.on('disconnect', function(){
console.log('disconnected');
});
{ volume24h: 56524541285,
bestBid: 287602000000,
bestAsk: 288817000000,
lastPrice: 287602000000,
timestamp: 1500349863621,
currency: 'AUD',
instrument: 'BTC' }
Use the following channel name and event name in order to receive orderbook events
var instrument = 'BTC';
var currency = 'AUD';
var eventName = 'OrderBookChange';
var channelName = 'Orderbook_' + instrument + currency;
Use the following channel name and event name in order to receive trade events
var instrument = 'BTC';
var currency = 'AUD';
var eventName = 'MarketTrade';
var channelName = 'TRADE_' + instrument + currency;
coming soon
Introduction updated 9/28/18
WebSocket v1 deprecated
Market Data API updated 7/24/19
Trading API updated 08/19/19
Account API updated 3/14/19
Fund Transfer API updated 08/06/19