Skip to content

Instantly share code, notes, and snippets.

@adamrights
Created August 26, 2015 07:08
Show Gist options
  • Save adamrights/34e2affebf1e3e6a02b2 to your computer and use it in GitHub Desktop.
Save adamrights/34e2affebf1e3e6a02b2 to your computer and use it in GitHub Desktop.
<html>
<head>
<title>OboeJS demo</title>
<script src="https://rawgit.com/jimhigson/oboe.js/v2.1.2/dist/oboe-browser.min.js"></script>
</head>
<body>
<div ></div>
<ul id="content">
<li>AUD_CAD:</li>
</ul>
<script>
var ele = document.getElementById("content");
oboe('http://stream-sandbox.oanda.com/v1/prices?accountId=12345&instruments=AUD_CAD%2CAUD_CHF')
.node('tick', function(things) {
var span = document.createElement('li');
span.innerText = "instrument: "+things.instrument+", time: "+things.time+", bid: "+things.bid+", ask: "+things.ask;
ele.appendChild(span);
console.log( 'Got tick', things);
})
.node('heartbeat', function(things) {
console.log( 'Got heartbeat', things);
})
.fail(function() {
console.log( 'Oops');
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment