Skip to content

Instantly share code, notes, and snippets.

@nodeninja
Created May 23, 2012 13:09
Show Gist options
  • Save nodeninja/2775158 to your computer and use it in GitHub Desktop.
Save nodeninja/2775158 to your computer and use it in GitHub Desktop.
function createExchange(exchangeData) {
function init(exchange, orderType) {
if (!exchange[orderType]) {
exchange[orderType] = {};
exchange[orderType].volumes = {};
exchange[orderType].prices = createBinaryHeap();
}
}
var cloned = $.extend(true, {}, exchangeData);
cloned.trades = [];
init(cloned, BUY);
init(cloned, SELL);
return cloned;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment