private TradeResult MakeMatch(AskOrder ask, List <BidOrder> bids) { bids = bids.OrderByDescending(e => e.Price).ThenBy(e => e.Date).ToList(); var items = new List <TradeLog>(); foreach (var bid in bids) { if (ask.Remain() == 0) { break; } var item = MakeMatch(bid, ask); items.Add(item); } return(items.Count > 0 ? TradeResult.Success(items) : TradeResult.None()); }
private TradeResult MakeMatch(BidOrder bid, List <AskOrder> asks) { asks = asks.OrderBy(e => e.Price).ThenBy(e => e.Date).ToList(); var items = new List <TradeLog>(); foreach (var ask in asks) { if (bid.Remain() == 0) { break; } var item = MakeMatch(bid, ask); items.Add(item); } return(items.Count > 0 ? TradeResult.Success(items) : TradeResult.None()); }