示例#1
0
文件: Program.cs 项目: Teness/Stock
        static void Main(string[] args)
        {
            AlphabeticIDIndexDownload dl1 = new AlphabeticIDIndexDownload();
            dl1.Settings.TopIndex = null;
            Response<AlphabeticIDIndexResult> resp1 = dl1.Download();

            var writeStream = new StreamWriter("symbols.txt");
            writeStream.WriteLine("Id|Isin|Name|Exchange|Type|Industry");

            foreach (var alphabeticalIndex in resp1.Result.Items)
            {
                AlphabeticalTopIndex topIndex = (AlphabeticalTopIndex)alphabeticalIndex;
                dl1.Settings.TopIndex = topIndex;
                Response<AlphabeticIDIndexResult> resp2 = dl1.Download();

                foreach (var index in resp2.Result.Items)
                {
                    IDSearchDownload dl2 = new IDSearchDownload();
                    Response<IDSearchResult> resp3 = dl2.Download(index);

                    int i = 0;
                    foreach (var item in resp3.Result.Items)
                    {
                        writeStream.WriteLine(item.ID + "|" + item.ISIN + "|" + item.Name + "|" + item.Exchange + "|" + item.Type + "|" + item.Industry);
                    }

                }
            }
        }
示例#2
0
        static void GetStockByExchangeUseSearch()
        {
            foreach (MaasOne.Finance.YahooFinance.Support.StockExchange ex in MaasOne.Finance.YahooFinance.Support.WorldMarket.DefaultStockExchanges)
            {
                MaasOne.Finance.YahooFinance.IDSearchDownload sd = new MaasOne.Finance.YahooFinance.IDSearchDownload();
                if (string.IsNullOrEmpty(ex.Suffix))
                    continue;

                int iIndex = 0;
                while (true)
                {
                    MaasOne.Finance.YahooFinance.IDQuerySearchDownloadSettings ss = new MaasOne.Finance.YahooFinance.IDQuerySearchDownloadSettings();
                    ss.Query = ex.Suffix;
                    ss.Type = SecurityType.Stock;
                    ss.ResultsIndex = 1020;
                    Response<MaasOne.Finance.YahooFinance.IDSearchResult> sr = sd.Download(ss);

                    foreach (IDSearchData sdd in sr.Result.Items)
                    {
                        Console.WriteLine(sdd.ID + "\t" + sdd.Name);
                    }

                    if (sr.Result.Items.Length < 1)
                        break;

                    iIndex += sr.Result.Items.Length;

                    Console.WriteLine("new index:" + iIndex);
                }

                Console.WriteLine("");
            }
        }
        public string Search(string value)
        {
            var dl = new IDSearchDownload();

            var resp = dl.Download(value);

            //Response/Result
            if (resp.Connection.State == ConnectionState.Success)
            {
                foreach (var res in resp.Result.Items)
                {
                    string id = res.ID;
                    string name = res.Name;
                    var type = res.Type;
                    string exchange = res.Exchange;

                }
            }

            return "???";
        }
示例#4
0
        static void GetStockByExchange()
        {
            AlphabeticIDIndexDownload dl1 = new AlphabeticIDIndexDownload();
            dl1.Settings.TopIndex = null;
            Response<AlphabeticIDIndexResult> resp1 = dl1.Download();

            Console.WriteLine("Id|Isin|Name|Exchange|Type|Industry");

            foreach (var alphabeticalIndex in resp1.Result.Items)
            {
                AlphabeticalTopIndex topIndex = (AlphabeticalTopIndex)alphabeticalIndex;
                dl1.Settings.TopIndex = topIndex;
                Response<AlphabeticIDIndexResult> resp2 = dl1.Download();

                foreach (var index in resp2.Result.Items)
                {
                    IDSearchDownload dl2 = new IDSearchDownload();
                    Response<IDSearchResult> resp3 = dl2.Download(index);


                    int i = 0;
                    foreach (var item in resp3.Result.Items)
                    {
                        Console.WriteLine(item.ID + "|" + item.ISIN + "|" + item.Name + "|" + item.Exchange + "|" + item.Type + "|" + item.Industry);
                    }

                }
            }
            return;
            foreach (MaasOne.Finance.YahooFinance.Support.StockExchange ex in MaasOne.Finance.YahooFinance.Support.WorldMarket.DefaultStockExchanges)
            {
                MaasOne.Finance.YahooFinance.CompanyInfoDownloadSettings cs = new MaasOne.Finance.YahooFinance.CompanyInfoDownloadSettings();
                MaasOne.Finance.YahooFinance.CompanyInfoDownload cd = new MaasOne.Finance.YahooFinance.CompanyInfoDownload();
                cd.Download("yhoo");

                Console.WriteLine("");
            }
        }
示例#5
0
        static void GetStockByExchangeUseSearch()
        {
            foreach (MaasOne.Finance.YahooFinance.Support.StockExchange ex in MaasOne.Finance.YahooFinance.Support.WorldMarket.DefaultStockExchanges)
            {
                MaasOne.Finance.YahooFinance.IDSearchDownload sd = new MaasOne.Finance.YahooFinance.IDSearchDownload();
                if (string.IsNullOrEmpty(ex.Suffix))
                {
                    continue;
                }

                int iIndex = 0;
                while (true)
                {
                    MaasOne.Finance.YahooFinance.IDQuerySearchDownloadSettings ss = new MaasOne.Finance.YahooFinance.IDQuerySearchDownloadSettings();
                    ss.Query        = ex.Suffix;
                    ss.Type         = SecurityType.Stock;
                    ss.ResultsIndex = 1020;
                    Response <MaasOne.Finance.YahooFinance.IDSearchResult> sr = sd.Download(ss);

                    foreach (IDSearchData sdd in sr.Result.Items)
                    {
                        Console.WriteLine(sdd.ID + "\t" + sdd.Name);
                    }

                    if (sr.Result.Items.Length < 1)
                    {
                        break;
                    }

                    iIndex += sr.Result.Items.Length;

                    Console.WriteLine("new index:" + iIndex);
                }

                Console.WriteLine("");
            }
        }