コード例 #1
0
        public void DeleteWorker(object v)
        {
            string id = string.Empty;

            if (v is OPENDELETE)
            {
                OPENDELETE value = v as OPENDELETE;

                id = value.basic.ID;
            }
            else
            {
                CLOSEDELETE value = v as CLOSEDELETE;
                id = value.basic.ID;
            }

            if (!Workers.Keys.Contains(id))
            {
                return;
            }

            //结束策略实例
            Workers[id].breaklabel = true;

            //策略管理中删除该实例信息
            Workers.Remove(id);
            WorkersStratus.Remove(id);

            //行情模块中删除该策略实例的订阅,和消息队列
            DeleteStrategySubscribe(id);
            MarketInfo.SetStrategyQueue(new KeyValuePair <String, Queue>(id, new Queue()));

            if (DBAccessLayer.DBEnable)
            {
                if (v is OPENDELETE)
                {
                    DBAccessLayer.DeleteSGOPEN(id);
                }
                else
                {
                    DBAccessLayer.DeleteSGCLOSE(id);
                }
            }
        }
コード例 #2
0
        public static void UpdateDatebase(string type, object value)
        {
            switch (type)
            {
            case "A1":
            {
                OPENCREATE data = (OPENCREATE)value;

                break;
            }

            case "A2":
            {
                OPENMODIFY data = (OPENMODIFY)value;
                break;
            }

            case "A3":
            {
                OPENRUN data = (OPENRUN)value;
                break;
            }

            case "A4":
            {
                OPENALLOW data = (OPENALLOW)value;
                break;
            }

            case "A5":
            {
                OPENDELETE data = (OPENDELETE)value;
                break;
            }

            case "B1":
            {
                CLOSECREATE data = (CLOSECREATE)value;
                break;
            }

            case "B2":
            {
                CLOSEMODIFY data = (CLOSEMODIFY)value;
                break;
            }

            case "B3":
            {
                CLOSERUN data = (CLOSERUN)value;
                break;
            }

            case "B4":
            {
                CLOSEALLOW data = (CLOSEALLOW)value;
                break;
            }

            case "B5":
            {
                CLOSEDELETE data = (CLOSEDELETE)value;
                break;
            }

            case "C1":
            {
                MakeOrder data = (MakeOrder)value;
                break;
            }
            }
        }