示例#1
0
        /// <summary>
        /// 查询所有产品信息。
        /// </summary>
        /// <returns>产品信息。</returns>
        public override List <USeProductDetail> QueryProductDetails()
        {
            List <USeProductDetail> list      = new List <USeProductDetail>();
            USeProductDetail        cuProduct = new USeProductDetail()
            {
                ProductCode    = "cu",
                ShortName      = "铜",
                LongName       = "铜",
                Market         = USeMarket.SHFE,
                ProductClass   = USeProductClass.Futures,
                VolumeMultiple = 5,
                PriceTick      = 10,
            };

            list.Add(cuProduct);

            USeProductDetail alProduct = new USeProductDetail()
            {
                ProductCode    = "al",
                ShortName      = "铝",
                LongName       = "铝",
                Market         = USeMarket.SHFE,
                ProductClass   = USeProductClass.Futures,
                VolumeMultiple = 5,
                PriceTick      = 5,
            };

            list.Add(alProduct);

            return(list);
        }
        /// <summary>
        /// 查询产品信息。
        /// </summary>
        /// <param name="productCode">产品代码。</param>
        /// <returns>产品信息。</returns>
        public override USeProduct QueryProduct(string productCode)
        {
            USeProductDetail productDetail = m_dataBuffer.GetProductDetail(productCode);

            if (productDetail != null)
            {
                return(new USeProduct()
                {
                    ProductCode = productDetail.ProductCode,
                    ShortName = productDetail.ShortName,
                    LongName = productDetail.LongName,
                    Market = productDetail.Market,
                    VolumeMultiple = productDetail.VolumeMultiple,
                    PriceTick = productDetail.PriceTick
                });
            }
            else
            {
                return(null);
            }
        }