Exemple #1
0
        public void TestApplicationExtension()
        {
            var mockApp = new MockApplicationExt();

            session = new QuickFix.Session(mockApp, new QuickFix.MemoryStoreFactory(), sessionID,
                                           new QuickFix.DataDictionaryProvider(), new QuickFix.SessionSchedule(config), 0, new QuickFix.ScreenLogFactory(settings), new QuickFix.DefaultMessageFactory(), "blah");
            session.SetResponder(responder);
            session.CheckLatency = false;

            Logon();
            QuickFix.FIX42.NewOrderSingle order = new QuickFix.FIX42.NewOrderSingle(
                new QuickFix.Fields.ClOrdID("1"),
                new QuickFix.Fields.HandlInst(QuickFix.Fields.HandlInst.MANUAL_ORDER),
                new QuickFix.Fields.Symbol("IBM"),
                new QuickFix.Fields.Side(QuickFix.Fields.Side.BUY),
                new QuickFix.Fields.TransactTime(),
                new QuickFix.Fields.OrdType(QuickFix.Fields.OrdType.LIMIT));

            order.Header.SetField(new QuickFix.Fields.TargetCompID(sessionID.SenderCompID));
            order.Header.SetField(new QuickFix.Fields.SenderCompID(sessionID.TargetCompID));
            order.Header.SetField(new QuickFix.Fields.MsgSeqNum(2));

            session.Next(order.ToString());

            Assert.That(mockApp.InterceptedMessageTypes.Count, Is.EqualTo(2));
            Assert.True(mockApp.InterceptedMessageTypes.Contains(QuickFix.Fields.MsgType.LOGON));
            Assert.True(mockApp.InterceptedMessageTypes.Contains(QuickFix.Fields.MsgType.NEWORDERSINGLE));
        }
Exemple #2
0
        public void setup()
        {
            responder   = new MockResponder();
            sessionID   = new QuickFix.SessionID("FIX.4.2", "SENDER", "TARGET");
            application = new MockApplication();
            settings    = new QuickFix.SessionSettings();

            config = new QuickFix.Dictionary();
            config.SetBool(QuickFix.SessionSettings.PERSIST_MESSAGES, false);
            config.SetString(QuickFix.SessionSettings.CONNECTION_TYPE, "initiator");
            config.SetString(QuickFix.SessionSettings.START_TIME, "00:00:00");
            config.SetString(QuickFix.SessionSettings.END_TIME, "00:00:00");
            settings.Set(sessionID, config);

            session = new QuickFix.Session(application, new QuickFix.MemoryStoreFactory(), sessionID,
                                           new QuickFix.DataDictionaryProvider(), new QuickFix.SessionSchedule(config), 0, new QuickFix.ScreenLogFactory(settings), new QuickFix.DefaultMessageFactory(), "blah");
            session.SetResponder(responder);
            session.CheckLatency = false;

            // must be set for an initiator
            int heartBeatInterval = 10;

            session2 = new QuickFix.Session(application, new QuickFix.MemoryStoreFactory(), new QuickFix.SessionID("FIX.4.2", "OTHER_SENDER", "OTHER_TARGET"),
                                            new QuickFix.DataDictionaryProvider(), new QuickFix.SessionSchedule(config), heartBeatInterval, new QuickFix.ScreenLogFactory(settings), new QuickFix.DefaultMessageFactory(), "blah");
            session2.SetResponder(responder);
            session2.CheckLatency = false;

            seqNum = 1;
        }
