Skip to content

Instantly share code, notes, and snippets.

@nengine
Created September 29, 2017 11:16
Show Gist options
  • Save nengine/e216c080988fca7cf4c3aa26f388f236 to your computer and use it in GitHub Desktop.
Save nengine/e216c080988fca7cf4c3aa26f388f236 to your computer and use it in GitHub Desktop.
vue
<template>
<div id="trades">
<p>{{ message }}</p>
<button @click='load'>Load data</button>
</div>
</template>
<script>
const Gdax = require('gdax');
const publicClient = new Gdax.PublicClient();
const websocket = new Gdax.WebsocketClient(['LTC-USD']);
export default {
data: function() {
return {
message: 'Hello from trades Vue'
}
},
methods: {
mounted: function() {
websocket.on('message', data => {
console.log(data);
});
},
load: function() {
publicClient.getProducts((error, response, data) => {
if (error) {
// handle the error
} else {
console.log(JSON.stringify(data));
}
});
}
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment