コード例 #1
0
        public static void Main2(string[] args)
        {
            BTCCFIXClientApp     app          = new BTCCFIXClientApp();
            string               sessionFile  = Environment.CurrentDirectory + "/session_client.txt";
            SessionSettings      settings     = new SessionSettings(sessionFile);
            IMessageStoreFactory storeFactory = new FileStoreFactory(settings);
            ILogFactory          logFactory   = new FileLogFactory(settings);

            QuickFix.Transport.SocketInitiator initiator = new QuickFix.Transport.SocketInitiator(app, storeFactory, settings, logFactory);
            initiator.Start();

            BTCCMarketDataRequest btccDataRequest = new BTCCMarketDataRequest();

            System.Threading.Thread.Sleep(5000);
            //request full snapshot
            MarketDataRequest dataRequest = btccDataRequest.marketDataFullSnapRequest("BTCCNY");
            bool ret = Session.SendToTarget(dataRequest, app.m_sessionID);

            Console.WriteLine("SendToTarget ret={0}", ret);

            dataRequest = btccDataRequest.marketDataFullSnapRequest("LTCCNY");
            ret         = Session.SendToTarget(dataRequest, app.m_sessionID);
            Console.WriteLine("SendToTarget ret={0}", ret);

            dataRequest = btccDataRequest.marketDataFullSnapRequest("LTCBTC");
            ret         = Session.SendToTarget(dataRequest, app.m_sessionID);
            Console.WriteLine("SendToTarget ret={0}", ret);

            System.Threading.Thread.Sleep(15000);
            //request incremental request
            dataRequest = btccDataRequest.marketDataIncrementalRequest("BTCCNY");
            ret         = Session.SendToTarget(dataRequest, app.m_sessionID);
            Console.WriteLine("SendToTarget ret={0}", ret);

            dataRequest = btccDataRequest.marketDataIncrementalRequest("LTCCNY");
            ret         = Session.SendToTarget(dataRequest, app.m_sessionID);
            Console.WriteLine("SendToTarget ret={0}", ret);

            dataRequest = btccDataRequest.marketDataIncrementalRequest("LTCBTC");
            ret         = Session.SendToTarget(dataRequest, app.m_sessionID);
            Console.WriteLine("SendToTarget ret={0}", ret);

            System.Threading.Thread.Sleep(40000);
            //unsubscribe incremental request
            dataRequest = btccDataRequest.unsubscribeIncrementalRequest("BTCCNY");
            ret         = Session.SendToTarget(dataRequest, app.m_sessionID);
            Console.WriteLine("SendToTarget ret={0}", ret);

            dataRequest = btccDataRequest.unsubscribeIncrementalRequest("LTCCNY");
            ret         = Session.SendToTarget(dataRequest, app.m_sessionID);
            Console.WriteLine("SendToTarget ret={0}", ret);

            dataRequest = btccDataRequest.unsubscribeIncrementalRequest("LTCBTC");
            ret         = Session.SendToTarget(dataRequest, app.m_sessionID);
            Console.WriteLine("SendToTarget ret={0}", ret);
        }
コード例 #2
0
        public static void Main2(string[] args)
        {
            BTCCFIXClientApp app = new BTCCFIXClientApp();
            string sessionFile = Environment.CurrentDirectory+"/session_client.txt";
            SessionSettings settings = new SessionSettings(sessionFile);
            IMessageStoreFactory storeFactory = new FileStoreFactory(settings);
            ILogFactory logFactory = new FileLogFactory(settings);
            QuickFix.Transport.SocketInitiator initiator = new QuickFix.Transport.SocketInitiator(app, storeFactory, settings, logFactory);
            initiator.Start();

            BTCCMarketDataRequest btccDataRequest = new BTCCMarketDataRequest();

            System.Threading.Thread.Sleep(5000);
            //request full snapshot
            MarketDataRequest dataRequest = btccDataRequest.marketDataFullSnapRequest("BTCCNY");
            bool ret = Session.SendToTarget(dataRequest, app.m_sessionID);
            Console.WriteLine("SendToTarget ret={0}", ret);

            dataRequest = btccDataRequest.marketDataFullSnapRequest("LTCCNY");
            ret = Session.SendToTarget(dataRequest, app.m_sessionID);
            Console.WriteLine("SendToTarget ret={0}", ret);

            dataRequest = btccDataRequest.marketDataFullSnapRequest("LTCBTC");
            ret = Session.SendToTarget(dataRequest, app.m_sessionID);
            Console.WriteLine("SendToTarget ret={0}", ret);

            System.Threading.Thread.Sleep(15000);
            //request incremental request
            dataRequest = btccDataRequest.marketDataIncrementalRequest("BTCCNY");
            ret = Session.SendToTarget(dataRequest, app.m_sessionID);
            Console.WriteLine("SendToTarget ret={0}", ret);

            dataRequest = btccDataRequest.marketDataIncrementalRequest("LTCCNY");
            ret = Session.SendToTarget(dataRequest, app.m_sessionID);
            Console.WriteLine("SendToTarget ret={0}", ret);

            dataRequest = btccDataRequest.marketDataIncrementalRequest("LTCBTC");
            ret = Session.SendToTarget(dataRequest, app.m_sessionID);
            Console.WriteLine("SendToTarget ret={0}", ret);

            System.Threading.Thread.Sleep(40000);
            //unsubscribe incremental request
            dataRequest = btccDataRequest.unsubscribeIncrementalRequest("BTCCNY");
            ret = Session.SendToTarget(dataRequest, app.m_sessionID);
            Console.WriteLine("SendToTarget ret={0}", ret);

            dataRequest = btccDataRequest.unsubscribeIncrementalRequest("LTCCNY");
            ret = Session.SendToTarget(dataRequest, app.m_sessionID);
            Console.WriteLine("SendToTarget ret={0}", ret);

            dataRequest = btccDataRequest.unsubscribeIncrementalRequest("LTCBTC");
            ret = Session.SendToTarget(dataRequest, app.m_sessionID);
            Console.WriteLine("SendToTarget ret={0}", ret);
        }