Esempio n. 1
0
 private void PrintOrderViews(OrderViewTestListener listener, params string[] symbols)
 {
     Console.WriteLine(string.Format("OrderViews, count: {0}", listener.GetOrderViewsCount()));
     foreach (string symbol in symbols)
         Console.WriteLine("    symbol {0}: snapshot size: {1}, updates size: {2}",
             symbol, listener.GetOrderViewEventsCount(symbol), listener.GetOrderViewUpdatesCount(symbol));
 }
Esempio n. 2
0
        public void TestAll()
        {
            TestListener          eventListener     = new TestListener(eventsTimeout, eventsSleepTime, IsConnected);
            SnapshotTestListener  snapshotListener  = new SnapshotTestListener(eventsTimeout, eventsSleepTime, IsConnected);
            OrderViewTestListener orderViewListener = new OrderViewTestListener(eventsTimeout, eventsSleepTime, IsConnected);
            EventType             events            = EventType.Order | EventType.Profile |
                                                      EventType.Quote | EventType.Summary | EventType.TimeAndSale | EventType.Series |
                                                      EventType.Trade;

            using (var con = new NativeConnection(address, OnDisconnect))
            {
                Interlocked.Exchange(ref isConnected, 1);
                using (IDxSubscription eventSubscription = con.CreateSubscription(events, eventListener),
                       candleSubscription = con.CreateSubscription(oneMonth, eventListener),
                       orderViewSubscription = con.CreateOrderViewSubscription(orderViewListener))
                    using (SnapshotCollection snapshotCollection = new SnapshotCollection(con, snapshotListener, snapshotCases))
                    {
                        eventSubscription.AddSymbols(eventSymbols);
                        candleSubscription.AddSymbol(CandleSymbol.ValueOf(candleSymbols[0]));
                        orderViewSubscription.AddSource(orderViewSources);
                        orderViewSubscription.AddSymbols(orderViewSymbols);

                        DateTime startTime = DateTime.Now;
                        while (testCommonTime >= (DateTime.Now - startTime).TotalMilliseconds)
                        {
                            Console.WriteLine();
                            PrintEvents <IDxCandle>(eventListener, candleSymbols);
                            PrintEvents <IDxOrder>(eventListener, eventSymbols);
                            PrintEvents <IDxProfile>(eventListener, eventSymbols);
                            PrintEvents <IDxQuote>(eventListener, eventSymbols);
                            PrintEvents <IDxSummary>(eventListener, eventSymbols);
                            PrintEvents <IDxTimeAndSale>(eventListener, eventSymbols);
                            PrintEvents <IDxSeries>(eventListener, eventSymbols);
                            PrintEvents <IDxTrade>(eventListener, eventSymbols);

                            PrintSnapshots <IDxOrder>(snapshotListener, snapshotCases);
                            PrintSnapshots <IDxCandle>(snapshotListener, snapshotCases);

                            PrintOrderViews(orderViewListener, orderViewSymbols);
                            Thread.Sleep(testPrintInterval);
                        }
                    }
            }
        }