Exemple #1
0
        /// <summary>
        /// 加入策略到列表视图,同时生成一个策略实例
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void AddStrategyToListView(object sender, EventArgs e)
        {
            StrategyDesc sd = (StrategyDesc)((ToolStripMenuItem)sender).Tag;

            SqliteHelper.Instance.Save <StrategyDesc>(sd);
            AddStrategyToListView(sd);
        }
Exemple #2
0
        void ReceivedAllStrategy(string message)
        {
            // FIXME:
            StrategyDesc sd0 = new StrategyDesc
            {
                Name    = "python策略示例",
                Desc    = "策略示例",
                Dll     = "Stock.Strategy.Python.Rotation.dll",
                Clazz   = "Stock.Strategy.Python.Rotation.RotationStrategy",
                Enabled = true,
                Group   = 0,
                Date    = DateTime.Now
            };
            StrategyDesc sd1 = new StrategyDesc
            {
                Name    = "雪球策略",
                Desc    = "跟踪雪球策略",
                Dll     = "Stock.Strategy.XueQiu.dll",
                Clazz   = "Stock.Strategy.XueQiu.TraceXueQiuStrategy",
                Enabled = true,
                Group   = 0,
                Date    = DateTime.Now
            };

            this.Invoke((MethodInvoker) delegate
            {
                // 从服务器获取策略数据,
                StrategyDesc[] sds = new StrategyDesc[] { sd0, sd1 };  // LoadStrategyList(message);
                InitStrategyMenu(sds.ToArray <StrategyDesc>());
            });
        }
Exemple #3
0
        private void  除策略ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int id = ((StrategyControl)this.listView1.SelectedItems[0].Tag).Strategy.Id;

            this.listView1.Items.Remove(this.listView1.SelectedItems[0]);
            StrategyDesc sd = SqliteHelper.Instance.Load <StrategyDesc>(id);

            SqliteHelper.Instance.Delete <StrategyDesc>(sd);
        }
Exemple #4
0
        private void AddStrategyToListView(StrategyDesc sd)
        {
            BaseStrategy strategy = (BaseStrategy)StrategyManager.Instance.AddMyStrategy(sd.dllPath, sd.clazz);

            System.Windows.Forms.ListViewItem lvi = new System.Windows.Forms.ListViewItem(new string[] {
            sd.name,
            sd.desc}, -1);
            lvi.Group = this.listView1.Groups[sd.group];
            lvi.Tag = strategy.Control;
            this.listView1.Items.Add(lvi);
        }
Exemple #5
0
        private StrategyDesc[] loadStrategyList()
        {
            StrategyDesc[] sd = new StrategyDesc[] { new StrategyDesc(), new StrategyDesc() };
            sd[0].clazz = "Stock.Strategy.Settings.RotationStrategyForm";
            sd[0].desc  = "说明:西胖子轮动策略";
            sd[0].name  = "西胖子轮动策略";
            sd[0].group = 0;
            sd[1].clazz = "Stock.Strategy.Settings.RotationStrategyForm";
            sd[1].desc  = "说明:箱体高抛低吸策略";
            sd[1].name  = "箱体策略";
            sd[1].group = 1;

            return(sd);
        }
Exemple #6
0
        private void AddStrategyToListView(StrategyDesc sd)
        {
            BaseStrategy strategy = (BaseStrategy)StrategyManager.Instance.AddMyStrategy(sd.dllPath, sd.clazz);

            // BaseStrategy strategy = new Stock.Strategy.RotationB.RotationBStrategy();
            StrategyManager.Instance.AddMyStrategy(strategy);
            System.Windows.Forms.ListViewItem lvi = new System.Windows.Forms.ListViewItem(new string[] {
                sd.name,
                sd.desc
            }, -1);
            lvi.Group = this.listView1.Groups[sd.group];
            lvi.Tag   = strategy.Control;
            this.listView1.Items.Add(lvi);
        }
Exemple #7
0
        private void AddStrategyToListView(StrategyDesc sd)
        {
            BaseStrategy strategy = (BaseStrategy)DllUtils.CreateInstance <IStrategy>(sd.Dll, sd.Clazz);

            strategy.Id = sd.Id;
            strategy.Init();
            StrategyManager.Instance.AddMyStrategy(strategy);
            System.Windows.Forms.ListViewItem lvi = new System.Windows.Forms.ListViewItem(new string[] {
                sd.Name,
                sd.Desc
            }, -1);
            lvi.Group = this.listView1.Groups[sd.Group];
            lvi.Tag   = strategy.Control;
            this.listView1.Items.Add(lvi);
        }
Exemple #8
0
        private void AddStrategyToListView(StrategyDesc sd)
        {
            PythonStrategyControl control = new Stock.Strategy.Rotation.RatationStrategyControl();
            // Assembly asm = Assembly.LoadFile("E:\\projects\\StockTrader\\StockTrader\\bin\\Debug\\StockStrategy.dll");
            // PythonStrategyControl control = (PythonStrategyControl)asm.GetType(sd.clazz).Assembly.CreateInstance(sd.clazz);

            StrategyManager.Instance.AddMyStrategy(control.Strategy);

            System.Windows.Forms.ListViewItem lvi = new System.Windows.Forms.ListViewItem(new string[] {
            sd.name,
            sd.desc}, -1);
            lvi.Group = this.listView1.Groups[sd.group];
            lvi.Tag = control;
            this.listView1.Items.Add(lvi);
        }
