/// <summary> /// 构建港股成交回报 /// </summary> /// <param name="tet"></param> /// <param name="sdbe"></param> /// <param name="xhcr"></param> /// <param name="dealCapital"></param> /// <param name="tm"></param> /// <returns></returns> public static HK_TodayTradeInfo BuildHKDealRpt(HK_TodayEntrustInfo tet, HKDealBackEntity sdbe, HKCostResult xhcr, decimal dealCapital, ReckoningTransaction tm) { string result = string.Empty; //成交回报实体 var hkDealRpt = new HK_TodayTradeInfo(); //xhDealrpt.TradeNumber = this.BuildXHDealOrderNo(); hkDealRpt.TradeNumber = sdbe.ID; //不再自己构建id,使用成交回报的id,一一对应 //成交时间 hkDealRpt.TradeTime = sdbe.DealTime; //成交价 hkDealRpt.TradePrice = sdbe.DealPrice; //成交单位 hkDealRpt.TradeUnitId = tet.TradeUnitID; //成交量 hkDealRpt.TradeAmount = Convert.ToInt32(sdbe.DealAmount); //股东代码 hkDealRpt.HoldAccount = tet.HoldAccount; //资金帐户 hkDealRpt.CapitalAccount = tet.CapitalAccount; //成交回报类型 hkDealRpt.TradeTypeId = (int)Types.DealRptType.DRTDealed; //现货名称 hkDealRpt.Code = tet.Code; //印花税 hkDealRpt.StampTax = xhcr.StampDuty; //佣金 hkDealRpt.Commission = xhcr.Commision; //过户费 hkDealRpt.TransferAccountFee = xhcr.TransferToll; //交易系统使用费 hkDealRpt.TradingSystemUseFee = xhcr.TradeSystemFees; //交易手续费用(只有港股才有) hkDealRpt.TradeProceduresFee = xhcr.PoundageSingleValue; //监管费 hkDealRpt.MonitoringFee = xhcr.MonitoringFee; //结算费 hkDealRpt.ClearingFee = xhcr.ClearingFees; //委托价格 hkDealRpt.EntrustPrice = tet.EntrustPrice; //成交金额 hkDealRpt.TradeCapitalAmount = dealCapital; // xhDealrpt.TradePrice*xhDealrpt.TradeAmount;//TODO:是否正确?没有算比例 //投组标识 hkDealRpt.PortfolioLogo = tet.PortfolioLogo; //货币类型 hkDealRpt.CurrencyTypeId = tet.CurrencyTypeID; //买卖方向 hkDealRpt.BuySellTypeId = tet.BuySellTypeID; hkDealRpt.EntrustNumber = tet.EntrustNumber; HK_TodayTradeDal hkTodayTradeDal = new HK_TodayTradeDal(); if (hkTodayTradeDal.Exists(hkDealRpt.TradeNumber)) { string format = "BuildHKDealRpt数据库已经存在TradeNumber={0}"; string desc = string.Format(format, hkDealRpt.TradeNumber); LogHelper.WriteDebug(desc); //xhDealrpt = xhTodayTradeTableDal.GetModel(xhDealrpt.TradeNumber); return(null); } try { hkTodayTradeDal.Add(hkDealRpt, tm); } catch (Exception ex) { LogHelper.WriteError(ex.Message, ex); hkDealRpt = null; } return(hkDealRpt); }
/// <summary> /// 构建港股撤单成交回报 /// </summary> /// <param name="tet"></param> /// <param name="rde"></param> /// <param name="tm"></param> /// <param name="trade"></param> /// <param name="isInternalCancel"></param> /// <returns></returns> public static string BuildHKCancelRpt(HK_TodayEntrustInfo tet, CancelOrderEntity rde, ReckoningTransaction tm, out HK_TodayTradeInfo trade, bool isInternalCancel) { string result = string.Empty; //当为价格错误的撤单时,直接作为废单,不记录到数据库中。 if (rde.OrderVolume == -1) { trade = null; return(result); } //成交回报实体 var hkDealrpt = new HK_TodayTradeInfo(); //xhDealrpt.TradeNumber = this.BuildXHDealOrderNo(); hkDealrpt.TradeNumber = rde.Id; //不再自己构建id,使用撤单回报的id,一一对应 //成交时间 hkDealrpt.TradeTime = DateTime.Now; //成交价 hkDealrpt.TradePrice = 0; //成交单位 hkDealrpt.TradeUnitId = tet.TradeUnitID; //成交量 hkDealrpt.TradeAmount = Convert.ToInt32(rde.OrderVolume); //股东代码 hkDealrpt.HoldAccount = tet.HoldAccount; //资金帐户 hkDealrpt.CapitalAccount = tet.CapitalAccount; //成交回报类型 if (isInternalCancel) { hkDealrpt.TradeTypeId = (int)Types.DealRptType.DRTInternalCanceled; } else { hkDealrpt.TradeTypeId = (int)Types.DealRptType.DRTCanceled; } //现货名称 hkDealrpt.Code = tet.Code; //印花税 hkDealrpt.StampTax = 0; //佣金 hkDealrpt.Commission = 0; //过户费 hkDealrpt.TransferAccountFee = 0; //交易系统使用费 hkDealrpt.TradingSystemUseFee = 0; //监管费 hkDealrpt.MonitoringFee = 0; hkDealrpt.ClearingFee = 0; //委托价格 hkDealrpt.EntrustPrice = tet.EntrustPrice; //成交金额 hkDealrpt.TradeCapitalAmount = hkDealrpt.TradePrice * hkDealrpt.TradeAmount; //投组标识 hkDealrpt.PortfolioLogo = tet.PortfolioLogo; //货币类型 hkDealrpt.CurrencyTypeId = tet.CurrencyTypeID; //买卖方向 hkDealrpt.BuySellTypeId = tet.BuySellTypeID; hkDealrpt.EntrustNumber = tet.EntrustNumber; HK_TodayTradeDal hkTodayTradeDal = new HK_TodayTradeDal(); hkTodayTradeDal.Add(hkDealrpt, tm); result = hkDealrpt.TradeNumber; trade = hkDealrpt; return(result); }