Exemple #3
0
        public /*virtual*/ void OnLogon
            (QuickFix.SessionID fixSessionId
            )
        {
            try
            {
                System.Threading.Monitor.Enter(Common.Core.Threading.TThreadingHelpers.MainLockable);

                // Comment201704186 relates.
                System.Diagnostics.Debug.Assert(FixSession_ is null);

                // yg? Given that QuickFix is a piece of crap, this condition will not necessarily work well.
                // todo.1 Should I really comment the above?
                if (ShallBeLoggedIn_ && IsTryingToBeLoggedIn_ && (!ShallEnsureIsLoggedOut_))

                {
                    // yg? Comment201704152 applies.
                    QuickFix.Session fixSession = QuickFix.Session.LookupSession(fixSessionId);

                    //// <Comment201704186>
                    //// Let's double-check this, just in case...
                    //// </Comment201704186>
                    //System.Diagnostics.Debug.Assert(FixSession_ is null);

                    if (!(fixSession is null))
                    {
                        FixSession_ = fixSession;
                        LoggedInEvent?.Invoke();
                    }
                    else
                    {
                    }
                }
                else
                {
                }

                System.Threading.Monitor.Exit(Common.Core.Threading.TThreadingHelpers.MainLockable);
            }
Exemple #4
0
        public void setup()
        {
            responder = new MockResponder();
            sessionID = new QuickFix.SessionID("FIX.4.2", "SENDER", "TARGET");
            application = new MockApplication();
            settings = new QuickFix.SessionSettings();

            QuickFix.Dictionary config = new QuickFix.Dictionary();
            config.SetBool(QuickFix.SessionSettings.PERSIST_MESSAGES, false);
            config.SetString(QuickFix.SessionSettings.CONNECTION_TYPE, "initiator");
            config.SetString(QuickFix.SessionSettings.START_TIME, "00:00:00");
            config.SetString(QuickFix.SessionSettings.END_TIME, "00:00:00");
            settings.Set(sessionID, config);

            session = new QuickFix.Session(application, new QuickFix.MemoryStoreFactory(), sessionID,
                new QuickFix.DataDictionaryProvider(),new QuickFix.SessionSchedule(config), 0, new QuickFix.ScreenLogFactory(settings), new QuickFix.DefaultMessageFactory(), "blah");
            session.SetResponder(responder);
            session.CheckLatency = false;

            // must be set for an initiator
            int heartBeatInterval = 10;

            session2 = new QuickFix.Session(application, new QuickFix.MemoryStoreFactory(), new QuickFix.SessionID("FIX.4.2", "OTHER_SENDER", "OTHER_TARGET"),
                new QuickFix.DataDictionaryProvider(), new QuickFix.SessionSchedule(config), heartBeatInterval, new QuickFix.ScreenLogFactory(settings), new QuickFix.DefaultMessageFactory(), "blah");
            session2.SetResponder(responder);
            session2.CheckLatency = false;

            seqNum = 1;
        }
Exemple #5
0
 public void ProcessToApp(QuickFix.Message msg, QuickFix.Session session)
 {
 }
Exemple #6
0
        public void TestApplicationExtension()
        {
            var mockApp = new MockApplicationExt();
            session = new QuickFix.Session(mockApp, new QuickFix.MemoryStoreFactory(), sessionID,
                new QuickFix.DataDictionaryProvider(), new QuickFix.SessionSchedule(config), 0, new QuickFix.ScreenLogFactory(settings), new QuickFix.DefaultMessageFactory(), "blah");
            session.SetResponder(responder);
            session.CheckLatency = false;

            Logon();
            QuickFix.FIX42.NewOrderSingle order = new QuickFix.FIX42.NewOrderSingle(
                new QuickFix.Fields.ClOrdID("1"),
                new QuickFix.Fields.HandlInst(QuickFix.Fields.HandlInst.MANUAL_ORDER),
                new QuickFix.Fields.Symbol("IBM"),
                new QuickFix.Fields.Side(QuickFix.Fields.Side.BUY),
                new QuickFix.Fields.TransactTime(),
                new QuickFix.Fields.OrdType(QuickFix.Fields.OrdType.LIMIT));

            order.Header.SetField(new QuickFix.Fields.TargetCompID(sessionID.SenderCompID));
            order.Header.SetField(new QuickFix.Fields.SenderCompID(sessionID.TargetCompID));
            order.Header.SetField(new QuickFix.Fields.MsgSeqNum(2));

            session.Next(order.ToString());

            Assert.That(mockApp.InterceptedMessageTypes.Count, Is.EqualTo(2));
            Assert.True(mockApp.InterceptedMessageTypes.Contains(QuickFix.Fields.MsgType.LOGON));
            Assert.True(mockApp.InterceptedMessageTypes.Contains(QuickFix.Fields.MsgType.NEWORDERSINGLE));
        }