private bool CheckValid() { if (string.IsNullOrEmpty(txtNewPrice.Text)) { string msg = "Please input a new price!"; MessageBox.Show(msg); return(false); } if (string.IsNullOrEmpty(txtNewAmount.Text)) { string msg = "Please input a new amount!"; MessageBox.Show(msg); return(false); } float price = 0; bool canParsePrice = float.TryParse(txtNewPrice.Text, out price); if (!canParsePrice) { string msg = "Please input a valid price!"; MessageBox.Show(msg); return(false); } ModifyPrice = price; float amount = 0; bool canParseAmount = float.TryParse(txtNewAmount.Text, out amount); if (!canParseAmount) { string msg = "Please input a valid amount!"; MessageBox.Show(msg); return(false); } ModifyAmount = amount; modifyUnitType = Utils.GetUnit(cbHKUnit.Text.Trim()); return(true); }
/// <summary> /// 获取现货交易费用 /// </summary> /// <param name="code">商品代码</param> /// <param name="price">委托价格</param> /// <param name="amount">委托数量</param> /// <param name="unitType">委托单位类型</param> /// <param name="buySell">买卖方向</param> /// <returns>现货交易费用结果</returns> public static XHCostResult ComputeXHCost(string code, float price, int amount, Types.UnitType unitType, Types.TransactionDirection buySell) { StockOrderRequest request = new StockOrderRequest(); request.Code = code; request.OrderPrice = price; request.OrderAmount = amount; request.OrderUnitType = unitType; request.BuySell = buySell; return(ComputeXHCost(request)); }
/// <summary> /// 获取股指期货交易费用 /// </summary> /// <param name="code">商品代码</param> /// <param name="price">委托价格</param> /// <param name="amount">委托数量</param> /// <param name="unitType">委托单位类型</param> /// <param name="openCloseType">开平仓方向</param> /// <returns>股指期货交易费用结果</returns> public static QHCostResult ComputeGZQHCost(string code, float price, int amount, Types.UnitType unitType, Entity.Contants.Types.FutureOpenCloseType openCloseType) { StockIndexFuturesOrderRequest request = new StockIndexFuturesOrderRequest(); request.Code = code; request.OrderPrice = price; request.OrderAmount = amount; request.OrderUnitType = unitType; request.OpenCloseType = openCloseType; return(ComputeGZQHCost(request)); }