Created
August 26, 2015 07:08
-
-
Save adamrights/34e2affebf1e3e6a02b2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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