Name/value pairs used for specifying groups of settings
상속: System.Collections.IEnumerable
예제 #1
0
        public void ValueEquality()
        {
            QuickFix.Dictionary first  = new QuickFix.Dictionary("Name");
            QuickFix.Dictionary second = new QuickFix.Dictionary("Name");
            Assert.True(first.Equals(second));

            first.SetString("THIRDKEY", "FIRST");
            second.SetString("THIRDKEY", "SECOND");
            Assert.False(first.Equals(second));

            first.SetString("THIRDKEY", "SECOND");
            Assert.True(first.Equals(second));

            first.SetString("FIRSTKEY", "FIRSTVALUE");
            second.SetString("SECONDKEY", "SECONDVALUE");
            Assert.False(first.Equals(second));

            first.SetString("SECONDKEY", "SECONDVALUE");
            second.SetString("FIRSTKEY", "FIRSTVALUE");
            Assert.True(first.Equals(second));

            QuickFix.Dictionary third  = new QuickFix.Dictionary("Name1");
            QuickFix.Dictionary fourth = new QuickFix.Dictionary("Name2");
            Assert.False(third.Equals(fourth));
        }
예제 #2
0
        public void SetGetDay()
        {
            QuickFix.Dictionary d = new QuickFix.Dictionary();

            d.SetString("DAY1", "SU");
            d.SetString("DAY2", "MO");
            d.SetString("DAY3", "TU");
            d.SetString("DAY4", "WE");
            d.SetString("DAY5", "TH");
            d.SetString("DAY6", "FR");
            d.SetString("DAY7", "SA");
            Assert.That(d.GetDay("DAY1"), Is.EqualTo(System.DayOfWeek.Sunday));
            Assert.That(d.GetDay("DAY2"), Is.EqualTo(System.DayOfWeek.Monday));
            Assert.That(d.GetDay("DAY3"), Is.EqualTo(System.DayOfWeek.Tuesday));
            Assert.That(d.GetDay("DAY4"), Is.EqualTo(System.DayOfWeek.Wednesday));
            Assert.That(d.GetDay("DAY5"), Is.EqualTo(System.DayOfWeek.Thursday));
            Assert.That(d.GetDay("DAY6"), Is.EqualTo(System.DayOfWeek.Friday));
            Assert.That(d.GetDay("DAY7"), Is.EqualTo(System.DayOfWeek.Saturday));

            d.SetDay("NEXTDAY1", System.DayOfWeek.Sunday);
            d.SetDay("NEXTDAY2", System.DayOfWeek.Monday);
            d.SetDay("NEXTDAY3", System.DayOfWeek.Tuesday);
            d.SetDay("NEXTDAY4", System.DayOfWeek.Wednesday);
            d.SetDay("NEXTDAY5", System.DayOfWeek.Thursday);
            d.SetDay("NEXTDAY6", System.DayOfWeek.Friday);
            d.SetDay("NEXTDAY7", System.DayOfWeek.Saturday);
            Assert.That(d.GetDay("NEXTDAY1"), Is.EqualTo(System.DayOfWeek.Sunday));
            Assert.That(d.GetDay("NEXTDAY2"), Is.EqualTo(System.DayOfWeek.Monday));
            Assert.That(d.GetDay("NEXTDAY3"), Is.EqualTo(System.DayOfWeek.Tuesday));
            Assert.That(d.GetDay("NEXTDAY4"), Is.EqualTo(System.DayOfWeek.Wednesday));
            Assert.That(d.GetDay("NEXTDAY5"), Is.EqualTo(System.DayOfWeek.Thursday));
            Assert.That(d.GetDay("NEXTDAY6"), Is.EqualTo(System.DayOfWeek.Friday));
            Assert.That(d.GetDay("NEXTDAY7"), Is.EqualTo(System.DayOfWeek.Saturday));
        }
예제 #3
0
 private void Set(SessionID sessionID, QuickFix.Dictionary settings)
 {
     if (Has(sessionID))
     {
         throw new ConfigError("Duplicate Session " + sessionID.ToString());
     }
     settings.SetString(SessionSettings.BEGINSTRING, sessionID.BeginString);
     settings.SetString(SessionSettings.SENDERCOMPID, sessionID.SenderCompID);
     if (SessionID.IsSet(sessionID.SenderSubID))
     {
         settings.SetString(SessionSettings.SENDERSUBID, sessionID.SenderSubID);
     }
     if (SessionID.IsSet(sessionID.SenderLocationID))
     {
         settings.SetString(SessionSettings.SENDERLOCID, sessionID.SenderLocationID);
     }
     settings.SetString(SessionSettings.TARGETCOMPID, sessionID.TargetCompID);
     if (SessionID.IsSet(sessionID.TargetSubID))
     {
         settings.SetString(SessionSettings.TARGETSUBID, sessionID.TargetSubID);
     }
     if (SessionID.IsSet(sessionID.TargetLocationID))
     {
         settings.SetString(SessionSettings.TARGETLOCID, sessionID.TargetLocationID);
     }
     settings.Merge(defaults_);
     Validate(settings);
     settings_[sessionID] = settings;
 }
예제 #4
0
        public void SetGetDay()
        {
            QuickFix.Dictionary d = new QuickFix.Dictionary();

            d.SetString("DAY1", "SU");
            d.SetString("DAY2", "MO");
            d.SetString("DAY3", "TU");
            d.SetString("DAY4", "WE");
            d.SetString("DAY5", "TH");
            d.SetString("DAY6", "FR");
            d.SetString("DAY7", "SA");
            Assert.That(d.GetDay("DAY1"), Is.EqualTo(System.DayOfWeek.Sunday));
            Assert.That(d.GetDay("DAY2"), Is.EqualTo(System.DayOfWeek.Monday));
            Assert.That(d.GetDay("DAY3"), Is.EqualTo(System.DayOfWeek.Tuesday));
            Assert.That(d.GetDay("DAY4"), Is.EqualTo(System.DayOfWeek.Wednesday));
            Assert.That(d.GetDay("DAY5"), Is.EqualTo(System.DayOfWeek.Thursday));
            Assert.That(d.GetDay("DAY6"), Is.EqualTo(System.DayOfWeek.Friday));
            Assert.That(d.GetDay("DAY7"), Is.EqualTo(System.DayOfWeek.Saturday));

            d.SetDay("NEXTDAY1", System.DayOfWeek.Sunday);
            d.SetDay("NEXTDAY2", System.DayOfWeek.Monday);
            d.SetDay("NEXTDAY3", System.DayOfWeek.Tuesday);
            d.SetDay("NEXTDAY4", System.DayOfWeek.Wednesday);
            d.SetDay("NEXTDAY5", System.DayOfWeek.Thursday);
            d.SetDay("NEXTDAY6", System.DayOfWeek.Friday);
            d.SetDay("NEXTDAY7", System.DayOfWeek.Saturday);
            Assert.That(d.GetDay("NEXTDAY1"), Is.EqualTo(System.DayOfWeek.Sunday));
            Assert.That(d.GetDay("NEXTDAY2"), Is.EqualTo(System.DayOfWeek.Monday));
            Assert.That(d.GetDay("NEXTDAY3"), Is.EqualTo(System.DayOfWeek.Tuesday));
            Assert.That(d.GetDay("NEXTDAY4"), Is.EqualTo(System.DayOfWeek.Wednesday));
            Assert.That(d.GetDay("NEXTDAY5"), Is.EqualTo(System.DayOfWeek.Thursday));
            Assert.That(d.GetDay("NEXTDAY6"), Is.EqualTo(System.DayOfWeek.Friday));
            Assert.That(d.GetDay("NEXTDAY7"), Is.EqualTo(System.DayOfWeek.Saturday));
        }
예제 #5
0
        public void SetGetDay()
        {
            QuickFix.Dictionary d = new QuickFix.Dictionary();

            d.SetString("DAY1", "SU");
            d.SetString("DAY2", "MO");
            d.SetString("DAY3", "TU");
            d.SetString("DAY4", "WE");
            d.SetString("DAY5", "TH");
            d.SetString("DAY6", "FR");
            d.SetString("DAY7", "SA");
            Assert.That(d.GetDay("DAY1"), Is.EqualTo(1));
            Assert.That(d.GetDay("DAY2"), Is.EqualTo(2));
            Assert.That(d.GetDay("DAY3"), Is.EqualTo(3));
            Assert.That(d.GetDay("DAY4"), Is.EqualTo(4));
            Assert.That(d.GetDay("DAY5"), Is.EqualTo(5));
            Assert.That(d.GetDay("DAY6"), Is.EqualTo(6));
            Assert.That(d.GetDay("DAY7"), Is.EqualTo(7));

            d.SetDay("NEXTDAY1", 1);
            d.SetDay("NEXTDAY2", 2);
            d.SetDay("NEXTDAY3", 3);
            d.SetDay("NEXTDAY4", 4);
            d.SetDay("NEXTDAY5", 5);
            d.SetDay("NEXTDAY6", 6);
            d.SetDay("NEXTDAY7", 7);
            Assert.That(d.GetDay("NEXTDAY1"), Is.EqualTo(1));
            Assert.That(d.GetDay("NEXTDAY2"), Is.EqualTo(2));
            Assert.That(d.GetDay("NEXTDAY3"), Is.EqualTo(3));
            Assert.That(d.GetDay("NEXTDAY4"), Is.EqualTo(4));
            Assert.That(d.GetDay("NEXTDAY5"), Is.EqualTo(5));
            Assert.That(d.GetDay("NEXTDAY6"), Is.EqualTo(6));
            Assert.That(d.GetDay("NEXTDAY7"), Is.EqualTo(7));
        }
