Home
Products
Forums
Help
Publish Article
HTMLParser.Net
 
YFinanceParser.Net - How to sample code snippets

Following are code snippets the demonstrate usage of YFinanceParser.Net library.


Adding reference to parser assemblies

After you create .Net project that consumes HTMLParser.Net and/or YFinanceParser.Net libraries, please add reference to following assemblies in your project.

  • HTMLParserPro2.dll
  • YFinanceParser.dll (only if you are using YFinanceParser.Net)

In the code behind page you can add the following using statements for various namespaces that are used in HTMLParser.Net and YFinanceParser.Net libraries.

using Winista.Text.HtmlParser.Lex;
using Winista.Text.HtmlParser;
using Winista.Text.HtmlParser.Util;
using Winista.Text.HtmlParser.Extractors;
using Winista.Text.HtmlParser.Data;
using Winista.Text.HtmlParser.Filters;
using Winista.Text.HtmlParser.Tags;
using Winista.Text.HtmlParser.Http;
using Winista.Text.HtmlParser.Nodes;

using Winista.YahooFinanceParser;							
							

How to get list of nost active stocks?

void ExtractYahooFinancialsMostActive()
{
 String strExchange = "NASDAQ";
 StockExchangeType exType = StockExchangeType.NASDAQ;
 switch (strExchange)
 {
     case "AMEX":
         exType = StockExchangeType.AMEX;
         break;
     case "NYSE":
         exType = StockExchangeType.NYSE;
         break;
     case "NASDAQ":
     default:
         exType = StockExchangeType.NASDAQ;
         break;
 }

 YahooSiteParser yahooParser = new YahooSiteParser(this.Server.MapPath("~/Bin"));

 System.Data.DataTable activeStocksTable = yahooParser.GetMostActiveStocks(exType);
}							
							

How to extract company profile data for a given ticker symbol?

CompanyProfile GetYahooFinanceCompanyProfile(String strSymbol)
{
 YahooSiteParser yahooParser = new YahooSiteParser(this.Server.MapPath("~/Bin"));
 CompanyProfile _companyProfile = yahooParser.GetCompanyProfile(strSymbol);
 return _companyProfile;
}							
							

How to get stock price data for a given ticker symbol?

private StockQuote GetYahooFinanceStockQuote(String strSymbol)
{
 YahooSiteParser yahooParser = new YahooSiteParser(this.Server.MapPath("~/Bin"));
  StockQuote quote = yahooParser.GetStockQuote(strSymbol);
  return quote;
}							
							
Go Freelance
Home     About us     Contact us    Copyright    Privacy Policy    Return Policy    Advertisers
Copyright © Netomatix