Exemple #9
0
        /// <summary>
        /// 加入策略到列表视图,同时生成一个策略实例
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void AddStrategyToListView(object sender, EventArgs e)
        {
            StrategyDesc sd = (StrategyDesc)((ToolStripMenuItem)sender).Tag;

            PythonStrategyControl control = new Stock.Strategy.Rotation.RatationStrategyControl();

            StrategyManager.Instance.AddMyStrategy(control.Strategy);

            System.Windows.Forms.ListViewItem lvi = new System.Windows.Forms.ListViewItem(new string[] {
                sd.name,
                sd.desc
            }, -1);
            lvi.Group = this.listView1.Groups[sd.group];
            lvi.Tag   = control;
            this.listView1.Items.Add(lvi);
        }
Exemple #10
0
        /// <summary>
        /// 加入策略到列表视图。
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void AddStrategyToListView(object sender, EventArgs e)
        {
            StrategyDesc sd = (StrategyDesc)((ToolStripMenuItem)sender).Tag;

            BaseSettingForm form = new Stock.Strategy.Settings.RotationStrategyForm();

            StrategyManager.Instance.AddMyStrategy(form.Strategy);

            System.Windows.Forms.ListViewItem lvi = new System.Windows.Forms.ListViewItem(new string[] {
                sd.name,
                sd.desc
            }, -1);
            lvi.Group = this.listView1.Groups[sd.group];
            lvi.Tag   = form;
            this.listView1.Items.Add(lvi);
        }
Exemple #11
0
        private StrategyDesc[] LoadStrategyList()
        {
            StrategyDesc[] sd = new StrategyDesc[] { new StrategyDesc() };
            sd[0].clazz   = "Stock.Strategy.Python.Rotation.RotationStrategy";
            sd[0].dllPath = "Stock.Strategy.Python.Rotation.dll";
            sd[0].desc    = "说明:分级A轮动策略";
            sd[0].name    = "T+0 呼吸大法";
            sd[0].group   = 1;
            //sd[1].clazz = "Stock.Strategy.RotationB.RotationBStrategy";
            //sd[1].dllPath = "Stock.Strategy.RotationB.dll";
            //sd[1].desc = "说明:分级B强势轮动策略";
            //sd[1].name = "分级B强势轮动策略";
            //sd[1].group = 0;

            return(sd);
        }
Exemple #12
0
        private StrategyDesc[] LoadMyStrategyList()
        {
            StrategyDesc[] sd = new StrategyDesc[] { new StrategyDesc() };

            // FIXME: 不能运行的情况下, 注释157-161行,取消注释152-156行
            //sd[0].clazz = "Stock.Strategy.Python.Rotation.RotationStrategy";
            //sd[0].dllPath = "Stock.Strategy.Python.Rotation.dll";
            //sd[0].desc = "说明:分级A轮动策略";
            //sd[0].name = "T+0 呼吸大法";
            //sd[0].group = 1;
            sd[0].clazz   = "Stock.Strategy.RotationB.RotationBStrategy";
            sd[0].dllPath = "Stock.Strategy.RotationB.dll";
            sd[0].desc    = "说明:分级B强势轮动策略";
            sd[0].name    = "分级B强势轮动策略";
            sd[0].group   = 0;

            return(sd);
        }
Exemple #13
0
        private StrategyDesc[] LoadStrategyList()
        {
            StrategyDesc[] sd = new StrategyDesc[] { new StrategyDesc() };
            sd[0].clazz = "Stock.Strategy.Python.Rotation.RotationStrategy";
            sd[0].dllPath = "Stock.Strategy.Python.Rotation.dll";
            sd[0].desc = "说明:分级A轮动策略";
            sd[0].name = "T+0 呼吸大法";
            sd[0].group = 1;
            //sd[1].clazz = "Stock.Strategy.RotationB.RotationBStrategy";
            //sd[1].dllPath = "Stock.Strategy.RotationB.dll";
            //sd[1].desc = "说明:分级B强势轮动策略";
            //sd[1].name = "分级B强势轮动策略";
            //sd[1].group = 0;

            return sd;
        }
Exemple #14
0
        private StrategyDesc[] LoadMyStrategyList()
        {
            StrategyDesc[] sd = new StrategyDesc[] { new StrategyDesc() };

            // FIXME: 不能运行的情况下, 注释157-161行,取消注释152-156行
            //sd[0].clazz = "Stock.Strategy.Python.Rotation.RotationStrategy";
            //sd[0].dllPath = "Stock.Strategy.Python.Rotation.dll";
            //sd[0].desc = "说明:分级A轮动策略";
            //sd[0].name = "T+0 呼吸大法";
            //sd[0].group = 1;
            sd[0].clazz = "Stock.Strategy.RotationB.RotationBStrategy";
            sd[0].dllPath = "Stock.Strategy.RotationB.dll";
            sd[0].desc = "说明:分级B强势轮动策略";
            sd[0].name = "分级B强势轮动策略";
            sd[0].group = 0;

            return sd;
        }
Exemple #15
0
        private StrategyDesc[] LoadStrategyList()
        {
            StrategyDesc[] sd = new StrategyDesc[] { new StrategyDesc(), new StrategyDesc() };
            sd[0].clazz = "Stock.Strategy.Settings.RotationStrategyForm";
            sd[0].desc = "说明:分级A轮动策略";
            sd[0].name = "分级A轮动策略";
            sd[0].group = 0;
            sd[1].clazz = "Stock.Strategy.Settings.RotationStrategyForm";
            sd[1].desc = "说明:箱体高抛低吸策略";
            sd[1].name = "箱体策略";
            sd[1].group = 1;

            return sd;
        }
Exemple #16
0
        /// <summary>
        /// 加入策略到列表视图,同时生成一个策略实例
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void AddStrategyToListView(object sender, EventArgs e)
        {
            StrategyDesc sd = (StrategyDesc)((ToolStripMenuItem)sender).Tag;

            AddStrategyToListView(sd);
        }