예제 #6
0
 private void Set(QuickFix.Dictionary defaults)
 {
     defaults_ = defaults;
     foreach (KeyValuePair <SessionID, QuickFix.Dictionary> entry in settings_)
     {
         entry.Value.Merge(defaults_);
     }
 }
예제 #7
0
 public void SetGetString()
 {
     QuickFix.Dictionary d = new QuickFix.Dictionary();
     d.SetString("STRINGKEY1", "STRINGVALUE1");
     d.SetString("STRINGKEY2", "stringvalue2");
     Assert.That(d.GetString("STRINGKEY1"), Is.EqualTo("STRINGVALUE1"));
     Assert.That(d.GetString("STRINGKEY2"), Is.EqualTo("stringvalue2"));
     Assert.That(d.GetString("STRINGKEY2", true), Is.EqualTo("STRINGVALUE2"));
     Assert.Throws<ConfigError>(delegate { d.GetString("STRINGKEY3"); });
 }
예제 #8
0
 Dictionary CreateSessionConfig(string targetCompID, bool isInitiator)
 {
     Dictionary settings = new Dictionary();
     settings.SetString(SessionSettings.CONNECTION_TYPE, isInitiator ? "initiator" : "acceptor");
     settings.SetString(SessionSettings.USE_DATA_DICTIONARY, "N");
     settings.SetString(SessionSettings.START_TIME, "12:00:00");
     settings.SetString(SessionSettings.END_TIME, "12:00:00");
     settings.SetString(SessionSettings.HEARTBTINT, "300");
     return settings;
 }
예제 #9
0
 public void SetGetString()
 {
     QuickFix.Dictionary d = new QuickFix.Dictionary();
     d.SetString("STRINGKEY1", "STRINGVALUE1");
     d.SetString("STRINGKEY2", "stringvalue2");
     Assert.That(d.GetString("STRINGKEY1"), Is.EqualTo("STRINGVALUE1"));
     Assert.That(d.GetString("STRINGKEY2"), Is.EqualTo("stringvalue2"));
     Assert.That(d.GetString("STRINGKEY2", true), Is.EqualTo("STRINGVALUE2"));
     Assert.Throws <ConfigError>(delegate { d.GetString("STRINGKEY3"); });
 }
예제 #10
0
 public void SetGetDouble()
 {
     QuickFix.Dictionary d = new QuickFix.Dictionary();
     d.SetDouble("DOUBLEKEY1", 12.3);
     d.SetDouble("DOUBLEKEY2", 987362.987362);
     d.SetString("BADDOUBLEKEY", "AB12.3");
     Assert.That(d.GetDouble("DOUBLEKEY1"), Is.EqualTo(12.3));
     Assert.That(d.GetDouble("DOUBLEKEY2"), Is.EqualTo(987362.987362));
     Assert.Throws<ConfigError>(delegate { d.GetDouble("DOUBLEKEY3"); });
     Assert.Throws<ConfigError>(delegate { d.GetDouble("BADDOUBLEKEY"); });
 }
예제 #11
0
 public void SetGetLong()
 {
     QuickFix.Dictionary d = new QuickFix.Dictionary();
     d.SetLong("LONGKEY1", 12);
     d.SetLong("LONGKEY2", 987362);
     d.SetString("BADLONGKEY", "AB12");
     Assert.That(d.GetLong("LONGKEY1"), Is.EqualTo(12));
     Assert.That(d.GetLong("LONGKEY2"), Is.EqualTo(987362));
     Assert.Throws<ConfigError>(delegate { d.GetLong("LONGKEY3"); });
     Assert.Throws<ConfigError>(delegate { d.GetLong("BADLONGKEY"); });
 }
예제 #12
0
 public void SetGetBool()
 {
     QuickFix.Dictionary d = new QuickFix.Dictionary();
     d.SetBool("BOOLKEY1", true);
     d.SetBool("BOOLKEY2", false);
     d.SetString("BADBOOLKEY2", "YO");
     Assert.That(d.GetBool("BOOLKEY1"), Is.True);
     Assert.That(d.GetBool("BOOLKEY2"), Is.False);
     Assert.Throws<ConfigError>(delegate { d.GetBool("BOOLKEY3"); });
     Assert.Throws<ConfigError>(delegate { d.GetBool("BADBOOLKEY2"); });
 }
예제 #13
0
 public void SetGetBool()
 {
     QuickFix.Dictionary d = new QuickFix.Dictionary();
     d.SetBool("BOOLKEY1", true);
     d.SetBool("BOOLKEY2", false);
     d.SetString("BADBOOLKEY2", "YO");
     Assert.That(d.GetBool("BOOLKEY1"), Is.True);
     Assert.That(d.GetBool("BOOLKEY2"), Is.False);
     Assert.Throws <ConfigError>(delegate { d.GetBool("BOOLKEY3"); });
     Assert.Throws <ConfigError>(delegate { d.GetBool("BADBOOLKEY2"); });
 }
        public bool StartSession(string strHostName, int nPort, string strSenderCompID, string strTargetCompID, string strPassword)
        {
            try
            {
                if (!IsPortOpen(strHostName, nPort, new TimeSpan(0, 0, 10)))
                {
                    return(false);
                }

                string strAppDirPath = Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath);

                QuickFix.Dictionary dicConfig = new QuickFix.Dictionary();
                dicConfig.SetString("ConnectionType", "initiator");
                dicConfig.SetDay("StartDay", DayOfWeek.Sunday);
                dicConfig.SetString("StartTime", "00:00:00");
                dicConfig.SetDay("EndDay", DayOfWeek.Saturday);
                dicConfig.SetString("EndTime", "00:00:00");
                dicConfig.SetDouble("HeartBtInt", 20);
                dicConfig.SetDouble("ReconnectInterval", 10);
                dicConfig.SetBool("ResetOnLogout", true);
                dicConfig.SetBool("ResetOnLogon", true);
                dicConfig.SetBool("ResetOnDisconnect", true);
                dicConfig.SetBool("ResetSeqNumFlag", true);
                dicConfig.SetDouble("EncryptMethod", 0);
                dicConfig.SetBool("CheckLatency", false);
                dicConfig.SetString("FileStorePath", strAppDirPath + "/Store/Ctrader_Price");
                dicConfig.SetString("FileLogPath", strAppDirPath + "/Log");
                dicConfig.SetBool("UseDataDictionary", true);
                dicConfig.SetString("DataDictionary", strAppDirPath + "/Settings/FIX44-OneZero.xml");
                dicConfig.SetBool("ScreenLogShowIncoming", false);
                dicConfig.SetBool("ScreenLogShowOutgoing", false);
                dicConfig.SetString("Password", strPassword);

                SessionID           quoteSessionID  = new SessionID("FIX.4.4", strSenderCompID, strTargetCompID);
                QuickFix.Dictionary dicQuoteSession = new QuickFix.Dictionary();
                dicQuoteSession.SetString("SocketConnectHost", strHostName);
                dicQuoteSession.SetDouble("SocketConnectPort", nPort);

                settings = new SessionSettings();
                settings.Set(dicConfig);
                settings.Set(quoteSessionID, dicQuoteSession);

                FileStoreFactory storeFactory = new FileStoreFactory(settings);
                ScreenLogFactory logFactory   = new ScreenLogFactory(settings);
                initiator = new SocketInitiator(this, storeFactory, settings, logFactory);
                initiator.Start();
                return(true);
            }
            catch (System.Exception e)
            {
                Console.WriteLine(e.Message);
                return(false);
            }
        }
예제 #15
0
 public void SetGetLong()
 {
     QuickFix.Dictionary d = new QuickFix.Dictionary();
     d.SetLong("LONGKEY1", 12);
     d.SetLong("LONGKEY2", 987362);
     d.SetString("BADLONGKEY", "AB12");
     Assert.That(d.GetLong("LONGKEY1"), Is.EqualTo(12));
     Assert.That(d.GetLong("LONGKEY2"), Is.EqualTo(987362));
     Assert.Throws <ConfigError>(delegate { d.GetLong("LONGKEY3"); });
     Assert.Throws <ConfigError>(delegate { d.GetLong("BADLONGKEY"); });
 }
