private IList <XH_ValidDeclareValue> GetValidDeclareValueByBreedClassValidIDFromWCF(int breedClassValidID)
 {
     try
     {
         using (SpotTradeRulesClient client = GetClient())
             return(client.GetValidDeclareValueByBreedClassValidID(breedClassValidID));
     }
     catch (Exception ex)
     {
         string errCode = "GT-8121";
         string errMsg  = "无法根据涨跌幅验证编码从管理中心获取涨跌幅验证列表。";
         throw new VTException(errCode, errMsg, ex);
     }
 }
 private IList <XH_ValidDeclareType> GetAllValidDeclareTypeFromWCF()
 {
     try
     {
         using (SpotTradeRulesClient client = GetClient())
             return(client.GetAllValidDeclareType());
     }
     catch (Exception ex)
     {
         string errCode = "GT-8119";
         string errMsg  = "无法从管理中心获取涨跌幅类型列表。";
         throw new VTException(errCode, errMsg, ex);
     }
 }
 private XH_ValidDeclareType GetValidDeclareTypeByBreedClassValidIDFromWCF(int id)
 {
     try
     {
         using (SpotTradeRulesClient client = GetClient())
             return(client.GetValidDeclareTypeByBreedClassValidID(id));
     }
     catch (Exception ex)
     {
         string errCode = "GT-8120";
         string errMsg  = "无法根据涨跌幅类型编码从管理中心获取涨跌幅类型。";
         throw new VTException(errCode, errMsg, ex);
     }
 }
 /// <summary>
 /// 获取所有的现货_品种_交易规则
 /// </summary>
 /// <returns></returns>
 private IList <XH_SpotTradeRules> GetAllSpotTradeRulesFromWCF()
 {
     try
     {
         using (SpotTradeRulesClient client = GetClient())
             return(client.GetAllSpotTradeRules());
     }
     catch (Exception ex)
     {
         string errCode = "GT-8112";
         string errMsg  = "无法从管理中心获取现货交易规则列表。";
         throw new VTException(errCode, errMsg, ex);
     }
 }
 private XH_SpotTradeRules GetSpotTradeRulesByBreedClassIDFromWCF(int id)
 {
     try
     {
         using (SpotTradeRulesClient client = GetClient())
             return(client.GetSpotTradeRulesByBreedClassID(id));
     }
     catch (Exception ex)
     {
         string errCode = "GT-8113";
         string errMsg  = "无法从管理中心获取现货交易规则。";
         throw new VTException(errCode, errMsg, ex);
     }
 }
 private XH_SpotHighLowValue GetSpotHighLowByHightLowValueIDFromWCF(int id)
 {
     try
     {
         using (SpotTradeRulesClient client = GetClient())
             return(client.GetSpotHighLowValueByHightLowID(id));
     }
     catch (Exception ex)
     {
         string errCode = "GT-8116";
         string errMsg  = "无法从管理中心获取现货涨跌幅。";
         throw new VTException(errCode, errMsg, ex);
     }
 }
 private IList <XH_SpotHighLowValue> GetSpotHighLowValueByBreedClassHighLowIDFromWCF(int breedClassHighLowID)
 {
     try
     {
         using (SpotTradeRulesClient client = GetClient())
             return(client.GetSpotHighLowValueByBreedClassHighLowID(breedClassHighLowID));
     }
     catch (Exception ex)
     {
         string errCode = "GT-8115";
         string errMsg  = "无法从管理中心获取现货涨跌幅列表。";
         throw new VTException(errCode, errMsg, ex);
     }
 }
 /// <summary>
 /// 根据品种标识返回交易规则_交易方向_交易单位_交易量(最小交易单位)
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 private IList <XH_MinVolumeOfBusiness> GetMinVolumeOfBusinessByBreedClassIDFromWCF(int id)
 {
     try
     {
         using (SpotTradeRulesClient client = GetClient())
             return(client.GetMinVolumeOfBusinessByBreedClassID(id));
     }
     catch (Exception ex)
     {
         string errCode = "GT-8104";
         string errMsg  = "无法根据交易商品品种编码从管理中心获取交易规则最小交易单位列表。";
         throw new VTException(errCode, errMsg, ex);
     }
 }
 /// <summary>
 /// 获取所有的现货_品种_涨跌幅_控制类型
 /// </summary>
 /// <returns></returns>
 private IList <XH_SpotHighLowControlType> GetAllSpotHighLowControlTypeFromWCF()
 {
     try
     {
         using (SpotTradeRulesClient client = GetClient())
             return(client.GetAllSpotHighLowControlType());
     }
     catch (Exception ex)
     {
         string errCode = "GT-8107";
         string errMsg  = "无法从管理中心获取现货品种涨跌幅控制类型列表。";
         throw new VTException(errCode, errMsg, ex);
     }
 }
 /// <summary>
 /// 获取所有的交易规则_交易方向_交易单位_交易量(最小交易单位)
 /// </summary>
 /// <returns></returns>
 private IList <XH_MinVolumeOfBusiness> GetAllMinVolumeOfBusinessFromWCF()
 {
     try
     {
         using (SpotTradeRulesClient client = GetClient())
             return(client.GetAllMinVolumeOfBusiness());
     }
     catch (Exception ex)
     {
         string errCode = "GT-8103";
         string errMsg  = "无法从管理中心获取交易规则最小交易单位列表。";
         throw new VTException(errCode, errMsg, ex);
     }
 }
        /// <summary>
        /// 获取现货交易规则
        /// </summary>
        /// <returns></returns>
        public static SpotTradeRulesClient GetSpotTradeRulesClient()
        {
            SpotTradeRulesClient client = null;

            try
            {
                client = new SpotTradeRulesClient();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(client);
        }
 /// <summary>
 /// 获取现货的所有涨跌幅值
 /// </summary>
 /// <returns></returns>
 protected List <XH_SpotHighLowValue> GetAllSpotHighLowValue()
 {
     try
     {
         using (SpotTradeRulesClient client = ManagementCenterDataAgent.Instanse.GetSpotTradeRulesInstanse())
         {
             return(client.GetAllSpotHighLowValue());
         }
     }
     catch (Exception ex)
     {
         LogHelper.WriteError(GenerateInfo.CH_E006, ex);
         return(null);
     }
 }
        private SpotTradeRulesClient GetClient()
        {
            SpotTradeRulesClient client;

            try
            {
                client = new SpotTradeRulesClient();
            }
            catch (Exception ex)
            {
                string errCode = "GT-8100";
                string errMsg  = "无法获取管理中心提供的服务[IStockTradeRules]。";
                throw new VTException(errCode, errMsg, ex);
            }

            return(client);
        }
        /// <summary>
        /// 获取所有的现货代码
        /// </summary>
        public static void GetAllCM_Commodity()
        {
            list.Clear();
            spotList.Clear();
            int[] breeid = { 7, 8, 21, 22 };
            using (CommonParaClient client = GetCommonParaClient())
            {
                foreach (var k in breeid)
                {
                    List <CM_Commodity> item = new List <CM_Commodity>();
                    item = client.GetCommodityByBreedClassID(k);

                    list.AddRange(item);
                }
            }
            using (SpotTradeRulesClient client = GetSpotTradeRulesClient())
            {
                spotList = client.GetAllSpotCosts();
            }
        }
Exemple #15
0
        /// <summary>
        /// 获取与管理中心现货交易规则连接客户端对象
        /// </summary>
        /// <returns></returns>
        public SpotTradeRulesClient GetSpotTradeRulesInstanse()
        {
            SpotTradeRulesClient tradeRuleClient = new SpotTradeRulesClient();

            return(tradeRuleClient);

            #region oldcode
            //get
            //{
            //    if (tradeRuleClient == null)
            //    {
            //        string strAddress = AppConfig.GetConfigManageCenterIP();
            //        string port = AppConfig.GetConfigManagePort().ToString();
            //        EndpointAddress orderAddress =
            //        new EndpointAddress("net.tcp://" + strAddress + ":" + port + "/WcfSpotTradingRulesProvider");
            //        tradeRuleClient = new SpotTradeRulesClient("NetTcpBinding_ISpotTradeRules", orderAddress);

            //    }
            //    return tradeRuleClient;

            //}
            #endregion
        }