private bool DataEntryWithinFilter(PreAggSpecs spec, StockDataEntry data) { if (spec.type != StockType.Undefined) { if (!CheckStockType(spec.type, data.stockType, spec.stockTypeCompare)) { return(false); } } if (spec.direction != StockDirection.Undefined) { if (!CheckDirectionType(spec.direction, data.direction, spec.directionCompare)) { return(false); } } for (int i = 0; i < spec.holderCountry.Count; i++) { if (CheckHolderCountryType(spec.holderCountry[i], data.holderCountry, spec.countryCompare)) { return(true); } } return(false); }
public override void Execute(ref bool destroyAfterExecute) { int outstadindChunkContexts; string key; CriteriaSetObj workingCriteria = Global.criteriaSets[criteriaIndex]; RawDataChunk workingData = Global.parsedRawData[dataIndex]; PreAggSpecs myPreSpecs = workingCriteria.preAggObj; AggSpecs myAggSpecs = workingCriteria.aggSpecsObj; PostAggSpecs myPostSpecs = workingCriteria.postAggObj; uint rawDataRowId; for (int i = 0; i < workingData.chunkDataParsed.Count; i++) { StockDataEntry currStockEntry = workingData.chunkDataParsed[i]; if (DataEntryWithinFilter(myPreSpecs, currStockEntry)) { rawDataRowId = ((uint)dataIndex << 16) | ((uint)i); key = myAggSpecs.CreateAggKeyWithAggValues(currStockEntry); workingCriteria.AddValueToDictionary(yesterdayData, key, currStockEntry.precentageSharesHeld, currStockEntry.sharesHeld, currStockEntry.value, rawDataRowId); } } outstadindChunkContexts = Interlocked.Decrement(ref chunkCount); if (outstadindChunkContexts == 0) { Global.mainThreadWait.Set(); } }