예제 #16
0
 public void SetGetDouble()
 {
     QuickFix.Dictionary d = new QuickFix.Dictionary();
     d.SetDouble("DOUBLEKEY1", 12.3);
     d.SetDouble("DOUBLEKEY2", 987362.987362);
     d.SetString("BADDOUBLEKEY", "AB12.3");
     Assert.That(d.GetDouble("DOUBLEKEY1"), Is.EqualTo(12.3));
     Assert.That(d.GetDouble("DOUBLEKEY2"), Is.EqualTo(987362.987362));
     Assert.Throws <ConfigError>(delegate { d.GetDouble("DOUBLEKEY3"); });
     Assert.Throws <ConfigError>(delegate { d.GetDouble("BADDOUBLEKEY"); });
 }
예제 #17
0
        public void SetDouble()
        {
            // make sure that QF/n uses the invariant culture, no matter what the current culture is
            System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("fr-FR");

            QuickFix.Dictionary d = new QuickFix.Dictionary();
            d.SetDouble("DOUBLEKEY1", 12.3);
            d.SetDouble("DOUBLEKEY2", 987362.987362);

            Assert.AreEqual("12.3", d.GetString("DOUBLEKEY1"));
            Assert.AreEqual("987362.987362", d.GetString("DOUBLEKEY2"));
        }
예제 #18
0
        public void SetDouble()
        {
            // make sure that QF/n uses the invariant culture, no matter what the current culture is
            System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("fr-FR");

            QuickFix.Dictionary d = new QuickFix.Dictionary();
            d.SetDouble("DOUBLEKEY1", 12.3);
            d.SetDouble("DOUBLEKEY2", 987362.987362);

            Assert.AreEqual("12.3", d.GetString("DOUBLEKEY1"));
            Assert.AreEqual("987362.987362", d.GetString("DOUBLEKEY2"));
        }
예제 #19
0
 Dictionary CreateSessionConfig(string targetCompID, bool isInitiator)
 {
     Dictionary settings = new Dictionary();
     settings.SetString(SessionSettings.CONNECTION_TYPE, isInitiator ? "initiator" : "acceptor");
     settings.SetString(SessionSettings.USE_DATA_DICTIONARY, "N");
     settings.SetString(SessionSettings.START_TIME, "12:00:00");
     settings.SetString(SessionSettings.END_TIME, "12:00:00");
     settings.SetString(SessionSettings.HEARTBTINT, "300");
     settings.SetString(SessionSettings.SOCKET_CONNECT_HOST, Host);
     settings.SetString(SessionSettings.SOCKET_CONNECT_PORT, ConnectPort.ToString());
     settings.SetString(SessionSettings.SOCKET_ACCEPT_HOST, Host);
     settings.SetString(SessionSettings.SOCKET_ACCEPT_PORT, AcceptPort.ToString());
     return settings;
 }
예제 #20
0
        /// <summary>
        /// Add new session as an ad-hoc (dynamic) operation
        /// </summary>
        /// <param name="sessionID">ID of new session<param>
        /// <param name="dict">config settings for new session</param></param>
        /// <returns>true if session added successfully, false if session already exists or is not an initiator</returns>
        public bool AddSession(SessionID sessionID, Dictionary dict)
        {
            lock (_settings)
                if (!_settings.Has(sessionID)) // session won't be in settings if ad-hoc creation after startup
                    _settings.Set(sessionID, dict); // need to to this here to merge in default config settings
                else
                    return false; // session already exists

            if (CreateSession(sessionID, dict))
                return true;

            lock (_settings) // failed to create new session
                _settings.Remove(sessionID);
            return false;
        }
예제 #21
0
        public void Merge()
        {
            QuickFix.Dictionary first = new QuickFix.Dictionary();
            first.SetString("FIRSTKEY", "FIRSTVALUE");
            first.SetString("THIRDKEY", "FIRST");

            QuickFix.Dictionary second = new QuickFix.Dictionary();
            second.SetString("SECONDKEY", "SECONDVALUE");
            second.SetString("THIRDKEY", "SECOND");

            first.Merge(second);
            Assert.That(first.GetString("FIRSTKEY"), Is.EqualTo("FIRSTVALUE"));
            Assert.That(first.GetString("SECONDKEY"), Is.EqualTo("SECONDVALUE"));
            Assert.That(first.GetString("THIRDKEY"), Is.EqualTo("FIRST"));
        }
예제 #22
0
        public void Merge()
        {
            QuickFix.Dictionary first = new QuickFix.Dictionary();
            first.SetString("FIRSTKEY", "FIRSTVALUE");
            first.SetString("THIRDKEY", "FIRST");

            QuickFix.Dictionary second = new QuickFix.Dictionary();
            second.SetString("SECONDKEY", "SECONDVALUE");
            second.SetString("THIRDKEY", "SECOND");

            first.Merge(second);
            Assert.That(first.GetString("FIRSTKEY"), Is.EqualTo("FIRSTVALUE"));
            Assert.That(first.GetString("SECONDKEY"), Is.EqualTo("SECONDVALUE"));
            Assert.That(first.GetString("THIRDKEY"), Is.EqualTo("FIRST"));
        }
예제 #23
0
        public void ValidConfiguration()
        {
            Application app = new NullApplication();
            MessageStoreFactory storeFactory = new MemoryStoreFactory();
            SessionFactory factory = new SessionFactory(app, storeFactory);

            SessionID sessionID = new SessionID("FIX.4.2", "SENDER", "TARGET");
            Dictionary settings = new Dictionary();
            settings.SetString(SessionSettings.CONNECTION_TYPE, "initiator");
            settings.SetString(SessionSettings.USE_DATA_DICTIONARY, "N");
            settings.SetString(SessionSettings.START_TIME, "12:00:00");
            settings.SetString(SessionSettings.END_TIME, "12:00:00");
            settings.SetString(SessionSettings.HEARTBTINT, "30");

            Assert.DoesNotThrow(delegate { factory.Create(sessionID, settings); });
        }
예제 #24
0
        public void setup()
        {
            sessionID = new QuickFix.SessionID("FIX.4.2", "SENDERCOMP", "TARGETCOMP");
            Wipe();

            QuickFix.Dictionary config = new QuickFix.Dictionary();
            config.SetString(QuickFix.SessionSettings.CONNECTION_TYPE, "initiator");
            config.SetString(QuickFix.SessionSettings.DATABASE_STORE_CONNECTION_STRING, connectionString);

            settings = new QuickFix.SessionSettings();
            settings.Set(sessionID, config);
            factory = new QuickFix.DatabaseStoreFactory(settings);
            settings.Set(config);

            store = (QuickFix.DatabaseStore)factory.Create(sessionID, new NullLog());
        }
예제 #25
0
        public void GetDouble()
        {
            // make sure that QF/n uses the invariant culture, no matter what the current culture is
            System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("fr-FR");

            QuickFix.Dictionary d = new QuickFix.Dictionary();
            d.SetString("DOUBLEKEY1", "12.3");
            d.SetString("DOUBLEKEY2", "987362.987362");
            d.SetString("BADDOUBLEKEY", "AB12.3");
            d.SetString("FOREIGNFORMAT", "44,44");

            Assert.That(d.GetDouble("DOUBLEKEY1"), Is.EqualTo(12.3));
            Assert.That(d.GetDouble("DOUBLEKEY2"), Is.EqualTo(987362.987362));
            Assert.Throws <ConfigError>(delegate { d.GetDouble("DOUBLEKEY3"); });
            Assert.Throws <ConfigError>(delegate { d.GetDouble("BADDOUBLEKEY"); });
            Assert.Throws <ConfigError>(delegate { d.GetDouble("BADDOUBLEKEY"); });
        }
예제 #26
0
 /// <summary>
 /// Add new session, either at start-up or as an ad-hoc operation
 /// </summary>
 /// <param name="sessionID">ID of new session<param>
 /// <param name="dict">config settings for new session</param></param>
 /// <returns>true if session added successfully, false if session already exists or is not an initiator</returns>
 public bool AddSession(SessionID sessionID, Dictionary dict)
 {
     if (dict.GetString(SessionSettings.CONNECTION_TYPE) == "initiator" && !sessionIDs_.Contains(sessionID))
     {
         Session session = sessionFactory_.Create(sessionID, dict);
         lock (sync_)
         {
             if (!_settings.Has(sessionID))  // session won't be in settings if ad-hoc creation after startup
                 _settings.Set(sessionID, dict);
             sessionIDs_.Add(sessionID);
             sessions_[sessionID] = session;
             SetDisconnected(sessionID);
         }
         return true;
     }
     return false;
 }
예제 #27
0
        public void Constructor()
        {
            Dictionary<String, String> enums = new Dictionary<string, string>();
            enums["a"] = "AAA";
            enums["b"] = "BBB";

            DDField ddf = new DDField(5, "Foo", enums, "STRING");

            Assert.AreEqual(2, ddf.EnumDict.Count);
            Assert.AreEqual("AAA", ddf.EnumDict["a"]);
            Assert.AreEqual("BBB", ddf.EnumDict["b"]);

            //obsolete accessor
            Assert.AreEqual(2, ddf.Enums.Count);
            Assert.IsTrue(ddf.Enums.Contains("a"));
            Assert.IsTrue(ddf.Enums.Contains("b"));
        }
