Published
Edited
Feb 6, 2018
3 stars
Insert cell
Insert cell
Insert cell
Insert cell
response = await fetch(`https://api.gdax.com/products`)
Insert cell
products = await response.json()
Insert cell
Insert cell
product = {
const id = `BTC-GBP`;
const response = await fetch(`https://api.gdax.com/products/${id}`);
return await response.json();
}
Insert cell
Insert cell
error = {
const order = {
size: `0.01`,
price: `0.100`,
side: `buy`,
product_id: `BTC-USD`
};
const response = await fetch(`https://api.gdax.com/orders`, {
method: 'POST',
body: JSON.stringify(order),
headers: new Headers({
'Content-Type': 'application/json'
})
});
return await response.json();
}
Insert cell
Insert cell
Insert cell
socket = {
const socket = new WebSocket('wss://ws-feed.gdax.com');
socket.onopen = () => {
const subscriptionRequest = {
type: 'subscribe',
product_ids: ['BTC-USD'],
channels: ['ticker']
};
socket.send(JSON.stringify(subscriptionRequest));
};
return socket;
}
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more