예제 #1
0
        public void Run()
        {
            _ActiveBarrierOptionsByContract = GetActiveBarrierOptionsByContract();
            var client = new FuturesQuoteClient();

            client.Quotes += OnQuote;
        }
        public void Run()
        {
            _ActiveBarrierOptionsByContract = GetActiveBarrierOptionsByContract();
            var client = new FuturesQuoteClient();

            FuturesQuotesSource(client)
            .Select(q => new QuoteWithContract(q))
            .Where(IsValidContract)
            .SelectMany(BarrierBreachNotices)
            .Where(NoticeNotAlreadySent)
            .Subscribe(NotifyTheHumans);
        }
 private static IObservable <FuturesQuote> FuturesQuotesSource(FuturesQuoteClient client)
 {
     return(Observable
            .FromEvent <FuturesQuoteClient.QuoteHandler, FuturesQuote>(h => client.Quotes += h, h => client.Quotes -= h));
 }
예제 #4
0
 private static IObservable <FuturesQuote> FuturesQuotesSource(FuturesQuoteClient client)
 {
     // this is equivalent to FuturesQuoteClientWrapper, the reactive framework abstracts events for you :)
     return(Observable
            .FromEvent <FuturesQuoteClient.QuoteHandler, FuturesQuote>(h => client.Quotes += h, h => client.Quotes -= h));
 }
예제 #5
0
 public AntiCorruptionLayerObservableClient(FuturesQuoteClient client)
     : this(FuturesQuotesSource(client))
 {
 }