예제 #28
0
        public void GetDouble()
        {
            // make sure that QF/n uses the invariant culture, no matter what the current culture is
            System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("fr-FR");

            QuickFix.Dictionary d = new QuickFix.Dictionary();
            d.SetString("DOUBLEKEY1", "12.3");
            d.SetString("DOUBLEKEY2", "987362.987362");
            d.SetString("BADDOUBLEKEY", "AB12.3");
            d.SetString("FOREIGNFORMAT", "44,44");

            Assert.That(d.GetDouble("DOUBLEKEY1"), Is.EqualTo(12.3));
            Assert.That(d.GetDouble("DOUBLEKEY2"), Is.EqualTo(987362.987362));
            Assert.Throws<ConfigError>(delegate { d.GetDouble("DOUBLEKEY3"); });
            Assert.Throws<ConfigError>(delegate { d.GetDouble("BADDOUBLEKEY"); });
            Assert.Throws<ConfigError>(delegate { d.GetDouble("BADDOUBLEKEY"); });
        }
예제 #29
0
        private void Validate(QuickFix.Dictionary dictionary)
        {
            string beginString = dictionary.GetString(SessionSettings.BEGINSTRING);

            if (beginString != Values.BeginString_FIX40 &&
                beginString != Values.BeginString_FIX41 &&
                beginString != Values.BeginString_FIX42 &&
                beginString != Values.BeginString_FIX43 &&
                beginString != Values.BeginString_FIX44 &&
                beginString != Values.BeginString_FIXT11)
            {
                throw new ConfigError(SessionSettings.BEGINSTRING + " (" + beginString + ") must be FIX.4.0 to FIX.4.4 or FIXT.1.1");
            }

            string connectionType = dictionary.GetString(SessionSettings.CONNECTION_TYPE);

            if (!"initiator".Equals(connectionType) && !"acceptor".Equals(connectionType))
            {
                throw new ConfigError(SessionSettings.CONNECTION_TYPE + " must be 'initiator' or 'acceptor'");
            }
        }
예제 #30
0
        public void Validate()
        {
            SessionSettings settings  = new SessionSettings();
            SessionID       sessionID = new SessionID("FIX.4.2", "SenderCompID", "TargetCompID");

            // ConnectionType not set
            QuickFix.Dictionary dictionary = new QuickFix.Dictionary();
            Assert.Throws <ConfigError>(delegate { settings.Set(sessionID, dictionary); });

            // ConnectionType set to invalid value
            dictionary.SetString(SessionSettings.CONNECTION_TYPE, "badvalue");
            Assert.Throws <ConfigError>(delegate { settings.Set(sessionID, dictionary); });

            // ConnectionType set to valid value
            dictionary.SetString(SessionSettings.CONNECTION_TYPE, "initiator");
            Assert.DoesNotThrow(delegate { settings.Set(sessionID, dictionary); });

            // Invalid BeginString
            sessionID = new SessionID("FIX4.2", "SenderCompID", "TargetCompID");
            Assert.Throws <ConfigError>(delegate { settings.Set(sessionID, dictionary); });
        }
예제 #31
0
        public void TestExtendedSettings()
        {
            IApplication app = new NullApplication();
            IMessageStoreFactory storeFactory = new MemoryStoreFactory();
            SessionFactory factory = new SessionFactory(app, storeFactory);

            SessionID sessionID = new SessionID("FIX.4.2", "SENDER", "TARGET");
            Dictionary settings = new Dictionary();
            settings.SetString(SessionSettings.USE_DATA_DICTIONARY, "N");
            settings.SetString(SessionSettings.SEND_REDUNDANT_RESENDREQUESTS, "Y");
            settings.SetString(SessionSettings.RESEND_SESSION_LEVEL_REJECTS, "Y");
            settings.SetString(SessionSettings.MILLISECONDS_IN_TIMESTAMP, "Y");
            settings.SetString(SessionSettings.CONNECTION_TYPE, "initiator");
            settings.SetString(SessionSettings.HEARTBTINT, "30");
            settings.SetString(SessionSettings.START_TIME, "12:00:00");
            settings.SetString(SessionSettings.END_TIME, "12:00:00");
            settings.SetString(SessionSettings.ENABLE_LAST_MSG_SEQ_NUM_PROCESSED, "Y");
            settings.SetString(SessionSettings.MAX_MESSAGES_IN_RESEND_REQUEST, "2500");
            settings.SetString(SessionSettings.SEND_LOGOUT_BEFORE_TIMEOUT_DISCONNECT, "Y");
            settings.SetString(SessionSettings.IGNORE_POSSDUP_RESEND_REQUESTS, "Y");

            Session session = factory.Create(sessionID, settings);

            Assert.That(session.SendRedundantResendRequests);
            Assert.That(session.ResendSessionLevelRejects);
            Assert.That(session.MillisecondsInTimeStamp);

            settings.SetString(SessionSettings.SEND_REDUNDANT_RESENDREQUESTS, "N");
            settings.SetString(SessionSettings.RESEND_SESSION_LEVEL_REJECTS, "N");
            settings.SetString(SessionSettings.MILLISECONDS_IN_TIMESTAMP, "N");
            session = factory.Create(sessionID, settings);

            Assert.That(!session.SendRedundantResendRequests);
            Assert.That(!session.ResendSessionLevelRejects);
            Assert.That(!session.MillisecondsInTimeStamp);
            Assert.That(session.EnableLastMsgSeqNumProcessed);
            Assert.That(session.MaxMessagesInResendRequest, Is.EqualTo(2500));
            Assert.That(session.SendLogoutBeforeTimeoutDisconnect);
            Assert.That(session.IgnorePossDupResendRequests);
        }
예제 #32
0
        private void LoadXml()
        {
            xmlDoc = new XmlDocument();
            xmlDoc.Load("Scenarios.xml");

            XDocument xDoc = XDocument.Load("Scenarios.xml");

            // QFN Default Session Settings
            //defaults = new Dictionary();
            //IEnumerable<XElement> xDefault = xDoc.Root.Element("QFNSessionSettings").Element("Default").Descendants();
            //foreach (XElement xe in xDefault)
            //{
            //    defaults.SetString(xe.Name.ToString(), xe.Value);
            //}

            // QFN Specific Session Settings
            session = new Dictionary();
            IEnumerable <XElement> xSession = xDoc.Root.Element("QFNSessionSettings").Element("Session").Descendants();

            foreach (XElement xe in xSession)
            {
                session.SetString(xe.Name.ToString(), xe.Value);
            }

            SessionID sessionID = new SessionID(session.GetString("BeginString"), session.GetString("SenderCompID"), session.GetString("TargetCompID"));

            ConfigurationSingleton.Instance.RemovaAllQFNSettings();
            //ConfigurationSingleton.Instance.AddQFNSettings(defaults);
            ConfigurationSingleton.Instance.AddQFNSettings(sessionID, session);
            ConfigurationSingleton.Instance.SetTagsToIgnore(xDoc.Root.Element("TagsToIgnore").Value);

            sc      = new List <string>();
            scNodes = new List <XmlNode>();
            foreach (XmlNode xNode in xmlDoc.GetElementsByTagName("Scenario"))
            {
                sc.Add(xNode.Attributes["Name"].Value);
                scNodes.Add(xNode);
            }
        }
예제 #33
0
        public void TestPersistMessages()
        {
            IApplication app = new NullApplication();
            IMessageStoreFactory storeFactory = new MemoryStoreFactory();
            SessionFactory factory = new SessionFactory(app, storeFactory);

            SessionID sessionID = new SessionID("FIX.4.2", "SENDER", "TARGET");
            Dictionary settings = new Dictionary();
            settings.SetString(SessionSettings.USE_DATA_DICTIONARY, "N");
            settings.SetString(SessionSettings.CONNECTION_TYPE, "initiator");
            settings.SetString(SessionSettings.HEARTBTINT, "30");
            settings.SetString(SessionSettings.START_TIME, "12:00:00");
            settings.SetString(SessionSettings.END_TIME, "12:00:00");
            Session session = factory.Create(sessionID, settings);

            //true by default
            Assert.That(session.PersistMessages);

            settings.SetBool(SessionSettings.PERSIST_MESSAGES, false);
            session = factory.Create(sessionID, settings);

            Assert.That(!session.PersistMessages);
        }
