当前位置: 首页>>代码示例>>C#>>正文


C# QuickFix.GetInt方法代码示例

本文整理汇总了C#中QuickFix.GetInt方法的典型用法代码示例。如果您正苦于以下问题:C# QuickFix.GetInt方法的具体用法?C# QuickFix.GetInt怎么用?C# QuickFix.GetInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QuickFix的用法示例。


在下文中一共展示了QuickFix.GetInt方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnMessage

        //Receive market data
        public void OnMessage(QuickFix.FIX42.MarketDataSnapshotFullRefresh message, SessionID session)
        {
            decimal _bidPrice = 0.00M;
            decimal _askPrice = 0.00M;

            try
            {
                QuickFix.Group noMDEntriesGrp = new QuickFix.FIX42.MarketDataSnapshotFullRefresh.NoMDEntriesGroup();

                for (int grpIndex = 1; grpIndex <= message.GetInt(QuickFix.Fields.Tags.NoMDEntries); grpIndex += 1)
                {
                    noMDEntriesGrp = message.GetGroup(grpIndex, QuickFix.Fields.Tags.NoMDEntries);

                    if (noMDEntriesGrp.IsSetField(QuickFix.Fields.Tags.BidPx))
                    {
                        _bidPrice = QuickFix.Fields.Converters.DecimalConverter.Convert(noMDEntriesGrp.GetField(QuickFix.Fields.Tags.BidPx));
                    }

                    if (noMDEntriesGrp.IsSetField(QuickFix.Fields.Tags.OfferPx))
                    {
                        _askPrice = QuickFix.Fields.Converters.DecimalConverter.Convert(noMDEntriesGrp.GetField(QuickFix.Fields.Tags.OfferPx));
                    }

                }

                string SecEx = null;
                string symbol = null;
                string secID = null;

                QuickFix.Fields.SecurityExchange se = new QuickFix.Fields.SecurityExchange();
                if (message.IsSetField(se))
                { SecEx = message.GetField(se).ToString(); }

                QuickFix.Fields.Symbol s = new QuickFix.Fields.Symbol();
                if (message.IsSetField(s))
                { symbol = message.GetField(s).ToString(); }

                QuickFix.Fields.SecurityID sid = new QuickFix.Fields.SecurityID();
                if (message.IsSetField(sid))
                { secID = message.GetField(sid).ToString(); }

                updatePrices(SecEx, symbol, secID, _bidPrice, _askPrice);
            }
            catch (Exception ex)
            {
                updateDisplay(string.Format("QuickFIX Error: {0}", System.Reflection.MethodBase.GetCurrentMethod().Name));
                log.WriteLog(string.Format("{0} : {1}", System.Reflection.MethodBase.GetCurrentMethod().Name, ex.ToString()));
            }
        }
开发者ID:AntoniosHadji,项目名称:TT-FIX-AutoFlatten,代码行数:50,代码来源:QFApplication.cs

