Build your own websocket event stream for crypto market data using Amberdata.io! Example code uses Amberdata's Websockets
Check out the demo page!
git clone git@github.com:amberdata/amberdata-example-marketdata.git
Go to amberdata.io and click "Get started"
Building with Amberdata.io is as simple as a few a few lines of code:
For Historical OHLCV -
let config = {headers: {"x-api-key": "YOUR_API_KEY_HERE"}};
const getHistoricalOHLCV = (pair) => axios.get(`https://web3api.io/api/v1/market/ohlcv/${pair}/historical`, config);
See source here.
For live order book updates -
// Create WebSocket connection.
const socket = new WebSocket('wss://ws.web3api.io?x-api-key=YOUR_API_KEY_HERE');
// Connection opened
socket.addEventListener('open', function (event) {
console.log('Connection opened - ', event);
socket.send(`{"jsonrpc":"2.0","id":0,"method":"subscribe","params":["market:orders",{"pair":"eth_btc","exchange":"gdax"}]}`);
});
// Listen for messages
socket.addEventListener('message', responseHandler);
See source here.
This project is licensed under the Apache Licence 2.0.