예제 #34
0
        private AcceptorSocketDescriptor GetAcceptorSocketDescriptor(Dictionary dict)
        {
            int port = System.Convert.ToInt32(dict.GetLong(SessionSettings.SOCKET_ACCEPT_PORT));
            SocketSettings socketSettings = new SocketSettings();

            IPEndPoint socketEndPoint;
            if (dict.Has(SessionSettings.SOCKET_ACCEPT_HOST))
            {
                string host = dict.GetString(SessionSettings.SOCKET_ACCEPT_HOST);                
                IPAddress[] addrs = Dns.GetHostAddresses(host);
                socketEndPoint = new IPEndPoint(addrs[0], port);
                // Set hostname (if it is not already configured)
                socketSettings.ServerCommonName = socketSettings.ServerCommonName ?? host;
            }
            else
            {
                socketEndPoint = new IPEndPoint(IPAddress.Any, port);
            }

            socketSettings.Configure(dict);
            

            AcceptorSocketDescriptor descriptor;
            if (!socketDescriptorForAddress_.TryGetValue(socketEndPoint, out descriptor))
            {
                descriptor = new AcceptorSocketDescriptor(socketEndPoint, socketSettings, dict);
                socketDescriptorForAddress_[socketEndPoint] = descriptor;
            }

            return descriptor;
        }
예제 #35
0
 /// <summary>
 /// Create session, either at start-up or as an ad-hoc operation
 /// </summary>
 /// <param name="sessionID">ID of new session<param>
 /// <param name="dict">config settings for new session</param></param>
 /// <returns>true if session added successfully, false if session already exists or is not an acceptor</returns>
 private bool CreateSession(SessionID sessionID, Dictionary dict)
 {
     if (!sessions_.ContainsKey(sessionID))
     {
         string connectionType = dict.GetString(SessionSettings.CONNECTION_TYPE);
         if ("acceptor" == connectionType)
         {
             AcceptorSocketDescriptor descriptor = GetAcceptorSocketDescriptor(dict);
             Session session = sessionFactory_.Create(sessionID, dict);
             descriptor.AcceptSession(session);
             sessions_[sessionID] = session;
             return true;
         }
     }
     return false;
 }
예제 #36
0
 /// <summary>
 /// Create session, either at start-up or as an ad-hoc operation
 /// </summary>
 /// <param name="sessionID">ID of new session<param>
 /// <param name="dict">config settings for new session</param></param>
 /// <returns>true if session added successfully, false if session already exists or is not an initiator</returns>
 private bool CreateSession(SessionID sessionID, Dictionary dict)
 {
     if (dict.GetString(SessionSettings.CONNECTION_TYPE) == "initiator" && !sessionIDs_.Contains(sessionID))
     {
         Session session = sessionFactory_.Create(sessionID, dict);
         lock (sync_)
         {
             sessionIDs_.Add(sessionID);
             sessions_[sessionID] = session;
             SetDisconnected(sessionID);
         }
         return true;
     }
     return false;
 }
예제 #37
0
        public override QuickFix.SessionSettings GetSessionSettings()
        {
            defaults_ = new QuickFix.Dictionary();

            settings_ = new Dictionary <SessionID, Dictionary>();

            sessionsettings = new SessionSettings();

            SesionDataSetSettings settings = new SesionDataSetSettings(GetConfigs());

            //---- load the DEFAULT section
            LinkedList <QuickFix.Dictionary> section = settings.Get("DEFAULT");

            QuickFix.Dictionary def = new QuickFix.Dictionary();
            if (section.Count > 0)
            {
                def = section.First.Value;
            }
            Set(def);

            //---- load each SESSION section
            section = settings.Get("SESSION");
            foreach (QuickFix.Dictionary dict in section)
            {
                dict.Merge(def);

                string sessionQualifier = SessionID.NOT_SET;
                string senderSubID      = SessionID.NOT_SET;
                string senderLocID      = SessionID.NOT_SET;
                string targetSubID      = SessionID.NOT_SET;
                string targetLocID      = SessionID.NOT_SET;

                if (dict.Has(SessionSettings.SESSION_QUALIFIER))
                {
                    sessionQualifier = dict.GetString(SessionSettings.SESSION_QUALIFIER);
                }
                if (dict.Has(SessionSettings.SENDERSUBID))
                {
                    senderSubID = dict.GetString(SessionSettings.SENDERSUBID);
                }
                if (dict.Has(SessionSettings.SENDERLOCID))
                {
                    senderLocID = dict.GetString(SessionSettings.SENDERLOCID);
                }
                if (dict.Has(SessionSettings.TARGETSUBID))
                {
                    targetSubID = dict.GetString(SessionSettings.TARGETSUBID);
                }
                if (dict.Has(SessionSettings.TARGETLOCID))
                {
                    targetLocID = dict.GetString(SessionSettings.TARGETLOCID);
                }

                SessionID sessionID = new SessionID(dict.GetString(SessionSettings.BEGINSTRING), dict.GetString(SessionSettings.SENDERCOMPID), senderSubID, senderLocID, dict.GetString(SessionSettings.TARGETCOMPID), targetSubID, targetLocID, sessionQualifier);

                Set(sessionID, dict);

                sessionsettings.Set(sessionID, dict);
            }


            sessionsettings.Set(defaults_);
            return(sessionsettings);
        }
예제 #38
0
 public void AddQFNSettings(SessionID sid, QuickFix.Dictionary dic)
 {
     qfnSettings.Set(sid, dic);
     sessionID = sid;
 }
예제 #39
0
파일: QUIKFIX.cs 프로젝트: heber/FreeOQ
 protected override void Init()
 {
   Dictionary defaults = new Dictionary();
   defaults.setString(nvcneRd3YWS84l4984.Ey6KSwFglw(222), nvcneRd3YWS84l4984.Ey6KSwFglw(254));
   defaults.setString(nvcneRd3YWS84l4984.Ey6KSwFglw(276), this.StartTime.ToString());
   defaults.setString(nvcneRd3YWS84l4984.Ey6KSwFglw(298), this.EndTime.ToString());
   defaults.setBool(nvcneRd3YWS84l4984.Ey6KSwFglw(316), this.SendRedundantResendRequests);
   defaults.setBool(nvcneRd3YWS84l4984.Ey6KSwFglw(374), this.ResetOnLogout);
   defaults.setBool(nvcneRd3YWS84l4984.Ey6KSwFglw(404), this.ResetOnDisconnect);
   defaults.setBool(nvcneRd3YWS84l4984.Ey6KSwFglw(442), this.RefreshOnLogon);
   defaults.setString(nvcneRd3YWS84l4984.Ey6KSwFglw(474), this.DataDictionary);
   defaults.setBool(nvcneRd3YWS84l4984.Ey6KSwFglw(506), this.CheckLatency);
   defaults.setLong(nvcneRd3YWS84l4984.Ey6KSwFglw(534), (int) this.MaxLatency.TotalSeconds);
   defaults.setLong(nvcneRd3YWS84l4984.Ey6KSwFglw(558), (int) this.ReconnectInterval.TotalSeconds);
   defaults.setLong(nvcneRd3YWS84l4984.Ey6KSwFglw(596), (int) this.HeartBtInt.TotalSeconds);
   defaults.setBool(nvcneRd3YWS84l4984.Ey6KSwFglw(620), this.PersistMessages);
   if (this.PersistMessages)
     defaults.setString(nvcneRd3YWS84l4984.Ey6KSwFglw(654), this.FileStorePath);
   if (this.LoggingEnabled)
     defaults.setString(nvcneRd3YWS84l4984.Ey6KSwFglw(684), this.FileLogPath);
   Dictionary settings = new Dictionary();
   settings.setString(nvcneRd3YWS84l4984.Ey6KSwFglw(710), this.SocketConnectHost);
   settings.setLong(nvcneRd3YWS84l4984.Ey6KSwFglw(748), (int) this.SocketConnectPort);
   SessionID sessionID = new SessionID(nvcneRd3YWS84l4984.Ey6KSwFglw(786), this.SenderCompID, this.TargetCompID);
   this.sessionSettings = new SessionSettings();
   this.sessionSettings.set(defaults);
   this.sessionSettings.set(sessionID, settings);
   this.storeFactory = this.PersistMessages ? (MessageStoreFactory) new FileStoreFactory(this.sessionSettings) : (MessageStoreFactory) new MemoryStoreFactory();
   this.logFactory = this.LoggingEnabled ? (LogFactory) new FileLogFactory(this.sessionSettings) : (LogFactory) new NullLogFactory();
   this.messageFactory = (MessageFactory) new DefaultMessageFactory();
   this.application = (QuickFIX42Application) new mWYFJZ8xKCsaXEKF78(this);
 }
예제 #40
0
 public Dictionary(Dictionary d)
     : this(d.name_, d.data_)
 {
 }
예제 #41
0
 public DataDictionaryProvider()
 {
     transportDataDictionaries_ = new Dictionary<string, DataDictionary.DataDictionary>();
     applicationDataDictionaries_ = new Dictionary<string, DataDictionary.DataDictionary>();
     emptyDataDictionary_ = new DataDictionary.DataDictionary();
 }
