예제 #1
0
        /// <summary>
        /// Example of detecting price drops larger than 10% in 7 days
        /// </summary>
        /// <param name="ericUSDStream"></param>
        /// <param name="outputConfig"></param>
        /// <param name="adapterStopSignal"></param>
        private static void bigLooserExample(CepStream<StockQuote> cepStream, Application application)
        {
            var bigLooserCepStream = (from e1 in cepStream
                                      from e2 in cepStream.ShiftEventTime(e => e.StartTime.AddDays(7))
                                      where e1.FieldID == "Close" && e2.FieldID == "Close"
                                      select new StockQuote()
                                      {
                                          StockID = "ERIC > 10% drop",
                                          FieldID = "Close",
                                          Value = (e1.Value - e2.Value) / e2.Value * 100
                                      }).Where(e => e.Value < -10);

            runQuery(bigLooserCepStream, application);
        }