示例2: Create

        public Session Create(SessionID sessionID, QuickFix.Dictionary settings)
        {
            string connectionType = settings.GetString(SessionSettings.CONNECTION_TYPE);
            if (!"acceptor".Equals(connectionType) && !"initiator".Equals(connectionType))
                throw new ConfigError("Invalid ConnectionType");

            if ("acceptor".Equals(connectionType) && settings.Has(SessionSettings.SESSION_QUALIFIER))
                throw new ConfigError("SessionQualifier cannot be used with acceptor.");

            bool useDataDictionary = true;
            if (settings.Has(SessionSettings.USE_DATA_DICTIONARY))
                useDataDictionary = settings.GetBool(SessionSettings.USE_DATA_DICTIONARY);

            QuickFix.Fields.ApplVerID defaultApplVerID = null;
            if (sessionID.IsFIXT)
            {
                if (!settings.Has(SessionSettings.DEFAULT_APPLVERID))
                {
                    throw new ConfigError("ApplVerID is required for FIXT transport");
                }
                defaultApplVerID = Message.GetApplVerID(settings.GetString(SessionSettings.DEFAULT_APPLVERID));

            }

            DataDictionaryProvider dd = new DataDictionaryProvider();
            if (useDataDictionary)
            {
                if (sessionID.IsFIXT)
                    ProcessFixTDataDictionaries(sessionID, settings, dd);
                else
                    ProcessFixDataDictionary(sessionID, settings, dd);
            }

            int heartBtInt = 0;
            if ( connectionType == "initiator" )
            {
                heartBtInt = System.Convert.ToInt32(settings.GetLong( SessionSettings.HEARTBTINT ));
                if ( heartBtInt <= 0 )
                    throw new ConfigError( "Heartbeat must be greater than zero" );
            }
            string senderDefaultApplVerId = "";
            if(defaultApplVerID != null)
                senderDefaultApplVerId = defaultApplVerID.Obj;

            Session session = new Session(
                application_,
                messageStoreFactory_,
                sessionID,
                dd,
                new SessionSchedule(settings),
                heartBtInt,
                logFactory_,
                messageFactory_,
                senderDefaultApplVerId);

            if (settings.Has(SessionSettings.SEND_REDUNDANT_RESENDREQUESTS))
                session.SendRedundantResendRequests = settings.GetBool(SessionSettings.SEND_REDUNDANT_RESENDREQUESTS);
            if (settings.Has(SessionSettings.RESEND_SESSION_LEVEL_REJECTS))
                session.ResendSessionLevelRejects = settings.GetBool(SessionSettings.RESEND_SESSION_LEVEL_REJECTS);
            /** FIXME - implement optional settings
            if (settings.Has(SessionSettings.CHECK_COMPID))
                session.SetCheckCompId(settings.GetBool(SessionSettings.CHECK_COMPID));
             */
            if (settings.Has(SessionSettings.CHECK_LATENCY))
                session.CheckLatency = settings.GetBool(SessionSettings.CHECK_LATENCY);
            if (settings.Has(SessionSettings.MAX_LATENCY))
                session.MaxLatency = settings.GetInt(SessionSettings.MAX_LATENCY);
            if (settings.Has(SessionSettings.LOGON_TIMEOUT))
                session.LogonTimeout = settings.GetInt(SessionSettings.LOGON_TIMEOUT);
            if (settings.Has(SessionSettings.LOGOUT_TIMEOUT))
                session.LogoutTimeout = settings.GetInt(SessionSettings.LOGOUT_TIMEOUT);
            if (settings.Has(SessionSettings.RESET_ON_LOGON))
                session.ResetOnLogon = settings.GetBool(SessionSettings.RESET_ON_LOGON);
            if (settings.Has(SessionSettings.RESET_ON_LOGOUT))
                session.ResetOnLogout = settings.GetBool(SessionSettings.RESET_ON_LOGOUT);
            if (settings.Has(SessionSettings.RESET_ON_DISCONNECT))
                session.ResetOnDisconnect = settings.GetBool(SessionSettings.RESET_ON_DISCONNECT);
            if (settings.Has(SessionSettings.REFRESH_ON_LOGON))
                session.RefreshOnLogon = settings.GetBool(SessionSettings.REFRESH_ON_LOGON);
            if (settings.Has(SessionSettings.PERSIST_MESSAGES))
                session.PersistMessages = settings.GetBool(SessionSettings.PERSIST_MESSAGES);
            if (settings.Has(SessionSettings.MILLISECONDS_IN_TIMESTAMP))
                session.MillisecondsInTimeStamp = settings.GetBool(SessionSettings.MILLISECONDS_IN_TIMESTAMP);
            if (settings.Has(SessionSettings.ENABLE_LAST_MSG_SEQ_NUM_PROCESSED))
                session.EnableLastMsgSeqNumProcessed = settings.GetBool(SessionSettings.ENABLE_LAST_MSG_SEQ_NUM_PROCESSED);
            if (settings.Has(SessionSettings.MAX_MESSAGES_IN_RESEND_REQUEST))
                session.MaxMessagesInResendRequest = settings.GetInt(SessionSettings.MAX_MESSAGES_IN_RESEND_REQUEST);
            if (settings.Has(SessionSettings.SEND_LOGOUT_BEFORE_TIMEOUT_DISCONNECT))
                session.SendLogoutBeforeTimeoutDisconnect = settings.GetBool(SessionSettings.SEND_LOGOUT_BEFORE_TIMEOUT_DISCONNECT);
            if (settings.Has(SessionSettings.IGNORE_POSSDUP_RESEND_REQUESTS))
                session.IgnorePossDupResendRequests = settings.GetBool(SessionSettings.IGNORE_POSSDUP_RESEND_REQUESTS);
            if (settings.Has(SessionSettings.VALIDATE_LENGTH_AND_CHECKSUM))
                session.ValidateLengthAndChecksum = settings.GetBool(SessionSettings.VALIDATE_LENGTH_AND_CHECKSUM);
            if (settings.Has(SessionSettings.RESETSEQUENCE_MESSAGE_REQUIRES_ORIGSENDINGTIME))
                session.RequiresOrigSendingTime = settings.GetBool(SessionSettings.RESETSEQUENCE_MESSAGE_REQUIRES_ORIGSENDINGTIME);

            return session;
        }