예제 #42
0
        public ChannelTcpConflated(TCPConflatedConfig conflatedConfig)
        {
            logger = LogManager.GetLogger("ChannelTcpConflated-" + conflatedConfig.ChannelID);

            MDSUtils.AddAppender("ChannelTcpConflated-" + conflatedConfig.ChannelID, logger.Logger);

            _bKeepRunning = true;

            machineGun = new MachineGunFixSplitter();
            machineGun.UnderFIXMessageFire += new FIXMachineGunEventHandler(machineGun_UnderFIXMessageFire);
            machineGun.Start();

            thQueueProc = new Thread(new ThreadStart(queueProc));
            thQueueProc.Start();

            thSplitProc = new Thread(new ThreadStart(splitterThreadWork));
            thSplitProc.Start();

            _channelUmdfConfig = conflatedConfig;

            //if (!listaChannelQueues.ContainsKey(conflatedConfig.ChannelID))
            //    listaChannelQueues.Add(conflatedConfig.ChannelID, new ListChannelQueues(qUdpPkt, replayLockObject));

            logger.Info("Start(): iniciando sessao FIX...");
            try
            {
                // Cria sessao FIX
                _session = new QuickFix.SessionID(
                    conflatedConfig.BeginString,
                    conflatedConfig.SenderCompID,
                    conflatedConfig.TargetCompID);

                // Cria dicionario da configuracao
                QuickFix.Dictionary mainDic = new QuickFix.Dictionary();
                mainDic.SetLong("SocketConnectPort", conflatedConfig.ProxyPort);
                mainDic.SetLong("HeartBtInt", conflatedConfig.HeartBtInt);
                mainDic.SetLong("ReconnectInterval", conflatedConfig.ReconnectInterval);
                mainDic.SetBool("ResetOnLogon", conflatedConfig.ResetOnLogon);
                mainDic.SetBool("ResetOnLogout", conflatedConfig.ResetOnLogout);
                mainDic.SetBool("ResetOnDisconnect", conflatedConfig.ResetOnDisconnect);
                mainDic.SetBool("PersistMessages", conflatedConfig.PersistMessages);
                mainDic.SetString("ConnectionType", conflatedConfig.ConnectionType);
                mainDic.SetString("SocketConnectHost", conflatedConfig.ProxyHost);
                mainDic.SetString("FileStorePath", conflatedConfig.FileStorePath);
                mainDic.SetString("FileLogPath", conflatedConfig.FileLogPath);
                mainDic.SetString("StartTime", conflatedConfig.StartTime);
                mainDic.SetString("EndTime", conflatedConfig.EndTime);

                QuickFix.Dictionary sessDic = new QuickFix.Dictionary();
                sessDic.SetString("BeginString", conflatedConfig.BeginString);
                sessDic.SetString("SenderCompID", conflatedConfig.SenderCompID);

                sessDic.SetString("TargetCompID", conflatedConfig.TargetCompID);
                sessDic.SetString("DataDictionary", conflatedConfig.DataDictionary);
                sessDic.SetBool("CheckLatency", false);
                sessDic.SetBool("UseDataDictionary", true);
                sessDic.SetLong("SocketReceiveBufferSize", conflatedConfig.SocketReceiveBufferSize);

                // Configure the session settings
                QuickFix.SessionSettings settings = new QuickFix.SessionSettings();

                settings.Set(mainDic);
                settings.Set(_session, sessDic);

                MemoryStoreFactory store   = new MemoryStoreFactory();
                FileLogFactory     log     = new FileLogFactory(settings);
                IMessageFactory    message = new DefaultMessageFactory();

                // Cria o socket
                _initiator = new QuickFix.Transport.SocketInitiator(this, store, settings, this, message);
                _initiator.Start();

                QuickFix.Session mySession = QuickFix.Session.LookupSession(_session);
                QuickFix.Session.LookupSession(_session).ValidateLengthAndChecksum = false;
            }
            catch (Exception ex)
            {
                logger.Error("Start():" + ex.Message, ex);
            }

            logger.Info("Start(): Sessao FIX iniciado!");
        }
예제 #43
0
 protected override void Init()
 {
   this.application = (QuickFIX42Application) this.CreateApplicationInstance();
   Dictionary dictionary = new Dictionary();
   dictionary.setString(BeAEwTZGlZaeOmY5cm.J00weU3cM6(2820), BeAEwTZGlZaeOmY5cm.J00weU3cM6(2852));
   dictionary.setLong(BeAEwTZGlZaeOmY5cm.J00weU3cM6(2874), this.HeartBtInt);
   dictionary.setString(BeAEwTZGlZaeOmY5cm.J00weU3cM6(2898), this.StartTime.ToString());
   dictionary.setString(BeAEwTZGlZaeOmY5cm.J00weU3cM6(2920), this.EndTime.ToString());
   dictionary.setLong(BeAEwTZGlZaeOmY5cm.J00weU3cM6(2938), this.ReconnectInterval);
   dictionary.setString(BeAEwTZGlZaeOmY5cm.J00weU3cM6(2976), this.BeginString);
   dictionary.setString(BeAEwTZGlZaeOmY5cm.J00weU3cM6(3002), this.DataDictionary);
   dictionary.setString(BeAEwTZGlZaeOmY5cm.J00weU3cM6(3034), this.FileStorePath);
   dictionary.setString(BeAEwTZGlZaeOmY5cm.J00weU3cM6(3064), this.FileLogPath);
   dictionary.setBool(BeAEwTZGlZaeOmY5cm.J00weU3cM6(3090), this.CheckLatency);
   dictionary.setLong(BeAEwTZGlZaeOmY5cm.J00weU3cM6(3118), this.MaxLatency);
   dictionary.setBool(BeAEwTZGlZaeOmY5cm.J00weU3cM6(3142), this.SendRedundantResendRequests);
   dictionary.setBool(BeAEwTZGlZaeOmY5cm.J00weU3cM6(3200), this.ResetOnLogout);
   dictionary.setBool(BeAEwTZGlZaeOmY5cm.J00weU3cM6(3230), this.ResetOnDisconnect);
   dictionary.setBool(BeAEwTZGlZaeOmY5cm.J00weU3cM6(3268), this.RefreshOnLogon);
   dictionary.setBool(BeAEwTZGlZaeOmY5cm.J00weU3cM6(3300), this.TcpNoDelay);
   this.OnDefaultsSessionSettingsCreated(dictionary);
   Dictionary settings1 = (Dictionary) null;
   if (this.PriceSessionEnabled)
   {
     settings1 = new Dictionary();
     settings1.setString(BeAEwTZGlZaeOmY5cm.J00weU3cM6(3330), this.PriceSocketConnectHost);
     settings1.setLong(BeAEwTZGlZaeOmY5cm.J00weU3cM6(3368), this.PriceSocketConnectPort);
     settings1.setString(BeAEwTZGlZaeOmY5cm.J00weU3cM6(3406), this.PriceFileStorePath);
     this.OnPriceSessionSettingsCreated(settings1);
   }
   Dictionary settings2 = (Dictionary) null;
   if (this.OrderSessionEnabled)
   {
     settings2 = new Dictionary();
     settings2.setString(BeAEwTZGlZaeOmY5cm.J00weU3cM6(3436), this.OrderSocketConnectHost);
     settings2.setLong(BeAEwTZGlZaeOmY5cm.J00weU3cM6(3474), this.OrderSocketConnectPort);
     settings2.setString(BeAEwTZGlZaeOmY5cm.J00weU3cM6(3512), this.OrderFileStorePath);
     this.OnOrderSessionSettingsCreated(settings2);
   }
   SessionID sessionID1 = this.PriceSessionEnabled ? new SessionID(this.BeginString, this.PriceSenderCompID, this.PriceTargetCompID) : (SessionID) null;
   SessionID sessionID2 = this.OrderSessionEnabled ? new SessionID(this.BeginString, this.OrderSenderCompID, this.OrderTargetCompID) : (SessionID) null;
   this.sessionSettings = new SessionSettings();
   this.sessionSettings.set(dictionary);
   if (this.PriceSessionEnabled)
     this.sessionSettings.set(sessionID1, settings1);
   if (this.OrderSessionEnabled)
     this.sessionSettings.set(sessionID2, settings2);
   this.storeFactory = (MessageStoreFactory) new FileStoreFactory(this.sessionSettings);
   this.logFactory = (LogFactory) new FileLogFactory(this.sessionSettings);
   this.messageFactory = (MessageFactory) new DefaultMessageFactory();
   (this.application as QuickFIX42CommonApplication).adf1ZbrcY(sessionID1, sessionID2);
 }
예제 #44
0
 protected void ProcessFixDataDictionary(SessionID sessionID, Dictionary settings, DataDictionaryProvider provider, Stream dictionaryStream = null)
 {
     DataDictionary.DataDictionary dataDictionary = null;
     if (dictionaryStream != null)
     {
         dataDictionary = LoadDataDictionaryFromStream(settings, dictionaryStream);
     }
     else
     {
         dataDictionary = createDataDictionary(sessionID, settings, SessionSettings.DATA_DICTIONARY, sessionID.BeginString);
     }
     provider.AddTransportDataDictionary(sessionID.BeginString, dataDictionary);
     provider.AddApplicationDataDictionary(FixValues.ApplVerID.FromBeginString(sessionID.BeginString), dataDictionary);
 }
