Hi All
I have the following method:
/// <summary>
/// Calculates the last trade date.
/// </summary>
/// <param name="tradesDictionary">The trades dictionary.</param>
/// <returns>The last trade date.</returns>
public DateTime CalculateLastTradeDate(ConcurrentDictionary<Guid, TradeRecord> tradesDictionary)
{
// Calculate the last trade date
_lastTradeDate = (from tradeRecord in tradesDictionary
where (tradeRecord.Value.OrderRecord.PairRecord.Id == _pairId)
select tradeRecord.Value.Date)
.Max();
// Return _lastTradeDate
return _lastTradeDate;
}
which takes +- 129 seconds, i.e. +-2 minutes to execute on ConcurrentDictionary of 21353 objects in memory. Is there anything i can do in the query implemented by the above method, to drastically reduce it's execution time?
Any help would be appreciated!