开发者ID:dafanasiev,项目名称:quickfixn,代码行数:98,代码来源:SessionFactory.cs

示例3: Configure

        /// <summary>
        /// Setup socket settings based on setttings specified in dictionary
        /// </summary>
        /// <remarks>
        /// used "Configure" as name since it is used in a lot of other places, 
        /// alternative names are ReadSettings or FromDictionary 
        /// </remarks>
        /// <param name="dictionary">the dictionary to read the settings from</param>
        public void Configure(QuickFix.Dictionary dictionary)
        {
            if (dictionary.Has(SessionSettings.SOCKET_NODELAY))
                SocketNodelay = dictionary.GetBool(SessionSettings.SOCKET_NODELAY);

            if (dictionary.Has(SessionSettings.SOCKET_RECEIVE_BUFFER_SIZE))
                SocketReceiveBufferSize = dictionary.GetInt(SessionSettings.SOCKET_RECEIVE_BUFFER_SIZE);

            if (dictionary.Has(SessionSettings.SOCKET_SEND_BUFFER_SIZE))
                SocketSendBufferSize = dictionary.GetInt(SessionSettings.SOCKET_SEND_BUFFER_SIZE);

            if (dictionary.Has(SessionSettings.SSL_SERVERNAME))
                ServerCommonName = dictionary.GetString(SessionSettings.SSL_SERVERNAME);

            if (dictionary.Has(SessionSettings.SSL_CA_CERTIFICATE))
                CACertificatePath = dictionary.GetString(SessionSettings.SSL_CA_CERTIFICATE);

            if (dictionary.Has(SessionSettings.SSL_CERTIFICATE))
                CertificatePath = dictionary.GetString(SessionSettings.SSL_CERTIFICATE);

            if (dictionary.Has(SessionSettings.SSL_CERTIFICATE_PASSWORD))
                CertificatePassword = dictionary.GetString(SessionSettings.SSL_CERTIFICATE_PASSWORD);

            if (dictionary.Has(SessionSettings.SSL_VALIDATE_CERTIFICATES))
                ValidateCertificates = dictionary.GetBool(SessionSettings.SSL_VALIDATE_CERTIFICATES);

            if (dictionary.Has(SessionSettings.SSL_CHECK_CERTIFICATE_REVOCATION))
                CheckCertificateRevocation = dictionary.GetBool(SessionSettings.SSL_CHECK_CERTIFICATE_REVOCATION);

            // Use setting for client certificate check if one exist 
            // otherwise enable client certificate check if a ca certificate is specified
            if (dictionary.Has(SessionSettings.SSL_REQUIRE_CLIENT_CERTIFICATE))
                RequireClientCertificate = dictionary.GetBool(SessionSettings.SSL_REQUIRE_CLIENT_CERTIFICATE);

            // Use setting for SSL if one exist 
            // otherwise enable ssl if certificate path is specified 
            if (dictionary.Has(SessionSettings.SSL_ENABLE))
                UseSSL = dictionary.GetBool(SessionSettings.SSL_ENABLE);
            else
                UseSSL = !string.IsNullOrEmpty(CertificatePath);

            if (dictionary.Has(SessionSettings.SSL_PROTOCOLS))
            {
                var protocolString = dictionary.GetString(SessionSettings.SSL_PROTOCOLS);

                try
                {
                    SslProtocol = (System.Security.Authentication.SslProtocols)
                        Enum.Parse(typeof(System.Security.Authentication.SslProtocols), protocolString, true);
                }
                catch (Exception)
                {
                    // TODO: figure out a way to log this somehow (even though it's not likely to occur)
                }
            }
        }
开发者ID:RemiGaudin,项目名称:quickfixn,代码行数:64,代码来源:SocketSettings.cs


注:本文中的QuickFix.GetInt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。