Skip to content

Instantly share code, notes, and snippets.

@maxant
Last active January 6, 2026 13:03
Show Gist options
  • Select an option

  • Save maxant/1b71358b41bf2fabeb68 to your computer and use it in GitHub Desktop.

Select an option

Save maxant/1b71358b41bf2fabeb68 to your computer and use it in GitHub Desktop.
Trading cycle of engine
prepareMarket(self.market, timeout);
var sales = self.market.trade();
logger.info('trading completed');
noteMarketPricesAndVolumes(self.marketPrices, self.volumeRecords, sales);
persistSale(sales, function(err){
if(err) logger.warn(err);
else {
logger.info('persisting completed, notifying involved parties...');
_.each(sales, function(sale){
if(sale.buyer.event) sale.buyer.event(exports.EventType.PURCHASE, sale);
if(sale.seller.event) sale.seller.event(exports.EventType.SALE, sale);
});
}
...
setTimeout(loop, 0 + delay); //let the process handle other stuff too
...
});
}
@ilias133
Copy link
Copy Markdown

ilias133 commented Jan 6, 2026

goood

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment