コード例 #1
0
ファイル: KTASimulator.cs プロジェクト: junwin/TradingTools
        /// <summary>
        /// Override the base driver DoStop method
        /// </summary>
        protected override void DoStop()
        {
            try
            {
                this.StopTimer();
                m_GenPrices = false;
                m_PriceThread.Abort();

                // Report that we are stopped - this will show in the Driver view
                // in the dashboard
                SendStatusMessage(KaiTrade.Interfaces.Status.closed, "TDA Driver is closed");

                _clOrdIDOrderMap.Clear();
                m_OrderContextOrdID.Clear();

                _products.Clear();

                foreach (L1PriceSupport.PXPublisher myPub in _publisherRegister.Values)
                {
                    (myPub as KaiTrade.Interfaces.IPublisher).Status = KaiTrade.Interfaces.Status.closed;
                }

                _publisherRegister.Clear();
                setStatus(KaiTrade.Interfaces.Status.closed);
                _runningState = new DriverBase.DriverStatus(StatusConditon.none, StatusConditon.none);

            }
            catch (Exception myE)
            {
                log.Error("Kaitrade.Interfaces.Driver.Stop:", myE);
            }
        }
コード例 #2
0
ファイル: KTASimulator.cs プロジェクト: junwin/TradingTools
        /// <summary>
        /// Override the base class DoStart
        /// </summary>
        protected override void DoStart(string myState)
        {
            try
            {
                log = log4net.LogManager.GetLogger("Kaitrade");

                log.Info("KTA Simulator Driver Started");

                // try load our config file
                processConfigFile(_configPath + "SimulatorConfig.txt");

                m_GenPrices = true;
                m_PriceThread = new Thread(new ThreadStart(this.generatePrices));
                m_PriceThread.SetApartmentState(ApartmentState.MTA);
                m_PriceThread.Start();

                // do the file thing in SubscribeMD
                //this.AddPriceFile("KTSIM:ZZ:DELL:ESXXXX", "testdata.csv");

                // Report that we are open - this will show in the Driver view
                // in the dashboard
                SendStatusMessage(KaiTrade.Interfaces.Status.open, "KT Simulator Driver is open");

                AddAccount("JSMITH", "Simulator JSMITH", "KAI");
                AddAccount("MGiles", "Simulator MGiles", "KAI");
                AddAccount("MWTrader", "Simulator MWTrader", "KAIB");
                AddAccount("AKlien", "Simulator AKlien", "KAIB");
                AddAccount("ACMEFund", "Simulator ACMEFund", "KAIB");
                AddAccount("NewTrade", "Simulator NewTrade", "KAIB");
                AddAccount("TestBadAccount", "Account will be rejected", "KAIB");

                /// Get any price files in PriceData and use them for markets and price generation
                try
                {
                    GetPriceFiles();
                }
                catch (Exception myE)
                {
                }

                setStatus(KaiTrade.Interfaces.Status.open);
                StartTimer();
                _runningState = new DriverBase.DriverStatus(StatusConditon.good, StatusConditon.good);

                    if (!_state.HideDriverUI)
                    {
                        m_MainForm.Show();
                    }

            }
            catch (Exception myE)
            {
                log.Error("doStart", myE);
            }
        }