コード例 #1
0
 /// <summary>
 /// /// 计算风险率
 /// 风险率公式改为:(账户结余+除本单外所有单子的盈亏+本单浮动盈亏-账户冻结资金)/(每个用户所有保证金+每个用户所有预付款)
 /// 等效于:(账户余额-账户冻结资金+用户所有单子盈亏)/(用户所有的保证金+用户所有的预付款)
 /// </summary>
 /// <param name="lp">浮动盈亏</param>
 private string CacuRiskCoefficient(double lp)
 {
     if ((OccupiedDeposit + FrozenMoney) <= 0.000001)
     {
         return("0");
     }
     else
     {
         return(DataDigitFilter.FilterDouble((Money - DongJieMoney + ProfitValue + LossOrProfit) / (AlloccMoney + FrozenMoney) * 100, 2).ToString());
     }
 }
コード例 #2
0
        /// <summary>
        /// 为市价单定单信息赋值
        /// </summary>
        /// <param name="type">定单类型,买跌或买涨</param>
        private void AssignmentOrderInfo(TRANSACTION_TYPE type)
        {
            ProductInformation selectedPt = SelectedProduct;

            _newOrderInfo.AllowMaxPriceDeviation = (CbDeviation.IsChecked == true ? AllowMaxPriceDiff : 0);
            _newOrderInfo.Count               = Count;
            _newOrderInfo.MAC                 = MacAddress.LocalMAC;
            _newOrderInfo.OrderType           = type;
            _newOrderInfo.PercentageOfDeposit = selectedPt.PercentageOfDeposit;
            _newOrderInfo.ProductCode         = selectedPt.ProductCode;
            _newOrderInfo.RealTimeTime        = selectedPt.RealTimeTime;
            _newOrderInfo.RealTimePrice       = (type == TRANSACTION_TYPE.Order ? selectedPt.OrderPrice : selectedPt.RecoveryPrice);
            _newOrderInfo.StopLossPrice       = (EnableStopLoss ? DataDigitFilter.FilterDouble(StopLoss, selectedPt.SpreadDigit) : 0);
            _newOrderInfo.StopProfitPrice     = (EnableStopProfit ? DataDigitFilter.FilterDouble(StopProfit, selectedPt.SpreadDigit) : 0);
        }
コード例 #3
0
        /// <summary>
        /// Assignment pending order information.
        /// </summary>
        /// <param name="type">transaction type</param>
        private void AssignmentOrderInfo(TRANSACTION_TYPE type)
        {
            ProductInformation selectedData = SelectedProduct;

            _newOrderInfo.Count               = Count;
            _newOrderInfo.DueDate             = DueDate;
            _newOrderInfo.MAC                 = MacAddress.LocalMAC;
            _newOrderInfo.OrderType           = type;
            _newOrderInfo.PendingOrdersPrice  = PendingOrderPrice;
            _newOrderInfo.PercentageOfDeposit = selectedData.PercentageOfDeposit;
            _newOrderInfo.ProductCode         = selectedData.ProductCode;
            _newOrderInfo.RealTimeTime        = selectedData.RealTimeTime;
            _newOrderInfo.RealTimePrice       = (type == TRANSACTION_TYPE.Order ? selectedData.OrderPrice : selectedData.RecoveryPrice);
            _newOrderInfo.StopLossPrice       = (EnableStopLoss ? DataDigitFilter.FilterDouble(StopLoss, selectedData.SpreadDigit) : 0);
            _newOrderInfo.StopProfitPrice     = (EnableStopProfit ? DataDigitFilter.FilterDouble(StopProfit, selectedData.SpreadDigit) : 0);
        }
コード例 #4
0
 /// <summary>
 /// 计算风险率
 /// 风险率公式改为:(账户结余-冻结资金+浮动盈亏)/(保证金+预付款)
 /// </summary>
 /// <returns></returns>
 private double CalcRiskCodfficient()
 {
     //if(NetAssets==0)
     //{
     //    return 0;
     //}
     //else
     //{
     //    double d = DataDigitFilter.FilterDouble((OccupiedDeposit + FrozenDeposit) / NetAssets, 4);
     //    return d;
     //}
     if ((OccupiedDeposit + FrozenDeposit) <= 0.000001)
     {
         return(0);
     }
     else
     {
         double d = DataDigitFilter.FilterDouble((AccountBalance - DongJieMoney + LossOrProfit) / (OccupiedDeposit + FrozenDeposit), 4);
         return(d);
     }
 }