Esempio n. 1
0
 public async Task StockQuoteUSSSETest(object[] symbols, bool UTP, StockQuoteSSEInterval interval)
 {
     using var sseClient = sandBoxClient.StockPrices.QuoteStream(
               symbols.Cast <string>(), UTP: UTP, interval: interval);
     sseClient.Error += (s, e) =>
     {
         sseClient.Close();
         Assert.Fail("EventSource Error Occurred. Details: {0}", e.Exception.Message);
     };
     sseClient.MessageReceived += (s, m) =>
     {
         sseClient.Close();
         Assert.Pass(m.ToString());
     };
     await sseClient.StartAsync();
 }
Esempio n. 2
0
        static string intervalString(StockQuoteSSEInterval interval)
        {
            switch (interval)
            {
            case StockQuoteSSEInterval.Firehose:
                return("");

            case StockQuoteSSEInterval.OneSecond:
                return("1Second");

            case StockQuoteSSEInterval.FiveSeconds:
                return("5Second");

            case StockQuoteSSEInterval.OneMinute:
                return("1Minute");

            default:
                throw new NotImplementedException();
            }
        }
Esempio n. 3
0
 public SSEClient <QuoteSSE> SubscribeStockQuotesUS(
     IEnumerable <string> symbols, bool UTP, StockQuoteSSEInterval interval) =>
 executorSSE.SymbolsSubscribeSSE <QuoteSSE>(
     UTP ? $"stocksUS{interval.GetDescriptionFromEnum()}" : $"stocksUSNoUTP{interval.GetDescriptionFromEnum()}", symbols);
Esempio n. 4
0
 public SSEClient <QuoteSSE> SubscribeStockQuoteUSSSE(
     IEnumerable <string> symbols, bool UTP, StockQuoteSSEInterval interval) => UTP?
 executorSSE.SymbolsSubscribeSSE <QuoteSSE>($"stocksUS{intervalString(interval)}", symbols, pk) :
     executorSSE.SymbolsSubscribeSSE <QuoteSSE>($"stocksUSNoUTP{intervalString(interval)}", symbols, pk);