コード例 #1
0
ファイル: KTACQG.cs プロジェクト: junwin/TradingTools
        private void processConfig(CQGConfig  config)
        {
            try
            {

            }
            catch (Exception myE)
            {
                log.Error("processConfig", myE);
            }
        }
コード例 #2
0
ファイル: KTACQG.cs プロジェクト: junwin/TradingTools
        /// <summary>
        /// Start the CQG Adapter
        /// </summary>
        /// <param name="myState"></param>
        protected override void DoStart(string myState)
        {
            try
            {
                driverLog.Info("KTACQG doStart");

                // open the CQG Host form
                m_CQGHostForm = new CQGFrm();
                m_CQGHostForm.Adapter = this;
                m_CQGHostForm.Show();
                if (base._state.HideDriverUI)
                {
                        //CQGHostForm.Hide();
                }
                // Read the configuration data
                try
                {
                    using (StreamReader sr = new StreamReader(_configPath + "CQGConfig.xml"))
                    {
                        _config = JsonConvert.DeserializeObject<CQGConfig>(sr.ReadToEnd());
                    }

                    // process config file
                    processConfig(_config);
                }
                catch(Exception e)
                {
                    // not consider an issue if not found
                    driverLog.Error("error processing config", e);
                }

                // do any property processing
                try
                {
                    string orTicks = Facade.GetUserProfileProperty("*", m_ID + "::" + "RequiredORIntervalTicks");
                    string useOEThrottle = Facade.GetUserProfileProperty("*", m_ID + "::" + "UseOEThrottle");

                    if (useOEThrottle.ToLower() == "true")
                    {
                        UseOEThrottle = true;
                    }
                    else
                    {
                        UseOEThrottle = false;
                    }

                    if (long.Parse(orTicks) >= 0)
                    {
                        RequiredORIntervalTicks = long.Parse(orTicks);
                    }
                }
                catch (Exception myE)
                {
                    driverLog.Error("property processing", myE);
                }

                m_tickCount = 0;
                m_TimeWarningCount = 0;

                //m_CQGHostForm.Hide();

                // Start connection to CQG
                InitializeCQGCEL();

                // Report that we are open - this will show in the adapter view
                // in the dashboard
                this.SendStatusMessage(KaiTrade.Interfaces.Status.open, "KTCQG adapter is open");
                driverLog.Info("KTCQG adapter is open");
            }
            catch (Exception myE)
            {
                this.SendStatusMessage(KaiTrade.Interfaces.Status.error, "KTCQG is not working");
            }
        }
コード例 #3
0
ファイル: KTACQG.cs プロジェクト: junwin/TradingTools
        public KTACQG()
        {
            // initialize member data

            // set our ID
            m_ID = "KTACQG";

            // this is the name used in the publisher
            Name = "KTACQG";
            driverLog.Info("KTACQG Created");

            _config = new CQGConfig();

            m_SubscribedProducts = new System.Collections.Hashtable();
            //m_SubjectRegister = new System.Collections.Hashtable();

            //m_ClIDOrder = new System.Collections.Hashtable();
            m_GUID2CQGOrder = new System.Collections.Hashtable();
            m_TSSets = new Dictionary<string, KaiTrade.Interfaces.ITSSet>();
            m_DelayedProductRequests = new Stack<KaiTrade.Interfaces.IProduct>();
            m_ExpressionStrategyID = new Dictionary<string, string>();
            m_ExecutionPatterns = new Dictionary<string, string>();
            // set status to down
            setGWStatus(eConnectionStatus.csConnectionDown);

            m_DataStatus = eConnectionStatus.csConnectionDown;

            m_RunningState = new DriverBase.DriverStatus();
        }