private IList <QH_CFBailScaleValue> GetCFBailScaleValueByBreedClassIDFromWCF(int breedClassID) { { IList <QH_CFBailScaleValue> list = null; try { using (FuturesTradeRulesClient client = GetClient()) { list = client.GetCFBailScaleValueByBreedClassID(breedClassID); try { list = AssemblingFilterCFBail(list); } catch (Exception ex) { string errCode = "GT-8203"; string errMsg = "重新过滤和组装保证金数据异常。"; throw new VTException(errCode, errMsg, ex); } } } catch (Exception ex) { string errCode = "GT-8203"; string errMsg = "无法从管理中心获取所有的商品期货保证金列表。"; throw new VTException(errCode, errMsg, ex); } return(list); } }
private IList <QH_PositionLimitValue> GetPositionLimitValueByBreedClassIDFromWCF(int id) { try { using (FuturesTradeRulesClient client = GetClient()) { IList <QH_PositionLimitValue> list = client.GetPositionLimitValueByBreedClassID(id); List <DateTime> timeList = GetCurrentMothDay(id); foreach (var item in list) { //如果是交易日把它转为自然日存储,后面获取时候就可以直接判断与自然日即可 if (item.PositionBailTypeID == (int)Types.QHPositionBailType.ByTradeDays) { //如果设置的数据有异常则不作转换 if (item.Start.HasValue) { if (item.Start > timeList.Count) { string errCode = "GT-8206"; string errMsg = "商品类别Id=" + id + ":" + "数据设置有异常,持仓开始日期比当前系统月的有效交易日期还大"; throw new VTException(errCode, errMsg, new Exception()); } else { item.Start = timeList[item.Start.Value - 1].Day; //转为当前自然日期 } } if (item.Ends.HasValue) { //如果结束时间比交易日大那边最后一日所有交易日最后一日 if (item.Ends > timeList.Count) { item.Ends = timeList[timeList.Count - 1].Day; //string errCode = "GT-8206"; //string errMsg = "数据设置有异常,持仓结束日期比当前系统月的有效交易日期还大"; //throw new VTException(errCode, errMsg, new Exception()); } else { item.Ends = timeList[item.Ends.Value - 1].Day; //转为当前自然日期 } } } } return(list); } } catch (Exception ex) { GTA.VTS.Common.CommonUtility.LogHelper.WriteError(ex.Message, ex); string errCode = "GT-8206"; string errMsg = "商品类别Id=" + id + ":" + "无法根据商品类别从管理中心获取所有的期货交易持仓限制列表。"; throw new VTException(errCode, errMsg, ex); } }
/// <summary> /// 获取所有期货交易规则的最后交易日所有列表 /// </summary> /// <returns></returns> protected List <QH_LastTradingDay> GetAllLastTradingDay() { try { using (FuturesTradeRulesClient client = ManagementCenterDataAgent.Instanse.GetFutureTradeRulesInstanse()) { return(client.GetAllLastTradingDay()); } } catch (Exception ex) { LogHelper.WriteError(GenerateInfo.CH_E006, ex); return(null); } }
/// <summary> /// 获取所有的期货_品种_交割月份 /// </summary> /// <returns></returns> public IList <QH_CFPositionMonth> GetAllCFPostionMonthFromWCF() { { try { using (FuturesTradeRulesClient client = GetClient()) return(client.GetAllCFPositionMonth()); } catch (Exception ex) { string errCode = "GT-8207"; string errMsg = "无法从管理中心获取所有的期货交割月份列表。"; throw new VTException(errCode, errMsg, ex); } } }
/// <summary> /// 获取所有的期货_持仓限制 /// </summary> /// <returns></returns> private IList <QH_PositionLimitValue> GetAllQHPositionLimitValueFromWCF() { { try { using (FuturesTradeRulesClient client = GetClient()) return(client.GetAllQHPositionLimitValue()); } catch (Exception ex) { string errCode = "GT-8205"; string errMsg = "无法从管理中心获取所有的期货交易持仓限制列表。"; throw new VTException(errCode, errMsg, ex); } } }
/// <summary> /// 获取所有的期货交易保证金限制月份 /// </summary> /// <returns></returns> public IList <QH_PositionBailType> GetAllPositionBailTypeFromWCF() { { try { using (FuturesTradeRulesClient client = GetClient()) return(client.GetAllPositionBailType()); } catch (Exception ex) { string errCode = "GT-8204"; string errMsg = "无法从管理中心获取所有的期货交易保证金限制月份列表。"; throw new VTException(errCode, errMsg, ex); } } }
/// <summary> /// 获取所有的最后交易日类型 /// </summary> /// <returns></returns> private IList <QH_LastTradingDayType> GetAllLastTradingDayTypeFromWCF() { { try { using (FuturesTradeRulesClient client = GetClient()) return(client.GetAllLastTradingDayType()); } catch (Exception ex) { string errCode = "GT-8215"; string errMsg = "无法从管理中心获取所有的最后交易日类型列表。"; throw new VTException(errCode, errMsg, ex); } } }
/// <summary> /// 获取所有的品种_商品期货_保证金比例 /// </summary> /// <returns></returns> private IList <QH_CFBailScaleValue> GetAllCFBailScaleValueFromWCF() { { try { using (FuturesTradeRulesClient client = GetClient()) return(client.GetAllCFBailScaleValue()); } catch (Exception ex) { string errCode = "GT-8203"; string errMsg = "无法从管理中心获取所有的商品期货保证金列表。"; throw new VTException(errCode, errMsg, ex); } } }
/// <summary> /// 获取所有的期货_品种_交易规则 /// </summary> /// <returns></returns> private IList <QH_FuturesTradeRules> GetAllFuturesTradeRulesFromWCF() { { try { using (FuturesTradeRulesClient client = GetClient()) return(client.GetAllFuturesTradeRules()); } catch (Exception ex) { string errCode = "GT-8211"; string errMsg = "无法从管理中心获取所有的期货交易规则列表。"; throw new VTException(errCode, errMsg, ex); } } }
private IList <QH_AgreementDeliveryMonth> GetAllAgreementDeliveryMonthFromWCF() { { try { using (FuturesTradeRulesClient client = GetClient()) return(client.GetALLAgreementDeliveryMonth()); } catch (Exception ex) { string errCode = "GT-8201"; string errMsg = "无法从管理中心获取所有的合约交割月份。"; throw new VTException(errCode, errMsg, ex); } } }
private IList <QH_SingleRequestQuantity> GetSingleRequestQuantityByConsignQuantumIDFromWCF(int id) { { try { using (FuturesTradeRulesClient client = GetClient()) return(client.GetSingleRequestQuantityByConsignQuantumID(id)); } catch (Exception ex) { string errCode = "GT-8220"; string errMsg = "无法根据交易规则委托量标识从管理中心获取所有的单笔委托量列表。"; throw new VTException(errCode, errMsg, ex); } } }
/// <summary> /// 获取所有的单笔委托量 /// </summary> /// <returns></returns> private IList <QH_SingleRequestQuantity> GetAllSingleRequestQuantityFromWCF() { { try { using (FuturesTradeRulesClient client = GetClient()) return(client.GetAllSingleRequestQuantity()); } catch (Exception ex) { string errCode = "GT-8219"; string errMsg = "无法从管理中心获取所有的单笔委托量列表。"; throw new VTException(errCode, errMsg, ex); } } }
/// <summary> /// 获取所有的股指期货持仓限制 /// </summary> /// <returns></returns> private IList <QH_SIFPosition> GetAllSIFPositionFromWCF() { { try { using (FuturesTradeRulesClient client = GetClient()) return(client.GetAllSIFPosition()); } catch (Exception ex) { string errCode = "GT-8218"; string errMsg = "无法从管理中心获取所有的股指期货持仓限制列表。"; throw new VTException(errCode, errMsg, ex); } } }
/// <summary> /// 获取所有的月份 /// </summary> /// <returns></returns> private IList <QH_Month> GetAllMonthFromWCF() { { try { using (FuturesTradeRulesClient client = GetClient()) return(client.GetAllMonth()); } catch (Exception ex) { string errCode = "GT-8216"; string errMsg = "无法从管理中心获取所有的交易月份列表。"; throw new VTException(errCode, errMsg, ex); } } }
/// <summary> /// 获取所有的委托指令类型 /// </summary> /// <returns></returns> private IList <QH_ConsignInstructionType> GetAllConsionInstructionTypeFromWCF() { { try { using (FuturesTradeRulesClient client = GetClient()) return(client.GetAllConsignInstructionType()); } catch (Exception ex) { string errCode = "GT-8208"; string errMsg = "无法从管理中心获取委托指令类型列表。"; throw new VTException(errCode, errMsg, ex); } } }
/// <summary> /// 获取所有的交易规则委托量 /// </summary> /// <returns></returns> public IList <QH_ConsignQuantum> GetAllConsignQuantumFromWCF() { { try { using (FuturesTradeRulesClient client = GetClient()) return(client.GetAllConsignQuantum()); } catch (Exception ex) { string errCode = "GT-8209"; string errMsg = "无法从管理中心获取所有的交易规则委托量列表。"; throw new VTException(errCode, errMsg, ex); } } }
private IList <QH_AgreementDeliveryMonth> GetAgreementDeliveryMonthByBreedClassIDFromWCF(int breedClassID) { { try { using (FuturesTradeRulesClient client = GetClient()) return(client.GetAgreementDeliveryMonthByBreedClassID(breedClassID)); } catch (Exception ex) { string errCode = "GT-8202"; string errMsg = "无法根据商品品种编码从管理中心获取所有的合约交割月份。"; throw new VTException(errCode, errMsg, ex); } } }
/// <summary> /// 获取所有的涨跌停板幅度类型 /// </summary> /// <returns></returns> private IList <QH_HighLowStopScopeType> GetAllHighLowStopScopeTypeFromWCF() { { try { using (FuturesTradeRulesClient client = GetClient()) return(client.GetAllHighLowStopScopeType()); } catch (Exception ex) { string errCode = "GT-8213"; string errMsg = "无法从管理中心获取所有的涨跌停板幅度类型列表。"; throw new VTException(errCode, errMsg, ex); } } }
private FuturesTradeRulesClient GetClient() { FuturesTradeRulesClient client; try { client = new FuturesTradeRulesClient(); } catch (Exception ex) { string errCode = "GT-8200"; string errMsg = "无法获取管理中心提供的服务[IFuturesTradeRules]"; throw new VTException(errCode, errMsg, ex); } return(client); }
/// <summary> /// 获取与管理中心期货交易规则连接客户端对象 /// </summary> /// <returns></returns> public FuturesTradeRulesClient GetFutureTradeRulesInstanse() { FuturesTradeRulesClient futureClient = new FuturesTradeRulesClient(); return(futureClient); #region oldcode //get //{ // if (futureClient == null) // { // string strAddress = AppConfig.GetConfigManageCenterIP(); // string port = AppConfig.GetConfigManagePort().ToString(); // EndpointAddress orderAddress = new EndpointAddress("net.tcp://" + strAddress + ":" + port + "/WcfFuturesProvider"); // futureClient = new FuturesTradeRulesClient("NetTcpBinding_IFuturesTradeRules", // orderAddress); // } // return futureClient; //} #endregion }