YahooFinance.NET
YahooFinance.NET allows you to easily download historical end of day stock data and historical dividend data from Yahoo Finance.
Install / Use
/learn @ZacMarcus/YahooFinance.NETREADME
YahooFinance.NET
Download realtime and historical end of day stock data and historical dividend data via the Yahoo Finance API
Install via NUGET
Install-Package YahooFinance.NET
Usage
using YahooFinance.NET;
string cookie = "YOUR_COOKIE";
string crumb = "YOUR_CRUMB";
string exchange = "ASX";
string symbol = "AFI";
YahooFinanceClient yahooFinance = new YahooFinanceClient(cookie, crumb);
string yahooStockCode = yahooFinance.GetYahooStockCode(exchange, symbol);
List<YahooHistoricalPriceData> yahooPriceHistory = yahooFinance.GetDailyHistoricalPriceData(yahooStockCode);
List<YahooHistoricalDividendData> yahooDividendHistory = yahooFinance.GetHistoricalDividendData(yahooStockCode);
YahooRealTimeData yahooRealTimeData = yahooFinance.GetRealTimeData(yahooStockCode);
To get a cookie/crumb
To get a cookie manually
- Go to the Yahoo finance URL and search for a stock. eg. https://finance.yahoo.com/quote/AFI.AX/history?p=AFI.AX
- In Chrome open Settings > Show advanced settings... > Privacy > Content Settings... > All cookies and site data...
- Find the site yahoo.com and the cookie name sould be 'B'
- Copy the 'Content'
- This is your cookie
To get a crumb manually
- Go to the Yahoo finance URL and search for a stock. eg. https://finance.yahoo.com/quote/AFI.AX/history?p=AFI.AX
- Right click on 'Download Data' and copy the link address
- Paste the link somewhere and your crumb will be at the and after the &crumb= eg. https://query1.finance.yahoo.com/v7/finance/download/AFI.AX?period1=1493432127&period2=1496024127&interval=1d&events=history&crumb=YOURCRUMB
Building and testing the project via commandline
- Open up a Powershell prompt and execute
PS> .\build.ps1
Deploying the package to NuGet
- Set the NuGet API key via the commandline if its not already set
nuget.exe setApiKey <API-Key> -Source https://www.nuget.org/api/v2/package
- Increment the AssemblyVersion in AssemblyInfo.cs of the YahooFinance.NET project
- Open up a Powershell prompt and execute
PS> .\build.ps1 -Target Deploy
Related Skills
valuecell
10.2kValueCell is a community-driven, multi-agent platform for financial applications.
beanquery-mcp
43Beancount MCP Server is an experimental implementation that utilizes the Model Context Protocol (MCP) to enable AI assistants to query and analyze Beancount ledger files using Beancount Query Language (BQL) and the beanquery tool.
REFERENCE
An intelligent middleware layer between crypto wallets and traditional payment systems.
mcp-yfinance-server
49Real-time stock API with Python, MCP server example, yfinance stock analysis dashboard
