Last active
January 6, 2026 13:03
-
-
Save maxant/1b71358b41bf2fabeb68 to your computer and use it in GitHub Desktop.
Trading cycle of engine
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
| 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 | |
| ... | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
goood