Skip to content
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.

Public market events

endpoint: https://socket.btcmarkets.net

sample code in node.js in order to receive tick events

varsocket=require('socket.io-client')('https://socket.btcmarkets.net',{secure: true,transports: ['websocket'],upgrade: false});varinstrument='BTC';varcurrency='AUD';vareventName='newTicker';varchannelName='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');});

sample tick event received via websocket

{volume24h: 56524541285,bestBid: 287602000000,bestAsk: 288817000000,lastPrice: 287602000000,timestamp: 1500349863621,currency: 'AUD',instrument: 'BTC'}

orderbook events

Use the following channel name and event name in order to receive orderbook events

varinstrument='BTC';varcurrency='AUD';vareventName='OrderBookChange';varchannelName='Orderbook_'+instrument+currency;

trade events

Use the following channel name and event name in order to receive trade events

varinstrument='BTC';varcurrency='AUD';vareventName='MarketTrade';varchannelName='TRADE_'+instrument+currency;

Account related Events

coming soon

Clone this wiki locally