If you follow the book (specifically page 107), you're output won't look like the output in Figure 5.5. This is also true for the code in the repository.

The fix is as follows:

Code:
if (exchangeData.trades && exchangeData.trades.length > 0) {
	//nocklib.sendTrades(exchangeData.trades);
	var trades = exchangeData.trades.map(function(trade) {
		trade.init = (ord.type == exch.BUY) ? 'b' : 's';
		trade.stock = stocks[index];
		return trade;
	});
	nocklib.sendTrades(trades);
	db.insert('transactions', trades, function(err, trades) {
		pauseThenTrade();
	});
} else pauseThenTrade();