Exemple #1
0
        // Create
        public MyStrategy(TStrategy s, TLogin login)
        {
            strategyT = s;
            this.gmLogin = login;

            // pm manager
            pm = (PoolManager)Activator.CreateInstance(strategyT.Pool.ManagerType, this, strategyT.Pool);
            // monitors
            TAInfo info = new TAInfo(strategyT.TAInfoParameters);           
            monitors = new Dictionary<string, Monitor>();
            foreach (TInstrument ins in strategyT.Instruments)
            {
                Monitor monitor = new Monitor(this, ins, info, strategyT.DLLName);

                symbols += ins.Symbol + ",";
                monitors.Add(ins.Symbol, monitor);

                if (monitor.Target.Symbol == pm.SymbolBench)
                    monitor.IsBench = true;
            }

            // RiskM
            riskM = new RiskM(this, strategyT.RiskMInfoParameters);

            // heartTimer
            heartTimer = new System.Timers.Timer();
            heartTimer.Elapsed += new System.Timers.ElapsedEventHandler(heartTimer_Elapsed);
            heartTimer.Interval = 1000;     // 1s
        }
Exemple #2
0
        private void Initialize()
        {
            try
            {
                // DataBase Operation
                TStrategy strategyT = CRUD.GetTStrategy(args[0]);

                // TLogin
                TLogin gmLogin = null;
                if (args.Length == 3)
                    gmLogin = new TLogin(args[1], args[2]);
                else
                    gmLogin = CRUD.GetTLogin();

                strategy = new MyStrategy(strategyT, gmLogin);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                //popup.TaskFinished(ex.Message);
                return;
            }
        
            // new MyStrategy and Prepare preStart Data.
            strategy.InitializeExceptionOccur += new MyStrategy.InitializeExceptionCallback(ProcessInitializeExecption);

            HookStrategyToGUI();
            strategy.Initialize();

            popup.TaskFinished(null);
        }