All Projects → karlwancl → Yahoofinanceapi

karlwancl / Yahoofinanceapi

Licence: mit
A handy Yahoo! Finance api wrapper, based on .NET Standard 2.0

Projects that are alternatives of or similar to Yahoofinanceapi

Qlib Server
Qlib-Server is the data server system for Qlib. It enable Qlib to run in online mode. Under online mode, the data will be deployed as a shared data service. The data and their cache will be shared by all the clients. The data retrieval performance is expected to be improved due to a higher rate of cache hits. It will consume less disk space, too.
Stars: ✭ 81 (-18.18%)
Mutual labels:  finance, stock
Twstock
台灣股市股票價格擷取 (含即時股票資訊) - Taiwan Stock Opendata with realtime
Stars: ✭ 763 (+670.71%)
Mutual labels:  finance, stock
Grs
📈 台灣上市上櫃股票價格擷取(Fetch Taiwan Stock Exchange data)含即時盤、台灣時間轉換、開休市判斷。
Stars: ✭ 405 (+309.09%)
Mutual labels:  finance, stock
Klinechart
📈Lightweight k-line chart that can be highly customized. Zero dependencies. Support mobile.(可高度自定义的轻量级k线图,无第三方依赖,支持移动端)
Stars: ✭ 303 (+206.06%)
Mutual labels:  finance, stock
Stock2vec
Variational Reccurrent Autoencoder for Embedding stocks to vectors based on the price history
Stars: ✭ 30 (-69.7%)
Mutual labels:  finance, stock
Alpha vantage
A python wrapper for Alpha Vantage API for financial data.
Stars: ✭ 3,553 (+3488.89%)
Mutual labels:  finance, stock
Rqalpha
A extendable, replaceable Python algorithmic backtest && trading framework supporting multiple securities
Stars: ✭ 4,425 (+4369.7%)
Mutual labels:  finance, stock
IEX CPP API
Unofficial C++ Lib for the IEXtrading API
Stars: ✭ 34 (-65.66%)
Mutual labels:  finance, stock
Finance4py
股市技術分析小工具
Stars: ✭ 8 (-91.92%)
Mutual labels:  finance, stock
Moneymanagerex
Money Manager Ex is an easy to use, money management application built with wxWidgets
Stars: ✭ 836 (+744.44%)
Mutual labels:  finance, stock
AIPortfolio
Use AI to generate a optimized stock portfolio
Stars: ✭ 28 (-71.72%)
Mutual labels:  finance, stock
Iex Api Python
A python wrapper for the IEX API
Stars: ✭ 41 (-58.59%)
Mutual labels:  finance, stock
technical-indicators
Finance package written in Golang, mainly with TA indicators.
Stars: ✭ 56 (-43.43%)
Mutual labels:  finance, stock
Akshare
AKShare is an elegant and simple financial data interface library for Python, built for human beings! 开源财经数据接口库
Stars: ✭ 4,334 (+4277.78%)
Mutual labels:  finance, stock
trading sim
📈📆 Backtest trading strategies concurrently using historical chart data from various financial exchanges.
Stars: ✭ 21 (-78.79%)
Mutual labels:  finance, stock
Trady
Trady is a handy library for computing technical indicators, and it targets to be an automated trading system that provides stock data feeding, indicator computing, strategy building and automatic trading. It is built based on .NET Standard 2.0.
Stars: ✭ 433 (+337.37%)
Mutual labels:  stock, netstandard
stocklist
Stock data collection and analysis
Stars: ✭ 27 (-72.73%)
Mutual labels:  finance, stock
stocki
The CLI for fetching stock market data
Stars: ✭ 32 (-67.68%)
Mutual labels:  finance, stock
Axistradecult
Assist tool for trading on stock market, automatic download historical stock data, technical research, chart and analysis.
Stars: ✭ 26 (-73.74%)
Mutual labels:  finance, stock
Portbalance
Determine optimal rebalancing of a passive stock portfolio.
Stars: ✭ 31 (-68.69%)
Mutual labels:  finance, stock

YahooFinanceApi

build NuGet NuGet license

A handy Yahoo! Finance api wrapper, based on .NET Standard 2.0

Features

  • Get quotes
  • Get historical data
  • Get dividend data
  • Get stock split data

Notes

This library is intended for personal use only, any improper use of this library is not recommended.

Install Note

For traditional .NET framework user, if you find a "System.Runtime.Serialization.Primitives" missing exception is thrown when using this library, you have to install the missing package manually as nuget does not auto install this reference for you (Bugged?)

Important Note (2017/11/12)

As Yahoo has terminated their csv quote service, the depending GetAsync method is no longer usable. Please consider using QueryAsync method instead.

