private ConditionBillViewModel(ConditionBillModelViewModel condtion) { //需要合约号 下单的类型和价格 以及数量 _IsEnabled = false; ContractCode = condtion.ContractCode; VarietyModel vm = null; string[] values = condtion.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; lend = vm.precision; typePrice = condtion.PriceType; if (typePrice == "M") { IsTypePrice = Visibility.Visible; IsPrice = Visibility.Collapsed; Price = 0; PriceTypeBill = "市价"; _priceType = "市价"; } else if (typePrice == "R") { Price = 0; PriceTypeBill = "对手价"; _priceType = "对手价"; IsTypePrice = Visibility.Visible; IsPrice = Visibility.Collapsed; } else { Price = condtion.OrderPrice; typePrice = "L"; IsTypePrice = Visibility.Collapsed; IsPrice = Visibility.Visible; } OrderPrice = condtion.TrrigerPrice; OrderPrice3 = condtion.TrrigerPrice; Num = condtion.OrderVolume; //触发的类型 KeyValue kv0 = new KeyValue() { Id = 0, Value = "最新价" }; KeyValue kv1 = new KeyValue() { Id = 1, Value = "买一价" }; KeyValue kv2 = new KeyValue() { Id = 2, Value = "卖一价" }; PriceList.Add(kv0); PriceList.Add(kv1); PriceList.Add(kv2); PriceItem = kv0; KeyValue ttype0 = new KeyValue() { Id = 0, Value = ">=" }; KeyValue ttype1 = new KeyValue() { Id = 1, Value = "<=" }; TrrigerConditionItem = ttype0; TrrigerCondition.Add(ttype0); TrrigerCondition.Add(ttype1); KeyValue kv03 = new KeyValue() { Id = 0, Value = "最新价" }; KeyValue kv13 = new KeyValue() { Id = 1, Value = "买一价" }; KeyValue kv23 = new KeyValue() { Id = 2, Value = "卖一价" }; PriceList3.Add(kv03); PriceList3.Add(kv13); PriceList3.Add(kv23); PriceItem3 = kv03; KeyValue ttype03 = new KeyValue() { Id = 0, Value = ">=" }; KeyValue ttype13 = new KeyValue() { Id = 1, Value = "<=" }; IsFirst = true; TrrigerCondition3.Add(ttype03); TrrigerCondition3.Add(ttype13); TrrigerConditionItem3 = ttype03; if (condtion.Direction == "B") { IsBuy = true; IsSell = false; } else if (condtion.Direction == "S") { IsBuy = false; IsSell = true; } if (condtion.OpenOffset == (int)OffsetType.OFFSET_OPEN) { IsOpen = true; IsCloseing = false; } else if (condtion.OpenOffset == (int)OffsetType.OFFSET_COVER) { IsCloseing = true; IsOpen = false; } if (condtion.ConditionType == (int)YunConditionType.Y_PRICE) { IsFirst = true; IsSecond = false; IsThird = false; TrrigerConditionItem = TrrigerCondition[condtion.TrrigerCondition]; PriceItem = PriceList[condtion.TrrigerPriceType]; } else if (condtion.ConditionType == (int)YunConditionType.Y_TIME) { IsFirst = false; IsSecond = true; IsThird = false; TrrigerTime = condtion.TrrigerContime; //trriger_contime } else if (condtion.ConditionType == (int)YunConditionType.Y_TIMEPRICE) { IsFirst = false; IsSecond = false; IsThird = true; TrrigerConditionItem = TrrigerCondition3[condtion.TrrigerCondition]; PriceItem3 = PriceList3[condtion.TrrigerPriceType]; TrrigerTime3 = condtion.TrrigerContime; } Upatatecondtion = condtion; }
/// <summary> /// 编辑的参数 /// </summary> /// <param name="para"></param> public ConditionBillViewModel(object para) { //需要合约号 下单的类型和价格 以及数量 //触发的类型 KeyValue kv0 = new KeyValue() { Id = 0, Value = "最新价" }; KeyValue kv1 = new KeyValue() { Id = 1, Value = "买一价" }; KeyValue kv2 = new KeyValue() { Id = 2, Value = "卖一价" }; PriceList.Add(kv0); PriceList.Add(kv1); PriceList.Add(kv2); KeyValue ttype0 = new KeyValue() { Id = 0, Value = ">=" }; KeyValue ttype1 = new KeyValue() { Id = 1, Value = "<=" }; TrrigerCondition.Add(ttype0); TrrigerCondition.Add(ttype1); KeyValue kv03 = new KeyValue() { Id = 0, Value = "最新价" }; KeyValue kv13 = new KeyValue() { Id = 1, Value = "买一价" }; KeyValue kv23 = new KeyValue() { Id = 2, Value = "卖一价" }; PriceList3.Add(kv03); PriceList3.Add(kv13); PriceList3.Add(kv23); KeyValue ttype03 = new KeyValue() { Id = 0, Value = ">=" }; KeyValue ttype13 = new KeyValue() { Id = 1, Value = "<=" }; TrrigerCondition3.Add(ttype03); TrrigerCondition3.Add(ttype13); }
private ConditionBillViewModel(string contractCode, double price, string pricetype, int num) { _IsEnabled = true; //需要合约号 下单的类型和价格 以及数量 ContractCode = contractCode; VarietyModel vm = null; string[] values = 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; lend = vm.precision; if (pricetype == "市价") { IsTypePrice = Visibility.Visible; IsPrice = Visibility.Collapsed; Price = 0; typePrice = "M"; } else if (pricetype == "对手价") { Price = 0; typePrice = "R"; IsTypePrice = Visibility.Visible; IsPrice = Visibility.Collapsed; } else { Price = price; typePrice = "L"; IsTypePrice = Visibility.Collapsed; IsPrice = Visibility.Visible; } PriceTypeBill = pricetype; _priceType = pricetype; OrderPrice = price; OrderPrice3 = price; Num = num; //触发的类型 KeyValue kv0 = new KeyValue() { Id = 0, Value = "最新价" }; KeyValue kv1 = new KeyValue() { Id = 1, Value = "买一价" }; KeyValue kv2 = new KeyValue() { Id = 2, Value = "卖一价" }; PriceList.Add(kv0); PriceList.Add(kv1); PriceList.Add(kv2); PriceItem = kv0; KeyValue ttype0 = new KeyValue() { Id = 0, Value = ">=" }; KeyValue ttype1 = new KeyValue() { Id = 1, Value = "<=" }; TrrigerConditionItem = ttype0; TrrigerCondition.Add(ttype0); TrrigerCondition.Add(ttype1); KeyValue kv03 = new KeyValue() { Id = 0, Value = "最新价" }; KeyValue kv13 = new KeyValue() { Id = 1, Value = "买一价" }; KeyValue kv23 = new KeyValue() { Id = 2, Value = "卖一价" }; PriceList3.Add(kv03); PriceList3.Add(kv13); PriceList3.Add(kv23); PriceItem3 = kv03; KeyValue ttype03 = new KeyValue() { Id = 0, Value = ">=" }; KeyValue ttype13 = new KeyValue() { Id = 1, Value = "<=" }; IsFirst = true; TrrigerCondition3.Add(ttype03); TrrigerCondition3.Add(ttype13); TrrigerConditionItem3 = ttype03; }