Skip to content

Instantly share code, notes, and snippets.

<td> <span class="badge badge-inverse"><%=st%></span></td>
<td><a class="btn btn-primary btn-mini trade-button"><strong><div id="<%=st%>b5p"><%=b5p%></div></strong><div id="<%=st%>b5v"><%=b5v%></div></a></td>
<td><a class="btn btn-primary btn-mini trade-button"><strong><div id="<%=st%>b4p"><%=b4p%></div></strong><div id="<%=st%>b4v"><%=b4v%></div></a></td>
<td><a class="btn btn-primary btn-mini trade-button"><strong><div id="<%=st%>b3p"><%=b3p%></div></strong><div id="<%=st%>b3v"><%=b3v%></div></a></td>
<td><a class="btn btn-primary btn-mini trade-button"><strong><div id="<%=st%>b2p"><%=b2p%></div></strong><div id="<%=st%>b2v"><%=b2v%></div></a></td>
<td><a class="btn btn-primary btn-mini trade-button"><strong><div id="<%=st%>b1p"><%=b1p%></div></strong><div id="<%=st%>b1v"><%=b1v%></div></a></td>
<td><a class="btn btn-success btn-mini trade-button"><strong><div id="<%=st%>tp"><%=tp%> </div></strong><div id="<%=st%>tv"><%=tv%></div></a></td>
<td><a class="btn btn-danger btn-mini trade-button"><strong><div id=
<table class="table table-bordered table-condensed">
<thead>
<tr>
<th>Stock</th>
<th>BID5</th>
<th>BID4</th>
<th>BID3</th>
<th>BID2</th>
<th>BID1</th>
<th>Trade</th>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script src="http://code.highcharts.com/stock/highstock.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
$.getJSON('/api/trades', function(data) {
// create the chart
chart = new Highcharts.StockChart({
chart : {
renderTo : 'container'
},
getDisplay: function(exchangeData) {
var options = {max: true};
var buyPrices = createBinaryHeap(options);
var sellPrices = createBinaryHeap(options);
var buys = exchangeData.buys;
var sells = exchangeData.sells;
if (sells) {
var exchange = require('./exchange');
module.exports = BinaryHeap;
function BinaryHeap(scoreFunction, options){
this.content = [];
if (options)
this.options = options;
else
this.options = {};
function createExchange(exchangeData) {
function init(exchange, orderType) {
if (!exchange[orderType]) {
exchange[orderType] = {};
exchange[orderType].volumes = {};
exchange[orderType].prices = createBinaryHeap();
}
}
'use strict';
var $ = require('jquery')
, BinaryHeap = require('./BinaryHeap');
var BUY = "buys", SELL = "sells";
function createBinaryHeap() {
return new BinaryHeap(function(x){return x;});
}
module.exports = BinaryHeap;
function BinaryHeap(scoreFunction){
this.content = [];
this.scoreFunction = scoreFunction;
}
BinaryHeap.prototype = {
peek: function() {