//private double _LossPrice;
        /// <summary>
        /// 止损价 为了给自动止盈止损用
        /// </summary>
        //public double LossPrice
        //{
        //    get { return _LossPrice; }

        //    set
        //    {
        //        if (_LossPrice != value)
        //        {
        //            _LossPrice = value;
        //            RaisePropertyChanged("LossPrice");
        //        }
        //    }
        //}


        //private double _NewPrice;
        ///// <summary>
        ///// 最新价 为了给自动止盈止损用
        ///// </summary>
        //public double NewPrice
        //{
        //    get { return _NewPrice; }

        //    set
        //    {
        //        if (_NewPrice != value)
        //        {
        //            _NewPrice = value;
        //            RaisePropertyChanged("NewPrice");
        //        }
        //    }
        //}



        public PotionDetailModelViewModel Clone(PotionDetailModelViewModel tpm)
        {
            PotionDetailModelViewModel temp = new PotionDetailModelViewModel(new PotionDetailModel());

            temp.AbleVolume           = tpm.AbleVolume;
            temp.ContractCode         = tpm.ContractCode;
            temp.ContractId           = tpm.ContractId;
            temp.Direction            = tpm.Direction;
            temp.LossVolume           = tpm.LossVolume;
            temp.OpenDate             = tpm.OpenDate;
            temp.OpenPrice            = tpm.OpenPrice;
            temp.OpenTime             = tpm.OpenTime;
            temp.OrderId              = tpm.OrderId;
            temp.PositionProfitLoss   = tpm.PositionProfitLoss;
            temp.PositionProfitLossJB = tpm.PositionProfitLossJB;
            temp.PositionVolume       = tpm.PositionVolume;
            temp.ProfitVolume         = tpm.ProfitVolume;
            temp.PsitionId            = tpm.PsitionId;
            temp.ShadowOrderID        = tpm.ShadowOrderID;
            temp.ShadowPositionid     = tpm.ShadowPositionid;
            temp.ShadowTradeId        = tpm.ShadowTradeId;
            temp.TradeId              = tpm.TradeId;
            temp.UseMargin            = tpm.UseMargin;
            temp.SysUseMargin         = tpm.SysUseMargin;
            temp.UserID    = tpm.UserID;
            temp.Precision = tpm.Precision;
            return(temp);
        }
Example #2
0
 public static CheckFullStopViewModel Instance(PotionDetailModelViewModel pmvm)
 {
     if (pmvm == null && _CheckFullStopViewModel == null)
     {
         return(null);
     }
     if (_CheckFullStopViewModel == null)
     {
         _CheckFullStopViewModel = new CheckFullStopViewModel(pmvm);
     }
     return(_CheckFullStopViewModel);
 }
Example #3
0
        private CheckFullStopViewModel(PotionDetailModelViewModel pmvm)
        {
            _PositionModelViewModel = pmvm;
            ContractCode            = pmvm.ContractCode;
            _AllNum   = _PositionModelViewModel.PositionVolume;
            Direction = pmvm.Direction == "B" ? " (买入,投机) " : " (卖出,投机) ";


            VarietyModel vm = null;

            string[] values = pmvm.ContractCode.Split(' ');
            if (values.Length != 3)
            {
                return;
            }
            string varietie = values[1];

            if (ContractVariety.Varieties.ContainsKey(varietie))
            {
                vm = ContractVariety.Varieties[varietie];
            }
            if (vm == null)
            {
                return;
            }
            Increment = vm.tick_size;
            length    = vm.precision;
            ////发送命令
            //ReqPotion rp = new ReqPotion();
            //rp.cmdcode = RequestCmdCode.SelectStopLoss;
            //rp.content = new ReqLoginName() { user_id = UserInfoHelper.UserId };
            //ScoketManager.GetInstance().SendTradeWSInfo(JsonConvert.SerializeObject(rp));
            if (ContractVariety.CFSmvmList.ContainsKey(_PositionModelViewModel.ContractId + _PositionModelViewModel.Direction))
            {
                foreach (var item in ContractVariety.CFSmvmList[_PositionModelViewModel.ContractId + _PositionModelViewModel.Direction])
                {
                    item.Increment = Increment;
                    item.Precision = length;
                    CheckFullStopModel cfsm = new CheckFullStopModel();
                    cfsm.contract_code   = _PositionModelViewModel.ContractCode;
                    cfsm.contract_id     = _PositionModelViewModel.ContractId;
                    cfsm.create_date     = DateTime.Now.ToString("yyyy-MM-dd");
                    cfsm.create_time     = DateTime.Now.ToString("HH:mm:ss");
                    cfsm.user_id         = UserInfoHelper.UserId;
                    cfsm.order_volume    = _PositionModelViewModel.PositionVolume;
                    cfsm.resource        = (int)OperatorTradeType.OPERATOR_TRADE_PC;
                    cfsm.direction       = item.Direction;
                    cfsm.float_loss      = item.FloatLoss;
                    cfsm.float_loss_flag = item.FloatLossFlag;
                    cfsm.open_offset     = item.OpenOffset;
                    cfsm.order_volume    = item.OrderVolume;

                    CheckFullStopModelViewModel cfsvm = new CheckFullStopModelViewModel(cfsm);
                    cfsvm.Increment        = item.Increment;
                    cfsvm.Precision        = item.Precision;
                    cfsvm.Direction        = item.Direction;
                    cfsvm.MaxNum           = item.MaxNum;
                    cfsvm.StopprofitPrice  = item.StopprofitPrice;
                    cfsvm.StoplossId       = item.StoplossId;
                    cfsvm.TrrigerCondition = item.TrrigerCondition;
                    cfsvm.TrrigerPrice     = item.TrrigerPrice;
                    cfsvm.FloatLoss        = item.FloatLoss;
                    cfsvm.StoplossPrice    = item.StoplossPrice;
                    cfsvm.CreateDate       = item.CreateDate;
                    cfsvm.OrderVolume      = item.OrderVolume;
                    CFSMVMList.Add(cfsvm);
                }
            }
            if (CFSMVMList.Count > 0)
            {
                IsHaveData = true;
            }
            AddData();
        }