/// <summary>
 ///
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 private HK_SpotTradeRules GetSpotTradeRulesByBreedClassIDFromWCF(int id)
 {
     try
     {
         using (HKTradeRulesClient client = GetClient())
             return(client.GetHKSpotTradeRulesByBreedClassID(id));
     }
     catch (Exception ex)
     {
         string errCode = "GT-8113";
         string errMsg  = "无法从管理中心获取港股交易规则。";
         throw new VTException(errCode, errMsg, ex);
     }
 }
 /// <summary>
 /// 获取所有的港股_最小价格变动范围值
 /// </summary>
 /// <returns></returns>
 private IList <HK_MinPriceFieldRange> GetAllHKMinPriceFieldRangeFromWCF()
 {
     try
     {
         using (HKTradeRulesClient client = GetClient())
             return(client.GetAllHKMinPriceFieldRange());
     }
     catch (Exception ex)
     {
         string errCode = "GT-8112";
         string errMsg  = "无法从管理中心获取港股最小价格变动范围值。";
         throw new VTException(errCode, errMsg, ex);
     }
 }
 private HK_Commodity GetHKCommodityByCommodityCodeFromWCF(string code)
 {
     try
     {
         using (HKTradeRulesClient client = GetClient())
             return(client.GetHKCommodityByHKCommodityCode(code));
     }
     catch (Exception ex)
     {
         string errCode = "GT-8004";
         string errMsg  = "无法根据港股商品代码从管理中心获取指定港股商品。";
         throw new VTException(errCode, errMsg, ex);
     }
 }
 /// <summary>
 /// 获取所有的港股_品种_交易规则
 /// </summary>
 /// <returns></returns>
 private IList <HK_SpotTradeRules> GetAllSpotTradeRulesFromWCF()
 {
     try
     {
         using (HKTradeRulesClient client = GetClient())
             return(client.GetAllHKSpotTradeRules());
     }
     catch (Exception ex)
     {
         string errCode = "GT-8112";
         string errMsg  = "无法从管理中心获取港股交易规则列表。";
         throw new VTException(errCode, errMsg, ex);
     }
 }
        /// <summary>
        /// 获取港股交易规则
        /// </summary>
        /// <returns></returns>
        public static HKTradeRulesClient GetHKTradeRulesClient()
        {
            HKTradeRulesClient hkTradeRulesClient = null;

            try
            {
                hkTradeRulesClient = new HKTradeRulesClient();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(hkTradeRulesClient);
        }
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 private IList <HK_Commodity> GetAllHKCommodityFromWCF()
 {
     try
     {
         using (HKTradeRulesClient client = GetClient())
         {
             return(client.GetAllHKCommodity());
         }
     }
     catch (Exception ex)
     {
         string errCode = "GT-8003";
         string errMsg  = "无法从管理中心获取所有港股商品列表。";
         throw new VTException(errCode, errMsg, ex);
     }
 }
 /// <summary>
 /// 获取港股交易规则
 /// </summary>
 /// <returns></returns>
 protected List <HK_SpotTradeRules> GetHKSpotTradeRules()
 {
     try
     {
         using (HKTradeRulesClient client = ManagementCenterDataAgent.Instanse.GetHKTradeRulesInstance())
         {
             //List<HK_SpotTradeRules> r = client.GetAllHKSpotTradeRules();
             return(client.GetAllHKSpotTradeRules());
         }
     }
     catch (Exception ex)
     {
         LogHelper.WriteError(GenerateInfo.CH_E006, ex);
         return(null);
     }
 }
 /// <summary>
 /// 25.获取港股交易规则_最小变动价位_范围_值
 /// </summary>
 /// <returns></returns>
 protected List <HK_MinPriceFieldRange> GetHKMinChangePriceFieldRange()
 {
     try
     {
         using (HKTradeRulesClient client = ManagementCenterDataAgent.Instanse.GetHKTradeRulesInstance())
         {
             //List<HK_MinPriceFieldRange> ranges = client.GetAllHKMinPriceFieldRange();
             return(client.GetAllHKMinPriceFieldRange());
         }
     }
     catch (Exception ex)
     {
         LogHelper.WriteError(GenerateInfo.CH_E006, ex);
         return(null);
     }
 }
        private HKTradeRulesClient GetClient()
        {
            HKTradeRulesClient client;

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

            return(client);
        }
 /// <summary>
 /// 获取所有的港股代码
 /// </summary>
 public static void GetAllHKCommodity()
 {
     hKCommodityList.Clear();
     hKCommodityList.Clear();
     //int[] breeid = { 44 };
     //int breeid = 44;//港股品种ID
     using (HKTradeRulesClient client = GetHKTradeRulesClient())
     {
         List <HK_Commodity> item = new List <HK_Commodity>();
         item = client.GetAllHKCommodity();
         hKCommodityList.AddRange(item);
     }
     using (HKTradeRulesClient client = GetHKTradeRulesClient())
     {
         hKSpotCostsList = client.GetAllHKSpotCosts();
     }
 }
예제 #11
0
        /// <summary>
        /// 获取与管理中心港股交易规则连接客户端对象
        /// </summary>
        /// <returns></returns>
        public HKTradeRulesClient GetHKTradeRulesInstance()
        {
            HKTradeRulesClient tradeRuleClient = new HKTradeRulesClient();

            return(tradeRuleClient);
        }