private void ProcessSignals(DateTime ts, SystemState systemState, Func <Signal, StockPricesData, int, bool> signalSelector, Func <Signal, StockPricesData, int, float> openPriceSelector) { for (int i = 0; i < systemState.Signals.Count; i++) { VerifySignal(systemState.Signals[i]); if (systemState.Signals[i].Rebalance) { if (signalSelector(systemState.Signals[i], null, -1)) { ProcessRebalanceSignal(systemState.Signals[i], ts, systemState, openPriceSelector); } } else { (StockPricesData pricesData, int pricesDataIndex) = _dataLoader.GetPricesDataAndIndex(systemState.Signals[i].Stock.FullName, systemState.Signals[i].DataRange, systemState.Signals[i].IntradayInterval, ts); if (signalSelector(systemState.Signals[i], pricesData, pricesDataIndex)) { ProcessStandardSignal(systemState.Signals[i], ts, systemState, openPriceSelector, pricesData, pricesDataIndex); } } } }
private float CalculatePrice(string stockName, StockDataRange dataRange, int intradayInterval, Signal signal, DateTime ts, Func <Signal, StockPricesData, int, float> openPriceSelector) { (StockPricesData pricesData, int pricesDataIndex) = _dataLoader.GetPricesDataAndIndex(stockName, dataRange, intradayInterval, ts); return(openPriceSelector(signal, pricesData, pricesDataIndex)); }