Download price, fundamental, option, currency, futures, ETF, mutual fund, and various other data from Yahoo Finance
Yahoo!, Y!Finance, and Yahoo! finance are registered trademarks of Yahoo, Inc.
YFinance.jl is not endorsed or in anyway affiliated with Yahoo, Inc. The data retreived can only be used for personal use. Please see Yahoo's terms of use to ensure that you can use the data:
The implementation of YFinance.jl
is similar to the python package yahooquery
in that it accesses data through API endpoints. Therefore, YFinance.jl
does not experience the same decryption issues that pythonโs yfinance
faces at the moment.
The package is registered in the General
registry and so can be installed at the REPL with ] add YFinance
or by running:
using Pkg
Pkg.add("YFinance")
Precompilation of the get_prices
function. This has caused precompilation hangs for Julia 1.10 and 1.11 - package typically still precompiles but takes long and gives warnings. Note precompilation also does not work if you require to set a proxy to access the internet.
To Install this version enter the package mode by entering ]
in the REPL and run the following command:
(@v1.10) pkg> add YFinance @v0.1.8
Does not precompile.
To Install this version enter the package mode by entering ]
in the REPL and run the following command:
(@v1.10) pkg> add YFinance @v0.1.9
Precompiles only the response processing part of the get_prices
and not the HTTP request. Most of the compilation time lies unfortunately with the request itself.
To Install this version enter the package mode by entering ]
in the REPL and run the following command:
(@v1.10) pkg> add YFinance
There are more examples in the Docs.
Apple monthly stock price over the past 5 years, with dividend and stock split information in local user time.
using YFinance
get_prices("AAPL",range="5y",interval="1mo",divsplits=true,exchange_local_time=false)
OrderedCollections.OrderedDict{String, Any} with 8 entries:
"ticker" => "AAPL"
"timestamp" => [DateTime("2019-09-01T04:00:00"), DateTime("2019-10-01T04:00:00"), DateTime("2019-11-01T04:00:00"), DateTโฆ
"open" => [49.9955, 54.5099, 60.4363, 64.9247, 71.9621, 73.92, 68.7337, 60.0214, 69.7003, 77.5799 โฆ 189.83, 186.6โฆ
"high" => [54.8369, 60.4872, 64.9072, 71.4106, 79.6407, 79.4877, 74.0224, 71.7165, 78.9507, 90.918 โฆ 199.096, 195โฆ
"low" => [49.4603, 52.1026, 60.3443, 62.2575, 71.1143, 62.2769, 51.7694, 57.6839, 69.6029, 77.448 โฆ 186.958, 179โฆ
"close" => [55.9925, 62.19, 66.8125, 73.4125, 77.3775, 68.34, 63.5725, 73.45, 79.485, 91.2 โฆ 192.53, 184.4, 180.75โฆ
"adjclose" => [54.2435, 60.2474, 64.7255, 71.3329, 75.1856, 66.4041, 61.9183, 71.5387, 77.4167, 89.0673 โฆ 192.024, 18โฆ
"vol" => [2.10248e9, 2.35721e9, 1.73731e9, 2.32113e9, 2.85125e9, 2.93375e9, 6.11666e9, 3.18033e9, 2.73292e9, 3.167โฆ
Bitcoin USD, 5 minute data points for an entire day.
DataFrame(get_prices("BTC-USD",range="1d",interval="5m",exchange_local_time=true))
147ร7 DataFrame
Row โ ticker timestamp open high low close vol
โ String DateTime Float64 Float64 Float64 Float64 Float64
โโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
1 โ BTC-USD 2024-08-08T00:00:00 55139.5 55254.3 55139.5 55254.3 7.3769e6
2 โ BTC-USD 2024-08-08T00:05:00 55229.6 55355.9 55229.6 55355.9 0.0
3 โ BTC-USD 2024-08-08T00:10:00 55273.2 55273.2 55121.3 55121.3 1.9198e7
4 โ BTC-USD 2024-08-08T00:15:00 55099.8 55272.9 55099.8 55232.8 0.0
โฎ โ โฎ โฎ โฎ โฎ โฎ โฎ โฎ
145 โ BTC-USD 2024-08-08T12:00:00 57346.1 57406.9 57346.1 57406.9 0.0
146 โ BTC-USD 2024-08-08T12:05:00 57384.4 57384.4 57364.8 57364.8 0.0
147 โ BTC-USD 2024-08-08T12:08:00 57330.2 57330.2 57330.2 57330.2 0.0
140 rows omitted
Rolls-Royce daily stock price between 2020-01-01 and 2020-05-30
using TimeSeries
get_prices(TimeArray,"RR.L",startdt="2020-01-01",enddt="2020-05-30")
103ร6 TimeArray{Float64, 2, DateTime, Matrix{Float64}} 2020-01-02T08:00:00 to 2020-05-29T07:00:00
โโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโฌโโโโโโโโโโฌโโโโโโโโโโฌโโโโโโโโโโฌโโโโโโโโโโโฌโโโโโโโโโโโโ
โ โ open โ high โ low โ close โ adjclose โ vol โ
โโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโผโโโโโโโโโโผโโโโโโโโโโผโโโโโโโโโโผโโโโโโโโโโโผโโโโโโโโโโโโค
โ 2020-01-02T08:00:00 โ 236.374 โ 238.845 โ 232.874 โ 233.766 โ 233.766 โ 1.12197e7 โ
โ 2020-01-03T08:00:00 โ 232.668 โ 233.629 โ 229.03 โ 232.599 โ 232.599 โ 1.2363e7 โ
โ 2020-01-06T08:00:00 โ 231.295 โ 233.766 โ 228.932 โ 232.325 โ 232.325 โ 1.13855e7 โ
โ 2020-01-07T08:00:00 โ 234.041 โ 234.26 โ 227.658 โ 229.305 โ 229.305 โ 9.56679e6 โ
โ โฎ โ โฎ โ โฎ โ โฎ โ โฎ โ โฎ โ โฎ โ
โ 2020-05-27T07:00:00 โ 110.5 โ 126.904 โ 110.06 โ 118.771 โ 118.771 โ 7.7212e7 โ
โ 2020-05-28T07:00:00 โ 109.814 โ 114.035 โ 104.049 โ 109.471 โ 109.471 โ 1.33343e8 โ
โ 2020-05-29T07:00:00 โ 103.294 โ 103.946 โ 93.2044 โ 93.2044 โ 93.2044 โ 1.60135e8 โ
โโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโดโโโโโโโโโโดโโโโโโโโโโดโโโโโโโโโโดโโโโโโโโโโโดโโโโโโโโโโโโ
96 rows omitted
EURO-USD (EURUSD=X) daily price since start of data
using TSFrames
tsf = get_prices(TSFrame,"EURUSD=X",startdt=Date(1900,1,1),enddt=today())
5399ร7 TSFrame with DateTime Index
Index open high low close adjclose vol ticker
DateTime Float64 Float64 Float64 Float64 Float64 Float64 String
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
2003-12-01T00:00:00 1.2034 1.20401 1.1944 1.1965 1.1965 0.0 EURUSD=X
2003-12-02T00:00:00 1.1961 1.2109 1.1946 1.2089 1.2089 0.0 EURUSD=X
2003-12-03T00:00:00 1.209 1.213 1.2077 1.2123 1.2123 0.0 EURUSD=X
2003-12-04T00:00:00 1.212 1.2144 1.2044 1.20809 1.20809 0.0 EURUSD=X
โฎ โฎ โฎ โฎ โฎ โฎ โฎ โฎ
2024-08-05T23:00:00 1.0951 1.09631 1.09046 1.0951 1.0951 0.0 EURUSD=X
2024-08-06T23:00:00 1.09262 1.09364 1.09069 1.09262 1.09262 0.0 EURUSD=X
2024-08-08T12:41:04 1.09266 1.09481 1.09039 1.09039 1.09039 0.0 EURUSD=X
5392 rows omitted
using Plots
plot(tsf[:,[:Index,:adjclose]])
get_ESG("NFLX")["score"] |> DataFrame |> dropmissing
79ร6 DataFrame
Row โ symbol timestamp esgScore governanceScore environmentScore socialScore
โ String DateTime Real Real Real Real
โโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
1 โ NFLX 2014-09-01T00:00:00 43 57 37 39
2 โ NFLX 2014-10-01T00:00:00 43 57 37 39
3 โ NFLX 2014-11-01T00:00:00 43 57 37 39
4 โ NFLX 2014-12-01T00:00:00 43 57 37 39
โฎ โ โฎ โฎ โฎ โฎ โฎ โฎ
77 โ NFLX 2022-05-01T00:00:00 15.78 8.87 0.09 6.83
78 โ NFLX 2022-08-01T00:00:00 16.25 9.34 0.09 6.83
79 โ NFLX 2023-09-01T00:00:00 16.41 9.01 0.09 7.31
72 rows omitted
get_Fundamental("NFLX", "valuation","annual",today()-Year(3) , today()) |> DataFrame
3ร10 DataFrame
Row โ timestamp PegRatio ForwardPeRatio MarketCap PeRatio EnterprisesValueRevenueRatio PbRatio EnterprisesValueEBITDARatio PsRatio EnterpriseValue
โ DateTime Any Any Any Any Any Any Any Any Any
โโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
1 โ 2021-12-31T00:00:00 1.4751 46.5116 267461134181 54.3228 9.6192 17.4644 14.914 9.57841 275427617181
2 โ 2022-12-31T00:00:00 2.1982 27.027 131227643270 26.3993 4.4166 6.39726 6.7377 4.238 139002027270
3 โ 2023-12-31T00:00:00 1.951 30.6748 213097477242 48.5908 6.7047 9.53074 10.686 6.71235 219530399242
is=get_Fundamental("AMD", "income_statement","annual",today()-Year(1) , today()) |> DataFrame
stack(is, Not(:timestamp))
49ร3 DataFrame
Row โ timestamp variable value
โ DateTime String Any
โโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
1 โ 2023-12-31T00:00:00 InterestExpenseNonOperating 106000000
2 โ 2023-12-31T00:00:00 CostOfRevenue 12220000000
3 โ 2023-12-31T00:00:00 TotalRevenue 22680000000
4 โ 2023-12-31T00:00:00 EarningsFromEquityInterestNetOfTโฆ 16000000
โฎ โ โฎ โฎ โฎ
47 โ 2023-12-31T00:00:00 NormalizedIncome 854000000
48 โ 2023-12-31T00:00:00 EBIT 598000000
49 โ 2023-12-31T00:00:00 TotalUnusualItems 0
42 rows omitted
op = get_Options("AMD")
OrderedCollections.OrderedDict{String, OrderedCollections.OrderedDict{String, Vector{Any}}} with 2 entries:
"calls" => OrderedDict("contractSymbol"=>["AMD240809C00075000", "AMD240809C00080000", "AMD240809C00085000", "AMD240809C0โฆ
"puts" => OrderedDict("contractSymbol"=>["AMD240809P00075000", "AMD240809P00080000", "AMD240809P00085000", "AMD240809P0โฆ
DataFrame(op["calls"])
65ร16 DataFrame
Row โ contractSymbol strike currency lastPrice change percentChange volume openInterest bid ask contractSi โฏ
โ Any Any Any Any Any Any Any Any Any Any Any โฏ
โโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
1 โ AMD240809C00075000 75 USD 59.65 0 0 1 26 0 0 REGULAR โฏ
2 โ AMD240809C00080000 80 USD 52.61 0 0 1 11 0 0 REGULAR
3 โ AMD240809C00085000 85 USD 49.69 0 0 2 0 0 0 REGULAR
4 โ AMD240809C00090000 90 USD 44.54 0 0 3 12 0 0 REGULAR
โฎ โ โฎ โฎ โฎ โฎ โฎ โฎ โฎ โฎ โฎ โฎ โฎ โฑ
63 โ AMD240809C00285000 285 USD 0.01 0 0 15 16 0 0 REGULAR โฏ
64 โ AMD240809C00290000 290 USD 0.08 0 0 7 10 0 0 REGULAR
65 โ AMD240809C00295000 295 USD 0.01 0 0 1 19 0 0 REGULAR
6 columns and 58 rows omitted