예제 #45
0
        private DataDictionary.DataDictionary LoadDataDictionaryFromStream(Dictionary settings, Stream dictionaryStream)
        {
            DataDictionary.DataDictionary dd;
            string path = settings.GetString(SessionSettings.DATA_DICTIONARY_STREAM);

            if (!dictionariesByPath_.TryGetValue(path, out dd))
            {
                dd = new DataDictionary.DataDictionary(dictionaryStream);
                dictionariesByPath_[path] = dd;
            }

            DataDictionary.DataDictionary ddCopy = new DataDictionary.DataDictionary(dd);

            if (settings.Has(SessionSettings.VALIDATE_FIELDS_OUT_OF_ORDER))
                ddCopy.CheckFieldsOutOfOrder = settings.GetBool(SessionSettings.VALIDATE_FIELDS_OUT_OF_ORDER);
            if (settings.Has(SessionSettings.VALIDATE_FIELDS_HAVE_VALUES))
                ddCopy.CheckFieldsHaveValues = settings.GetBool(SessionSettings.VALIDATE_FIELDS_HAVE_VALUES);
            if (settings.Has(SessionSettings.VALIDATE_USER_DEFINED_FIELDS))
                ddCopy.CheckUserDefinedFields = settings.GetBool(SessionSettings.VALIDATE_USER_DEFINED_FIELDS);

            return ddCopy;
        }
예제 #46
0
 public void AddQFNSettings(QuickFix.Dictionary dic)
 {
     qfnSettings.Set(dic);
 }
예제 #47
0
 protected void ProcessFixDataDictionary(SessionID sessionID, Dictionary settings, DataDictionaryProvider provider)
 {
     DataDictionary.DataDictionary dataDictionary = createDataDictionary(sessionID, settings, SessionSettings.DATA_DICTIONARY, sessionID.BeginString);
     provider.AddTransportDataDictionary(sessionID.BeginString, dataDictionary);
     provider.AddApplicationDataDictionary(FixValues.ApplVerID.FromBeginString(sessionID.BeginString), dataDictionary);
 }
예제 #48
0
        public FixInitiator(MarketIncrementalProcessor mktIncProc, ChannelUMDFConfig channelUmdfConfig, string templateFile, Queue <UdpPacket> qUdpPkt, Object replayLockObject)
        {
            logger = LogManager.GetLogger("FixInitiator-" + channelUmdfConfig.ChannelID);

            MDSUtils.AddAppender("FixInitiator-" + channelUmdfConfig.ChannelID, logger.Logger);

            XMLMessageTemplateLoader loader = new XMLMessageTemplateLoader();

            registry = UmdfUtils.loadTemplates(templateFile);
            context  = new Context();
            context.TemplateRegistry = registry;

            _mktIncProc        = mktIncProc;
            _channelUmdfConfig = channelUmdfConfig;

            if (!listaChannelQueues.ContainsKey(channelUmdfConfig.ChannelID))
            {
                listaChannelQueues.Add(channelUmdfConfig.ChannelID, new ListChannelQueues(qUdpPkt, replayLockObject));
            }

            logger.Info("Start(): iniciando sessao FIX...");
            try
            {
                // Cria sessao FIX
                _session = new QuickFix.SessionID(
                    _channelUmdfConfig.TCPConfig.BeginString,
                    _channelUmdfConfig.TCPReplayConfig.SenderCompID,
                    _channelUmdfConfig.TCPReplayConfig.SubID,
                    _channelUmdfConfig.TCPReplayConfig.TargetCompID,
                    _channelUmdfConfig.TCPReplayConfig.SubID);

                // Cria dicionario da configuracao
                QuickFix.Dictionary mainDic = new QuickFix.Dictionary();
                mainDic.SetLong("SocketConnectPort", _channelUmdfConfig.TCPReplayConfig.SocketConnectPort);
                mainDic.SetLong("HeartBtInt", _channelUmdfConfig.TCPConfig.HeartBtInt);
                mainDic.SetLong("ReconnectInterval", _channelUmdfConfig.TCPConfig.ReconnectInterval);
                mainDic.SetBool("ResetOnLogon", _channelUmdfConfig.TCPConfig.ResetOnLogon);
                mainDic.SetBool("ResetOnLogout", _channelUmdfConfig.TCPConfig.ResetOnLogout);
                mainDic.SetBool("ResetOnDisconnect", _channelUmdfConfig.TCPConfig.ResetOnDisconnect);
                mainDic.SetBool("PersistMessages", _channelUmdfConfig.TCPConfig.PersistMessages);
                mainDic.SetString("ConnectionType", _channelUmdfConfig.TCPConfig.ConnectionType);
                mainDic.SetString("SocketConnectHost", _channelUmdfConfig.TCPReplayConfig.SocketConnectHost);
                mainDic.SetString("FileStorePath", _channelUmdfConfig.TCPConfig.FileStorePath);
                mainDic.SetString("FileLogPath", _channelUmdfConfig.TCPConfig.FileLogPath);
                mainDic.SetString("StartTime", _channelUmdfConfig.TCPReplayConfig.StartTime);
                mainDic.SetString("EndTime", _channelUmdfConfig.TCPReplayConfig.EndTime);

                QuickFix.Dictionary sessDic = new QuickFix.Dictionary();
                sessDic.SetString("BeginString", _channelUmdfConfig.TCPConfig.BeginString);
                sessDic.SetString("SenderCompID", _channelUmdfConfig.TCPReplayConfig.SenderCompID);
                sessDic.SetString("SenderSubID", _channelUmdfConfig.TCPReplayConfig.SubID);
                sessDic.SetString("TargetCompID", _channelUmdfConfig.TCPReplayConfig.TargetCompID);
                sessDic.SetString("TargetSubID", _channelUmdfConfig.TCPReplayConfig.SubID);
                sessDic.SetString("DataDictionary", _channelUmdfConfig.TCPConfig.DataDictionary);
                sessDic.SetBool("UseDataDictionary", true);

                // Configure the session settings
                QuickFix.SessionSettings settings = new QuickFix.SessionSettings();

                settings.Set(mainDic);
                settings.Set(_session, sessDic);

                MemoryStoreFactory store   = new MemoryStoreFactory();
                FileLogFactory     log     = new FileLogFactory(settings);
                IMessageFactory    message = new DefaultMessageFactory();

                // Cria o socket
                _initiator = new QuickFix.Transport.SocketInitiator(this, store, settings, log, message);
                _initiator.Start();
            }
            catch (Exception ex)
            {
                logger.Error("Start():" + ex.Message, ex);
            }

            logger.Info("Start(): Sessao FIX iniciado!");
        }
예제 #49
0
        protected void ProcessFixTDataDictionaries(SessionID sessionID, Dictionary settings, DataDictionaryProvider provider)
        {
            provider.AddTransportDataDictionary(sessionID.BeginString, createDataDictionary(sessionID, settings, SessionSettings.TRANSPORT_DATA_DICTIONARY, sessionID.BeginString));

            foreach (KeyValuePair<string, string> setting in settings)
            {
                if (setting.Key.StartsWith(SessionSettings.APP_DATA_DICTIONARY, System.StringComparison.CurrentCultureIgnoreCase))
                {
                    if (setting.Key.Equals(SessionSettings.APP_DATA_DICTIONARY, System.StringComparison.CurrentCultureIgnoreCase))
                    {
                        Fields.ApplVerID applVerId = Message.GetApplVerID(settings.GetString(SessionSettings.DEFAULT_APPLVERID));
                        DataDictionary.DataDictionary dd = createDataDictionary(sessionID, settings, SessionSettings.APP_DATA_DICTIONARY, sessionID.BeginString);
                        provider.AddApplicationDataDictionary(applVerId.Obj, dd);
                    }
                    else
                    {
                        int offset = setting.Key.IndexOf(".");
                        if (offset == -1)
                            throw new System.ArgumentException(string.Format("Malformed {0} : {1}", SessionSettings.APP_DATA_DICTIONARY, setting.Key));

                        string beginStringQualifier = setting.Key.Substring(offset);
                        DataDictionary.DataDictionary dd = createDataDictionary(sessionID, settings, setting.Key, beginStringQualifier);
                        provider.AddApplicationDataDictionary(Message.GetApplVerID(beginStringQualifier).Obj, dd);
                    }
                }
            }
        }