v2.1 Changes (2017/11/12) (Great thanks again to @dshe :D)

  • GetAsync method is obsoleted since Yahoo has terminated their csv quote service
  • Added QueryAsync as a replacement of the original GetAsync method
  • Added Fields for QueryAsync method

v2.0 Changes (2017/10/28) (Great thanks for PRs from @dshe :D)

  • Removed error-proned timezone support
  • All api call now reads and returns datetime in EST instead of local timezone.
  • Removed ascending, leaveZeroWhenInvalid parameter in historical api call.
  • IgnoreEmptyRows property in replacement with the original leaveZeroIfInvalid parameter.
  • Performance boost on async calls.

Supported Platforms

  • .NET Core 2.0
  • .NET framework 4.6.1 or above
  • Xamarin.iOS
  • Xamarin.Android
  • Universal Windows Platform

How To Install

You can find the package through Nuget

PM> Install-Package YahooFinanceApi

How To Use

Add reference

using YahooFinanceApi;

Get stock quotes

// You could query multiple symbols with multiple fields through the following steps:
var securities = await Yahoo.Symbols("AAPL", "GOOG").Fields(Field.Symbol, Field.RegularMarketPrice, Field.FiftyTwoWeekHigh).QueryAsync();
var aapl = securities["AAPL"];
var price = aapl[Field.RegularMarketPrice] // or, you could use aapl.RegularMarketPrice directly for typed-value

Supported fields for stock quote

|||||| |--|--|--|--|--|--| | Language | QuoteType | QuoteSourceName | Currency | MarketState | RegularMarketPrice | | RegularMarketTime | RegularMarketChange | RegularMarketOpen | RegularMarketDayHigh | RegularMarketDayLow | RegularMarketVolume | | ShortName | FiftyTwoWeekHighChange | FiftyTwoWeekHighChangePercent | FiftyTwoWeekLow | FiftyTwoWeekHigh | DividendDate | | EarningsTimestamp | EarningsTimestampStart | EarningsTimestampEnd | TrailingAnnualDividendRate | TrailingPE | TrailingAnnualDividendYield | | EpsTrailingTwelveMonths | EpsForward | SharesOutstanding | BookValue | RegularMarketChangePercent | RegularMarketPreviousClose | | Bid | Ask | BidSize | AskSize | MessageBoardId | FullExchangeName | | LongName | FinancialCurrency | AverageDailyVolume3Month | AverageDailyVolume10Day | FiftyTwoWeekLowChange | FiftyTwoWeekLowChangePercent | | TwoHundredDayAverageChangePercent | MarketCap | ForwardPE | PriceToBook | SourceInterval | ExchangeTimezoneName | | ExchangeTimezoneShortName | Market | Exchange | ExchangeDataDelayedBy | PriceHint | FiftyDayAverage | | FiftyDayAverageChange | FiftyDayAverageChangePercent | TwoHundredDayAverage | TwoHundredDayAverageChange | Tradeable | GmtOffSetMilliseconds | | Symbol |||||

Ignore invalid rows

// Sometimes, yahoo returns broken rows for historical calls, you could decide if these invalid rows is ignored or not by the following statement
Yahoo.IgnoreEmptyRows = true;

Get historical data for a stock

// You should be able to query data from various markets including US, HK, TW
// The startTime & endTime here defaults to EST timezone
var history = await Yahoo.GetHistoricalAsync("AAPL", new DateTime(2016, 1, 1), new DateTime(2016, 7, 1), Period.Daily);

foreach (var candle in history)
{
    Console.WriteLine($"DateTime: {candle.DateTime}, Open: {candle.Open}, High: {candle.High}, Low: {candle.Low}, Close: {candle.Close}, Volume: {candle.Volume}, AdjustedClose: {candle.AdjustedClose}");
}

Get dividend history for a stock

// You should be able to query data from various markets including US, HK, TW
var dividends = await Yahoo.GetDividendsAsync("AAPL", new DateTime(2016, 1, 1), new DateTime(2016, 7, 1));
foreach (var candle in dividends)
{
    Console.WriteLine($"DateTime: {candle.DateTime}, Dividend: {candle.Dividend}");
}

Get stock split history for a stock

var splits = await Yahoo.GetSplitsAsync("AAPL", new DateTime(2014, 6, 8), new DateTime(2014, 6, 10));
foreach (var s in splits)
{
    Console.WriteLine($"DateTime: {s.DateTime}, AfterSplit: {s.AfterSplit}, BeforeSplit: {s.BeforeSplit}");
}

Powered by

  • Flurl (@tmenier) - A simple & elegant fluent-style REST api library
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].