Beispiel #1
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("");
            }
        }
Beispiel #2
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("");
            }
        }
        public void RetrieveYahooCompanyInfo(string symbol, ref Dictionary<string, Object> stats)
        {
            CompanyInfoDownload d1 = new CompanyInfoDownload();
            DownloadClient<CompanyInfoResult> baseD1 = d1;

            CompanyInfoDownloadSettings settings = d1.Settings;
            settings.IDs = new string[] { symbol };

            Response<CompanyInfoResult> resp = baseD1.Download();
            SettingsBase baseSettings = baseD1.Settings;

            ConnectionInfo connInfo = resp.Connection;
            if (connInfo.State == ConnectionState.Success)
            {
                CompanyInfoResult result = resp.Result;
                
                stats.Add("Sector", result.Items[0].SectorName);
                stats.Add("Industry", result.Items[0].IndustryName);
            }
            else
            {
                Exception ex = connInfo.Exception;
                Console.WriteLine(ex.Message);
            }

            QuotesDownload d2 = new QuotesDownload();
            DownloadClient<QuotesResult> baseD2 = d2;

            QuotesDownloadSettings settings1 = d2.Settings;
            settings1.IDs = new string[] { symbol };
            settings1.Properties = new QuoteProperty[] {
                QuoteProperty.Symbol,
                QuoteProperty.Name
           };

            Response<QuotesResult> resp1 = baseD2.Download();
            SettingsBase baseSettings1 = baseD2.Settings;

            ConnectionInfo connInfo1 = resp1.Connection;
            if (connInfo1.State == ConnectionState.Success)
            {
                QuotesResult result = resp1.Result;
                stats.Add("Name", Convert.ToString(result.Items[0].Name));
            }
            else
            {
                Exception ex = connInfo.Exception;
                Console.WriteLine(ex.Message);
            }
        }