예제 #50
0
        public FixServerInitiator(
            string channelsID,
            TCPReplayConfig tcpReplayConfig,
            Dictionary <string, SessionID> dctSessionsFixClients,
            Dictionary <string, SessionID> dctSessionsFixChannels)
        {
            _tcpReplayConfig        = tcpReplayConfig;
            _dctSessionsFixClients  = dctSessionsFixClients;
            _dctSessionsFixChannels = dctSessionsFixChannels;

            logger = LogManager.GetLogger("FixServerInitiator-" + tcpReplayConfig.ChannelID);

            MDSUtils.AddAppender("FixServerInitiator-" + tcpReplayConfig.ChannelID, logger.Logger);

            XMLMessageTemplateLoader loader = new XMLMessageTemplateLoader();

            registry = UmdfUtils.loadTemplates(tcpReplayConfig.TemplateFile);
            context  = new Context();
            context.TemplateRegistry = registry;

            try
            {
                // Cria dicionario da configuracao
                QuickFix.Dictionary mainDic = new QuickFix.Dictionary();
                mainDic.SetString("SocketConnectHost", tcpReplayConfig.SocketConnectHost);
                mainDic.SetLong("SocketConnectPort", tcpReplayConfig.SocketConnectPort);
                if (!String.IsNullOrEmpty(tcpReplayConfig.SocketConnectHost1))
                {
                    mainDic.SetString("SocketConnectHost1", tcpReplayConfig.SocketConnectHost1);
                    mainDic.SetLong("SocketConnectPort1", tcpReplayConfig.SocketConnectPort1);
                }
                mainDic.SetLong("HeartBtInt", tcpReplayConfig.HeartBtInt);
                mainDic.SetLong("ReconnectInterval", tcpReplayConfig.ReconnectInterval);
                mainDic.SetBool("ResetOnLogon", tcpReplayConfig.ResetOnLogon);
                mainDic.SetBool("PersistMessages", tcpReplayConfig.PersistMessages);
                mainDic.SetString("ConnectionType", tcpReplayConfig.ConnectionType);
                mainDic.SetString("FileStorePath", tcpReplayConfig.FileStorePath);
                mainDic.SetString("FileLogPath", tcpReplayConfig.FileLogPath);
                mainDic.SetString("StartTime", tcpReplayConfig.StartTime);
                mainDic.SetString("EndTime", tcpReplayConfig.EndTime);

                QuickFix.Dictionary sessDic = new QuickFix.Dictionary();
                sessDic.SetString("BeginString", tcpReplayConfig.BeginString);
                sessDic.SetString("SenderCompID", tcpReplayConfig.SenderCompID);
                sessDic.SetString("TargetCompID", tcpReplayConfig.TargetCompID);
                sessDic.SetString("DataDictionary", tcpReplayConfig.DataDictionary);
                sessDic.SetBool("UseDataDictionary", true);

                // Configure the session settings
                QuickFix.SessionSettings settings = new QuickFix.SessionSettings();

                settings.Set(mainDic);

                MemoryStoreFactory store   = new MemoryStoreFactory();
                FileLogFactory     log     = new FileLogFactory(settings);
                IMessageFactory    message = new DefaultMessageFactory();

                // Cria sessao FIX
                _sessionID = new QuickFix.SessionID(
                    tcpReplayConfig.BeginString,
                    tcpReplayConfig.SenderCompID,
                    tcpReplayConfig.TargetCompID);

                settings.Set(_sessionID, sessDic);

                string[] quebraChannelsID = channelsID.Split(",".ToCharArray());
                foreach (string channel in quebraChannelsID)
                {
                    dctSessionsFixChannels.Add(channel, _sessionID);
                }

                logger.InfoFormat("Start(): iniciando FIX com sessionID[{0}]...", _sessionID.ToString());
                _initiator = new QuickFix.Transport.SocketInitiator(this, store, settings, log, message);
                _initiator.Start();
            }
            catch (Exception ex)
            {
                logger.Error("Start():" + ex.Message, ex);
            }

            logger.Info("Start(): Sessao FIX iniciada!");
        }
예제 #51
0
 /// TODO need to make deeper copy?
 public DataDictionaryProvider(DataDictionaryProvider src)
 {
     transportDataDictionaries_ = new Dictionary<string, DataDictionary.DataDictionary>(src.transportDataDictionaries_);
     applicationDataDictionaries_ = new Dictionary<string, DataDictionary.DataDictionary>(src.applicationDataDictionaries_);
     emptyDataDictionary_ = new DataDictionary.DataDictionary(src.emptyDataDictionary_);
 }
예제 #52
0
 public void Merge(Dictionary toMerge)
 {
     foreach (System.Collections.Generic.KeyValuePair<string, string> entry in toMerge.data_)
         if(!data_.ContainsKey(entry.Key))
             data_[entry.Key] = entry.Value;
 }
예제 #53
0
        public FixServerAcceptor(
            TCPReplayConfig tcpReplayConfig,
            Dictionary <string, SessionID> dctSessionsFixClients,
            Dictionary <string, SessionID> dctSessionsFixChannels)
        {
            _tcpReplayConfig        = tcpReplayConfig;
            _dctSessionsFixClients  = dctSessionsFixClients;
            _dctSessionsFixChannels = dctSessionsFixChannels;

            logger = LogManager.GetLogger("FixServerAcceptor");

            MDSUtils.AddAppender("FixServerAcceptor", logger.Logger);

            XMLMessageTemplateLoader loader = new XMLMessageTemplateLoader();

            registry = UmdfUtils.loadTemplates(tcpReplayConfig.TemplateFile);
            context  = new Context();
            context.TemplateRegistry = registry;

            try
            {
                // Cria dicionario da configuracao
                QuickFix.Dictionary mainDic = new QuickFix.Dictionary();
                mainDic.SetLong("SocketAcceptPort", tcpReplayConfig.SocketAcceptPort);
                mainDic.SetBool("ResetOnLogon", tcpReplayConfig.ResetOnLogon);
                mainDic.SetBool("ResetOnDisconnect", tcpReplayConfig.ResetOnDisconnect);
                mainDic.SetBool("PersistMessages", tcpReplayConfig.PersistMessages);
                mainDic.SetString("ConnectionType", tcpReplayConfig.ConnectionType);
                mainDic.SetString("FileStorePath", tcpReplayConfig.FileStorePath);
                mainDic.SetString("FileLogPath", tcpReplayConfig.FileLogPath);
                mainDic.SetString("StartTime", tcpReplayConfig.StartTime);
                mainDic.SetString("EndTime", tcpReplayConfig.EndTime);

                QuickFix.Dictionary sessDic = new QuickFix.Dictionary();
                sessDic.SetString("BeginString", tcpReplayConfig.BeginString);
                sessDic.SetString("SenderCompID", tcpReplayConfig.SenderCompID);
                sessDic.SetString("TargetCompID", tcpReplayConfig.TargetCompID);
                sessDic.SetString("DataDictionary", tcpReplayConfig.DataDictionary);
                sessDic.SetBool("UseDataDictionary", true);

                // Configure the session settings
                QuickFix.SessionSettings settings = new QuickFix.SessionSettings();

                settings.Set(mainDic);

                MemoryStoreFactory store   = new MemoryStoreFactory();
                FileLogFactory     log     = new FileLogFactory(settings);
                IMessageFactory    message = new DefaultMessageFactory();

                IEnumerable <int> rangeSenderSubID = Enumerable.Range(
                    tcpReplayConfig.SubIDStartSeq,
                    tcpReplayConfig.SubIDEndSeq);
                foreach (int item in rangeSenderSubID)
                {
                    string subID = tcpReplayConfig.SubIDPrefix + item.ToString("D3");

                    // Cria sessao FIX
                    SessionID sessionID = new QuickFix.SessionID(
                        tcpReplayConfig.BeginString,
                        tcpReplayConfig.SenderCompID,
                        subID,
                        tcpReplayConfig.TargetCompID,
                        subID);

                    sessDic.SetString("SenderSubID", subID);
                    sessDic.SetString("TargetSubID", subID);
                    settings.Set(sessionID, sessDic);
                }

                logger.InfoFormat("Start(): iniciando FIX ACCEPTOR na porta {0}...", tcpReplayConfig.SocketAcceptPort);
                _acceptor = new ThreadedSocketAcceptor(this, store, settings, log, message);
                _acceptor.Start();
            }
            catch (Exception ex)
            {
                logger.Error("Start():" + ex.Message, ex);
            }

            logger.Info("Start(): Sessao FIX iniciada!");
        }
예제 #54
0
        public void Validate()
        {
            SessionSettings settings = new SessionSettings();
            SessionID sessionID = new SessionID("FIX.4.2", "SenderCompID", "TargetCompID");

            // ConnectionType not set
            QuickFix.Dictionary dictionary = new QuickFix.Dictionary();
            Assert.Throws<ConfigError>(delegate { settings.Set(sessionID, dictionary); });

            // ConnectionType set to invalid value
            dictionary.SetString(SessionSettings.CONNECTION_TYPE, "badvalue");
            Assert.Throws<ConfigError>(delegate { settings.Set(sessionID, dictionary); });

            // ConnectionType set to valid value
            dictionary.SetString(SessionSettings.CONNECTION_TYPE, "initiator");
            Assert.DoesNotThrow(delegate { settings.Set(sessionID, dictionary); });

            // Invalid BeginString
            sessionID = new SessionID("FIX4.2", "SenderCompID", "TargetCompID");
            Assert.Throws<ConfigError>(delegate { settings.Set(sessionID, dictionary); });
        }