コード例 #1
0
 public void Add(string investmentID, SecurityItem secuItem)
 {
     _quote.AddSecurity(investmentID, secuItem);
 }
コード例 #2
0
        private void AddSecurity(TDFCode[] codeArr)
        {
            for (int i = 0; i < codeArr.Length; i++)
            {
                if (codeArr[i].Type >= 0x10 && codeArr[i].Type <= 0x16)
                {
                    //股票代码
                    //TDFOptionCode code = new TDFOptionCode();
                    //var ret = _tdfImp.GetOptionCodeInfo(codeArr[i].WindCode, ref code);
                    SecurityItem securityItem = new SecurityItem();
                    securityItem.SecuCode = codeArr[i].Code;
                    securityItem.SecuName = codeArr[i].CNName;
                    securityItem.SecuType = SecurityType.Stock;

                    //if (codeArr[i].WindCode.Equals("002109.SZ", StringComparison.InvariantCultureIgnoreCase))
                    //{
                    //    Console.WriteLine(codeArr[i].WindCode);
                    //}

                    if (codeArr[i].Market.Equals("SZ", System.StringComparison.InvariantCultureIgnoreCase))
                    {
                        securityItem.ExchangeCode = Exchange.SZSE;
                    }
                    else if (codeArr[i].Market.Equals("SH", System.StringComparison.InvariantCultureIgnoreCase))
                    {
                        securityItem.ExchangeCode = Exchange.SHSE;
                    }
                    else
                    {
                        //Fail;
                    }

                    _quote.AddSecurity(codeArr[i].WindCode, securityItem);
                }
                else if (codeArr[i].Type == 0x70)
                {
                    //股指期货
                    SecurityItem securityItem = new SecurityItem();
                    securityItem.SecuCode     = codeArr[i].Code;
                    securityItem.SecuName     = codeArr[i].CNName;
                    securityItem.SecuType     = SecurityType.Futures;
                    securityItem.ExchangeCode = Exchange.CFFEX;
                    _quote.AddSecurity(codeArr[i].WindCode, securityItem);
                }
                else if (codeArr[i].Type == 0x01)
                {
                    //指数
                    SecurityItem securityItem = new SecurityItem();
                    securityItem.SecuCode = CodeHelper.GetIndexSecuCode(codeArr[i].Code);
                    securityItem.SecuName = codeArr[i].CNName;
                    securityItem.SecuType = SecurityType.Index;

                    if (codeArr[i].Market.Equals("SZ", System.StringComparison.InvariantCultureIgnoreCase))
                    {
                        securityItem.ExchangeCode = Exchange.SZSE;
                    }
                    else if (codeArr[i].Market.Equals("SH", System.StringComparison.InvariantCultureIgnoreCase))
                    {
                        securityItem.ExchangeCode = Exchange.SHSE;
                    }
                    else
                    {
                        //Fail;
                    }

                    _quote.AddSecurity(codeArr[i].WindCode, securityItem);
                }
                else
                {
                    //do nothing
                }
            }
        }