All Functions
YFinance.NewsItem
— TypeThis is an NewsItem
Fields
- title: Title of the news article
- publisher: Publisher of the news
- link: The link to the news article
- timestamp: The timestamp of the time when the news was published (
DateTime
) - symbols: An array of the tickers related to the news item
YFinance.YahooNews
— TypeThis is an YahooNews <: AbstractArray{NewsItem, N}
Basically a custom Array of NewsItem
s
YFinance.YahooSearch
— TypeThis is an YahooSearch <: AbstractArray{YahooSearchItem, N}
Basically a custom Array of YahooSearchItem
s
YFinance.YahooSearchItem
— TypeThis is an YahooSearchItem
Fields
- symbol: The Symbol (Ticker)
- shortname: The short name of the instrument/company
- quoteType: The type of asset (e.g. EQUITY)
- sector: The Sector (only if quotetype==EQUITY, otherwise "")
- industry: The Industry (only if quotetype==EQUITY, otherwise "")
YFinance._rand_header
— Method_rand_header()
Chooses a random header.
YFinance._renew_cookies_and_crumb
— Method_renew_cookies_and_crumb()
Renews both the cookies and the crumb.
YFinance._set_cookies_and_crumb
— Method_set_cookies_and_crumb()
Checks if the global _COOKIE and _CRUMB variables are set if not it creates them.
YFinance.clear_proxy_settings
— Methodclear_proxy_settings()
Clears the proxy settings by setting them back to their default (no proxy configuration).
YFinance.create_proxy_settings
— Functioncreate_proxy_settings(p::AbstractString,user=nothing,password=nothing)
Sets the global proxy variable _PROXY_SETTINGS::NamedTuple
. This NamedTuple
contains a proxy
and a auth
field. These fields default to nothing
and and empty Dict
respectively.
Arguments
p
::String
(Required) of the form: "http://proxy.xyz.com:8080"user
::String
Username (optional) only required if proxy requires authentication. Defaults tonothing
(no authentication needed)password
::String
The password corresponding to the Username. Defaults tonothing
(no authentication needed)
YFinance.get_ESG
— Methodget_ESG(symbol::String)
Retrievs ESG Scores from Yahoo Finance stored in a OrderedCollections.OrderedDict with two items. One, score
, contains the companies ESG scores and individal Overall, Environment, Social and Goverance Scores as well as a timestamp of type DateTime
. The other, peer_score
, contains the peer group's scores. The subdictionaries can be transformed to DataFrames
Arguments
smybol
::String
is a ticker (e.g. AAPL for Apple Computers, or ^GSPC for the S&P500)throw_error
::Bool
defaults tofalse
. If set to true the function errors when the ticker is not valid. Else a warning is given and an empty OrderedCollections.OrderedDict is returned.
Examples
julia> get_ESG("AAPL")
OrderedDict{String, OrderedDict{String, Any}} with 2 entries:
"score" => OrderedDict("symbol"=>"AAPL", "timestamp"=>[DateTime("2014-09-01T00:00:…
"peer_score" => OrderedDict("symbol"=>"Technology Hardware", "timestamp"=>[DateTime("20…
julia> using DataFrames
julia> get_ESG("AAPL")["score"] |> DataFrame
96×6 DataFrame
Row │ symbol timestamp esgScore governanceScore environmentScore socialScore
│ String DateTime Real? Real? Real? Real?
─────┼─────────────────────────────────────────────────────────────────────────────────────────
1 │ AAPL 2014-09-01T00:00:00 61 62 74 45
2 │ AAPL 2014-10-01T00:00:00 60 62 74 45
3 │ AAPL 2014-11-01T00:00:00 61 62 74 45
⋮ │ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮
95 │ AAPL 2022-07-01T00:00:00 missing missing missing missing
96 │ AAPL 2022-08-01T00:00:00 16.68 9.18 0.65 6.86
91 rows omitted
YFinance.get_Fundamental
— Methodget_Fundamental(symbol::AbstractString, item::AbstractString,interval::AbstractString, startdt, enddt)
Retrievs financial statement information from Yahoo Finance stored in a OrderedCollections.OrderedDict.
Arguments
smybol::String
is a ticker (e.g. AAPL for Apple Computers, or ^GSPC for the S&P500)item::String
can either be an entire financial statement or a subitem. Entire financial statements:"income_statement", "valuation", "cash_flow", "balance_sheet"
. To see valid sub items grouped by financial statement type in aOrderedCollections.OrderedDict
call_Fundamental_Types
interval::String
can be one of "annual", "quarterly", "monthly"startdt
andenddt
take the following types:::Date
,::DateTime
, or aString
of the following formyyyy-mm-dd
throw_error::Bool
defaults tofalse
. If set to true the function errors when the ticker is not valid. Else a warning is given and an emptyOrderedCollections.OrderedDict
is returned.
Examples
julia> get_Fundamental("NFLX", "income_statement","quarterly","2000-01-01","2022-12-31")
OrderedDict{String, Any} with 40 entries:
"timestamp" => [DateTime("2021-12-31T00:00:00"), DateTime("2022-0… "GeneralAndAdministrativeExpense" => Any[397790000, 397928000, 409297000, 373213000]
"SellingGeneralAndAdministration" => Any[1190503000, 953906000, 984257000, 941167000]
"InterestIncome" => Any[108512000, 195645000, 220226000, 261404000]
"OperatingRevenue" => Any[7709318000, 7867767000, 7970141000, 7925589000] "DilutedNIAvailtoComStockholders" => Any[607429000, 1597447000, 1440951000, 1398242000]
"NormalizedIncome" => Any[607429000, 1597447000, 1440951000, 1398242000]
"NetIncomeCommonStockholders" => Any[607429000, 1597447000, 1440951000, 1398242000]
"BasicAverageShares" => Any[443462000, 444146000, 444557000, 444878000]
⋮ => ⋮
julia> using DataFrames
julia> get_Fundamental("AAPL", "InterestExpense","quarterly","2000-01-01","2022-12-31") |> DataFrame
4×2 DataFrame
Row │ timestamp InterestExpense
│ DateTime Any
─────┼──────────────────────────────────────
1 │ 2021-12-31T00:00:00 694000000
2 │ 2022-03-31T00:00:00 691000000
3 │ 2022-06-30T00:00:00 719000000
4 │ 2022-09-30T00:00:00 827000000
YFinance.get_Options
— Methodget_Options(symbol::String)
Retrievs options data from Yahoo Finance stored in a OrderedCollections.OrderedDict with two items. One contains Call options the other Put options. These subitems are OrderedCollections.OrderedDict themselves. The call and put options OrderedCollections.OrderedDict can readily be transformed to a DataFrame.
Arguments
smybol
::String
is a ticker (e.g. AAPL for Apple Computers, or ^GSPC for the S&P500)throw_error
::Bool
defaults tofalse
. If set to true the function errors when the ticker is not valid. Else a warning is given and an empty OrderedCollections.OrderedDict is returned.
Examples
julia> get_Options("AAPL")
OrderedDict{String, OrderedDict{String, Vector{Any}}} with 2 entries:
"calls" => OrderedDict("contractSymbol"=>["AAPL221230C00050000", "AAPL221230C00055000",…
"puts" => OrderedDict("contractSymbol"=>["AAPL221230P00050000", "AAPL221230P00055000",…
julia> using DataFrames
julia> get_Options("AAPL")["calls"] |> DataFrame
72×16 DataFrame
Row │ contractSymbol strike currency lastPrice change percentChange volume ⋯
│ Any Any Any Any Any Any Any ⋯
─────┼────────────────────────────────────────────────────────────────────────────────────
1 │ AAPL221230C00050000 50 USD 79.85 0 0 1 ⋯
2 │ AAPL221230C00055000 55 USD 72.85 0 0 1
3 │ AAPL221230C00060000 60 USD 66.4 0 0 19
⋮ │ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋱
71 │ AAPL221230C00230000 230 USD 0.02 0 0 missing
72 │ AAPL221230C00250000 250 USD 0.01 0 0 2 ⋯
9 columns and 67 rows omitted
julia> using DataFrames
julia> data = get_Options("AAPL");
julia> vcat( [DataFrame(i) for i in values(data)]...)
141×16 DataFrame
Row │ contractSymbol strike currency lastPrice change percentChange volume ⋯
│ Any Any Any Any Any Any Any ⋯
─────┼────────────────────────────────────────────────────────────────────────────────────
1 │ AAPL221230C00050000 50 USD 79.85 0 0 1 ⋯
2 │ AAPL221230C00055000 55 USD 72.85 0 0 1
3 │ AAPL221230C00060000 60 USD 66.4 0 0 19
⋮ │ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋱
140 │ AAPL221230P00225000 225 USD 94.65 0 0 1
141 │ AAPL221230P00230000 230 USD 99.65 0 0 1 ⋯
9 columns and 136 rows omitted
YFinance.get_all_symbols
— Methodget_all_symbols(market::T)::Vector{T} where {T<:String}
Fetch all the symbols from a given market
.
Arguments
market::String
: The market to fetch the symbols from.
Currently supported markets are:
AMEX
NASDAQ
NYSE
Uses dumbstockapi.com
Returns
Vector{String}
: A vector of strings containing the symbols.
Example
julia> get_all_symbols("NYSE")
3127-element Vector{String}:
"A"
"AA"
"AAC"
"AAN"
⋮
"ZTR"
"ZTS"
"ZUO"
"ZYME"
YFinance.get_calendar_events
— Methodget_calendar_events(quoteSummary::JSON3.Object)
Retrievs calendar events from the quote summary.
Arguments
Can be either a JSON3.Object
returned from get_quoteSummary(symbol::String; item=nothing,throw_error=false)
or a ticker symbol of type AbstractString
If a ticker symbol is provided get_quoteSummary(symbol::String)
is called first.
Examples
julia> get_quoteSummary("AAPL") |> get_calendar_events
OrderedDict{String, Any} with 3 entries:
"dividend_date" => DateTime("2022-11-10T00:00:00")
"earnings_dates" => [DateTime("2023-01-25T10:59:00"), DateTime("2023-01-30T12:00:00")]
"exdividend_date" => DateTime("2022-11-04T00:00:00")
julia> get_calendar_events("AAPL")
OrderedDict{String, Any} with 3 entries:
"dividend_date" => DateTime("2022-11-10T00:00:00")
"earnings_dates" => [DateTime("2023-01-25T10:59:00"), DateTime("2023-01-30T12:00:00")]
"exdividend_date" => DateTime("2022-11-04T00:00:00")
julia> using DataFrames
julia> get_calendar_events("AAPL") |> DataFrame
2×3 DataFrame
Row │ dividend_date earnings_dates exdividend_date
│ DateTime DateTime DateTime
─────┼───────────────────────────────────────────────────────────────
1 │ 2022-11-10T00:00:00 2023-01-25T10:59:00 2022-11-04T00:00:00
2 │ 2022-11-10T00:00:00 2023-01-30T12:00:00 2022-11-04T00:00:00
YFinance.get_cookie
— Methodget_cookie()
Retrieves cookies from "https://fc.yahoo.com".
YFinance.get_crumb
— Methodget_crumb()
Passess the request header and the cookies to "https://query2.finance.yahoo.com/v1/test/getcrumb" and retrieves the crumb. If the global _HEADER or _COOKIE variables are not defined they are created.
YFinance.get_dividends
— Methodget_dividends(symbol::String; startdt::Union{Date,DateTime,AbstractString}="", enddt::Union{Date,DateTime,AbstractString}="", timeout::Int=10, throw_error::Bool=false, exchange_local_time::Bool=false)
Retrieves dividend data from Yahoo Finance.
Arguments
symbol
: A ticker (e.g., AAPL for Apple Inc., or ^GSPC for the S&P 500)startdt
andenddt
: Optional. Can be of typeDate
,DateTime
, or aString
in the format "yyyy-mm-dd". If not provided,startdt
defaults to the earliest available data andenddt
to the current date.timeout
: Integer, defaults to 10. The timeout for the HTTP request in seconds.throw_error
: Boolean, defaults tofalse
. If set to true, the function raises an error when the ticker is not valid or other issues occur. If false, a warning is given and an emptyOrderedDict
is returned.exchange_local_time
: Boolean, defaults tofalse
. If set to true, the timestamp corresponds to the exchange local time; otherwise, it's in GMT.
Returns
An OrderedDict{String, Union{String,Vector{DateTime},Vector{Float64}}}
containing the following keys:
- ticker
- timestamp
- div
Examples
julia> get_dividends("AAPL", startdt = "2021-01-01", enddt="2022-01-01")
OrderedDict{String, Union{String,Vector{DateTime},Vector{Float64}}} with 3 entries:
"ticker" => "AAPL"
"timestamp" => [DateTime("2021-02-05T14:30:00"), DateTime("2021-05-07T13:30:00"), DateTime("2021-08-06T13:30:00"), DateTime("2021-11-05T13:30:00")]
"div" => [0.205, 0.22, 0.22, 0.22]
## Can be easily converted to a DataFrame
julia> using DataFrames
julia> get_dividends("AAPL", startdt = "2021-01-01", enddt="2022-01-01") |> DataFrame
4×3 DataFrame
Row │ ticker timestamp div
│ String DateTime Float64
─────┼───────────────────────────────────────
1 │ AAPL 2021-02-05T14:30:00 0.205
2 │ AAPL 2021-05-07T13:30:00 0.22
3 │ AAPL 2021-08-06T13:30:00 0.22
4 │ AAPL 2021-11-05T13:30:00 0.22
## Broadcasting
julia> get_dividends.(["AAPL", "F"], startdt = "2021-01-01", enddt="2022-01-01")
2-element Vector{OrderedDict{String, Union{String,Vector{DateTime},Vector{Float64}}}}:
OrderedDict("ticker" => "AAPL", "timestamp" => [DateTime("2021-02-05T14:30:00"), DateTime("2021-05-07T13:30:00"), DateTime("2021-08-06T13:30:00"), DateTime("2021-11-05T13:30:00")], "div" => [0.205, 0.22, 0.22, 0.22])
OrderedDict("ticker" => "F", "timestamp" => [DateTime("2021-11-18T14:30:00")], "div" => [0.1])
## Converting it to a DataFrame:
julia> using DataFrames
julia> data = get_dividends.(["AAPL", "F"], startdt = "2021-01-01", enddt="2022-01-01");
julia> vcat([DataFrame(i) for i in data]...)
5×3 DataFrame
Row │ ticker timestamp div
│ String DateTime Float64
─────┼───────────────────────────────────────
1 │ AAPL 2021-02-05T14:30:00 0.205
2 │ AAPL 2021-05-07T13:30:00 0.22
3 │ AAPL 2021-08-06T13:30:00 0.22
4 │ AAPL 2021-11-05T13:30:00 0.22
5 │ F 2021-11-18T14:30:00 0.1
YFinance.get_earnings_estimates
— Methodget_earnings_estimates(quoteSummary::JSON3.Object)
Retrievs the earnings estimates from the quote summary.
Arguments
Can be either a JSON3.Object
returned from get_quoteSummary(symbol::String; item=nothing,throw_error=false)
or a ticker symbol of type AbstractString
If a ticker symbol is provided get_quoteSummary(symbol::String)
is called first.
Examples
julia> get_quoteSummary("AAPL") |> get_earnings_estimates
OrderedDict{String, Vector} with 3 entries:
"quarter" => ["4Q2021", "1Q2022", "2Q2022", "3Q2022", "4Q2022"]
"estimate" => [1.89, 1.43, 1.16, 1.27, 1.98]
"actual" => Union{Missing, Float64}[2.1, 1.52, 1.2, 1.29, missing]
julia> get_earnings_estimates("AAPL")
OrderedDict{String, Vector} with 3 entries:
"quarter" => ["4Q2021", "1Q2022", "2Q2022", "3Q2022", "4Q2022"]
"estimate" => [1.89, 1.43, 1.16, 1.27, 1.98]
"actual" => Union{Missing, Float64}[2.1, 1.52, 1.2, 1.29, missing]
julia> using DataFrames
julia> get_earnings_estimates("AAPL") |> DataFrame
5×3 DataFrame
Row │ quarter estimate actual
│ String Float64 Float64?
─────┼───────────────────────────────
1 │ 4Q2021 1.89 2.1
2 │ 1Q2022 1.43 1.52
3 │ 2Q2022 1.16 1.2
4 │ 3Q2022 1.27 1.29
5 │ 4Q2022 1.98 missing
YFinance.get_eps
— Methodget_eps(quoteSummary::JSON3.Object)
Retrievs the earnings per share from the quote summary.
Arguments
Can be either a JSON3.Object
returned from get_quoteSummary(symbol::String; item=nothing,throw_error=false)
or a ticker symbol of type AbstractString
If a ticker symbol is provided get_quoteSummary(symbol::String)
is called first.
Examples
julia> get_quoteSummary("AAPL") |> get_eps
OrderedDict{String, Vector} with 4 entries:
"quarter" => [DateTime("2021-12-31T00:00:00"), DateTime("2022-03-31T00:00:00"), DateTime("2022-06-30T00:00:00"), DateTime("2022-09-30T00:00:00")]
"estimate" => [1.89, 1.43, 1.16, 1.27]
"actual" => [2.1, 1.52, 1.2, 1.29]
"surprise" => [0.111, 0.063, 0.034, 0.016]
julia> get_eps("AAPL")
OrderedDict{String, Vector} with 4 entries:
"quarter" => [DateTime("2021-12-31T00:00:00"), DateTime("2022-03-31T00:00:00"), DateTime("2022-06-30T00:00:00"), DateTime("2022-09-30T00:00:00")]
"estimate" => [1.89, 1.43, 1.16, 1.27]
"actual" => [2.1, 1.52, 1.2, 1.29]
"surprise" => [0.111, 0.063, 0.034, 0.016]
julia> using DataFrames
julia> get_eps("AAPL") |> DataFrame
4×4 DataFrame
Row │ quarter estimate actual surprise
│ DateTime Float64 Float64 Float64
─────┼──────────────────────────────────────────────────
1 │ 2021-12-31T00:00:00 1.89 2.1 0.111
2 │ 2022-03-31T00:00:00 1.43 1.52 0.063
3 │ 2022-06-30T00:00:00 1.16 1.2 0.034
4 │ 2022-09-30T00:00:00 1.27 1.29 0.016
YFinance.get_insider_holders
— Methodget_insider_holders(quoteSummary::JSON3.Object)
Retrievs the insiders holdings from the quote summary.
Arguments
Can be either a JSON3.Object
returned from get_quoteSummary(symbol::String; item=nothing,throw_error=false)
or a ticker symbol of type AbstractString
If a ticker symbol is provided get_quoteSummary(symbol::String)
is called first.
Examples
julia> get_quoteSummary("AAPL") |> get_insider_holders
OrderedDict{String, Vector} with 8 entries:
"name" => ["ADAMS KATHERINE L", "BELL JAMES A", "JUNG ANDREA", "KONDO C…
"relation" => Union{Missing, String}["General Counsel", "Director", "Direct…
"description" => Union{Missing, String}["Sale", "Stock Gift", "Conversion of E…
"lastestTransDate" => Union{Missing, DateTime}[DateTime("2022-10-03T00:00:00"), Dat…
"positionDirect" => Union{Missing, Int64}[427334, 34990, 139594, 31505, 4588720, …
"positionDirectDate" => Union{Missing, DateTime}[DateTime("2022-10-03T00:00:00"), Dat…
"positionIndirect" => Union{Missing, Int64}[missing, missing, missing, missing, mis…
"positionIndirectDate" => Union{Missing, DateTime}[missing, missing, missing, missing, …
julia> get_insider_holders("AAPL")
OrderedDict{String, Vector} with 8 entries:
"name" => ["ADAMS KATHERINE L", "BELL JAMES A", "JUNG ANDREA", "KONDO C…
"relation" => Union{Missing, String}["General Counsel", "Director", "Direct…
"description" => Union{Missing, String}["Sale", "Stock Gift", "Conversion of E…
"lastestTransDate" => Union{Missing, DateTime}[DateTime("2022-10-03T00:00:00"), Dat…
"positionDirect" => Union{Missing, Int64}[427334, 34990, 139594, 31505, 4588720, …
"positionDirectDate" => Union{Missing, DateTime}[DateTime("2022-10-03T00:00:00"), Dat…
"positionIndirect" => Union{Missing, Int64}[missing, missing, missing, missing, mis…
"positionIndirectDate" => Union{Missing, DateTime}[missing, missing, missing, missing, …
julia> using DataFrames
julia> get_insider_holders("AAPL") |> DataFrame
10×8 DataFrame
Row │ name relation description l ⋯
│ String String? String? D ⋯
─────┼────────────────────────────────────────────────────────────────────────────────────
1 │ ADAMS KATHERINE L General Counsel Sale 2 ⋯
2 │ BELL JAMES A Director Stock Gift 2
3 │ JUNG ANDREA Director Conversion of Exercise of deriva… 2
4 │ KONDO CHRISTOPHER Officer Sale 2
5 │ LEVINSON ARTHUR D Director Sale 2 ⋯
6 │ MAESTRI LUCA Chief Financial Officer Sale 2
7 │ O'BRIEN DEIRDRE Officer Sale 2
8 │ SUGAR RONALD D Director Conversion of Exercise of deriva… 2
9 │ WAGNER SUSAN L Director Conversion of Exercise of deriva… 2 ⋯
10 │ WILLIAMS JEFFREY E Chief Operating Officer Conversion of Exercise of deriva… 2
5 columns omitted
YFinance.get_insider_transactions
— Methodget_insider_transactions(quoteSummary::JSON3.Object)
Retrievs the insider transactions from the quote summary.
Arguments
Can be either a JSON3.Object
returned from get_quoteSummary(symbol::String; item=nothing,throw_error=false)
or a ticker symbol of type AbstractString
If a ticker symbol is provided get_quoteSummary(symbol::String)
is called first.
Examples
julia> get_quoteSummary("AAPL") |> get_insider_transactions
OrderedDict{String, Vector} with 7 entries:
"filerName" => ["KONDO CHRISTOPHER", "MAESTRI LUCA", "O'BRIEN DEIRDRE", "KONDO CH…
"filerRelation" => Union{Missing, String}["Officer", "Chief Financial Officer", "Offi…
"transactionText" => Union{Missing, String}["Sale at price 148.72 per share.", "Sale at…
"date" => Union{Missing, DateTime}[DateTime("2022-11-22T00:00:00"), DateTime…
"ownership" => Union{Missing, String}["D", "D", "D", "D", "D", "D", "D", "D", "I"…
"shares" => Union{Missing, Int64}[20200, 176299, 8053, 13136, 16612, 181139, 1…
"value" => Union{Missing, Int64}[3004144, 27493275, 1147150, missing, missing…
julia> get_insider_transactions("AAPL")
OrderedDict{String, Vector} with 7 entries:
"filerName" => ["KONDO CHRISTOPHER", "MAESTRI LUCA", "O'BRIEN DEIRDRE", "KONDO CH…
"filerRelation" => Union{Missing, String}["Officer", "Chief Financial Officer", "Offi…
"transactionText" => Union{Missing, String}["Sale at price 148.72 per share.", "Sale at…
"date" => Union{Missing, DateTime}[DateTime("2022-11-22T00:00:00"), DateTime…
"ownership" => Union{Missing, String}["D", "D", "D", "D", "D", "D", "D", "D", "I"…
"shares" => Union{Missing, Int64}[20200, 176299, 8053, 13136, 16612, 181139, 1…
"value" => Union{Missing, Int64}[3004144, 27493275, 1147150, missing, missing…
julia> using DataFrames
julia> get_insider_transactions("AAPL") |> DataFrame
75×7 DataFrame
Row │ filerName filerRelation transactionText d ⋯
│ String String? String? D ⋯
─────┼────────────────────────────────────────────────────────────────────────────────────
1 │ KONDO CHRISTOPHER Officer Sale at price 148.72 per share. 2 ⋯
2 │ MAESTRI LUCA Chief Financial Officer Sale at price 154.70 - 157.20 pe… 2
3 │ O'BRIEN DEIRDRE Officer Sale at price 142.45 per share. 2
4 │ KONDO CHRISTOPHER Officer 2
5 │ O'BRIEN DEIRDRE Officer 2 ⋯
6 │ ADAMS KATHERINE L General Counsel Sale at price 138.44 - 142.93 pe… 2
7 │ O'BRIEN DEIRDRE Officer Sale at price 141.09 - 142.83 pe… 2
⋮ │ ⋮ ⋮ ⋮ ⋱
70 │ WAGNER SUSAN L Director 2
71 │ JUNG ANDREA Director 2 ⋯
72 │ BELL JAMES A Director 2
73 │ LOZANO MONICA C. Director 2
74 │ GORE ALBERT A JR Director 2
75 │ ADAMS KATHERINE L General Counsel Sale at price 131.79 - 134.56 pe… 2 ⋯
4 columns and 62 rows omitted
YFinance.get_institutional_ownership
— Methodget_institutional_ownership(quoteSummary::JSON3.Object)
Retrievs the institutional ownership from the quote summary.
Arguments
Can be either a JSON3.Object
returned from get_quoteSummary(symbol::String; item=nothing,throw_error=false)
or a ticker symbol of type AbstractString
If a ticker symbol is provided get_quoteSummary(symbol::String)
is called first.
Examples
julia> get_quoteSummary("AAPL") |> get_institutional_ownership
OrderedDict{String, Vector} with 6 entries:
"organization" => ["Vanguard Group, Inc. (The)", "Blackrock Inc.", "Berkshire Hathaway,…
"reportDate" => Union{Missing, DateTime}[DateTime("2022-09-30T00:00:00"), DateTime("2…
"pctHeld" => Union{Missing, Float64}[0.08, 0.0641, 0.0562, 0.0372, 0.0221, 0.0176,…
"position" => Union{Missing, Int64}[1272378901, 1020245185, 894802319, 591543874, 3…
"value" => Union{Missing, Int64}[164913030135, 132233979050, 115975329111, 76670…
"pctChange" => Union{Missing, Float64}[-0.0039, -0.0082, 0.0, -0.0111, 0.0191, 0.005…
julia> get_institutional_ownership("AAPL")
OrderedDict{String, Vector} with 6 entries:
"organization" => ["Vanguard Group, Inc. (The)", "Blackrock Inc.", "Berkshire Hathaway,…
"reportDate" => Union{Missing, DateTime}[DateTime("2022-09-30T00:00:00"), DateTime("2…
"pctHeld" => Union{Missing, Float64}[0.08, 0.0641, 0.0562, 0.0372, 0.0221, 0.0176,…
"position" => Union{Missing, Int64}[1272378901, 1020245185, 894802319, 591543874, 3…
"value" => Union{Missing, Int64}[164913030135, 132233979050, 115975329111, 76670…
"pctChange" => Union{Missing, Float64}[-0.0039, -0.0082, 0.0, -0.0111, 0.0191, 0.005…
julia> using DataFrames
julia> get_institutional_ownership("AAPL") |> DataFrame
10×6 DataFrame
Row │ organization reportDate pctHeld position value ⋯
│ String DateTime? Float64? Int64? Int64? ⋯
─────┼────────────────────────────────────────────────────────────────────────────────────
1 │ Vanguard Group, Inc. (The) 2022-09-30T00:00:00 0.08 1272378901 1649130 ⋯
2 │ Blackrock Inc. 2022-09-30T00:00:00 0.0641 1020245185 1322339
3 │ Berkshire Hathaway, Inc 2022-09-30T00:00:00 0.0562 894802319 1159753
4 │ State Street Corporation 2022-09-30T00:00:00 0.0372 591543874 766700
5 │ FMR, LLC 2022-09-30T00:00:00 0.0221 350900116 454801 ⋯
6 │ Geode Capital Management, LLC 2022-09-30T00:00:00 0.0176 279758518 362595
7 │ Price (T.Rowe) Associates Inc 2022-09-30T00:00:00 0.0141 224863541 291445
8 │ Morgan Stanley 2022-09-30T00:00:00 0.0115 182728771 236834
9 │ Northern Trust Corporation 2022-09-30T00:00:00 0.0111 176084862 228223 ⋯
10 │ Bank of America Corporation 2022-09-30T00:00:00 0.0089 142260591 184383
2 columns omitted
YFinance.get_major_holders_breakdown
— Methodget_major_holders_breakdown(quoteSummary::JSON3.Object)
Retrievs the breakdown of the major holders from the quote summary.
Arguments
Can be either a JSON3.Object
returned from get_quoteSummary(symbol::String; item=nothing,throw_error=false)
or a ticker symbol of type AbstractString
If a ticker symbol is provided get_quoteSummary(symbol::String)
is called first.
Examples
julia> get_quoteSummary("AAPL") |> get_major_holders_breakdown
OrderedDict{String, Real} with 4 entries:
"insidersPercentHeld" => 0.00072
"institutionsPercentHeld" => 0.60915
"institutionsFloatPercentHeld" => 0.60959
"institutionsCount" => 5526
julia> get_major_holders_breakdown("AAPL")
OrderedDict{String, Real} with 4 entries:
"insidersPercentHeld" => 0.00072
"institutionsPercentHeld" => 0.60915
"institutionsFloatPercentHeld" => 0.60959
"institutionsCount" => 5526
YFinance.get_prices
— Methodget_prices(symbol::String; range::String="5d", interval::String="1d", startdt::Union{Date,DateTime,AbstractString}="", enddt::Union{Date,DateTime,AbstractString}="", prepost::Bool=false, autoadjust::Bool=true, timeout::Int=10, throw_error::Bool=false, exchange_local_time::Bool=false, divsplits::Bool=false, wait::Float64=0.0)
Retrieves prices from Yahoo Finance.
Arguments
symbol
: A ticker (e.g., AAPL for Apple Inc., or ^GSPC for the S&P 500)
You can either provide a range
or both startdt
and enddt
.
range
: A string specifying the time range. It can be one of the predefined values ("ytd", "max") or a custom range using the following suffixes:- "m" for minutes (e.g., "30m" for 30 minutes)
- "d" for days (e.g., "7d" for 7 days)
- "mo" for months (e.g., "3mo" for 3 months)
- "y" for years (e.g., "1y" for 1 year)
startdt
andenddt
: Can be of typeDate
,DateTime
, or aString
in the format "yyyy-mm-dd". Both must be provided if one is specified.interval
: The data interval. Valid values are "1m", "2m", "5m", "15m", "30m", "60m", "90m", "1h", "1d", "5d", "1wk", "1mo", "3mo". Defaults to "1d".prepost
: Boolean indicating whether pre and post market data should be included. Defaults tofalse
.autoadjust
: Defaults totrue
. Adjusts open, high, low, close prices, and volume by multiplying by the ratio between the close and the adjusted close prices - only available for intervals of 1d and up.timeout
: The timeout for the HTTP request in seconds. Defaults to 10.throw_error
: Boolean, defaults tofalse
. If set to true, the function raises an error when the ticker is not valid or other issues occur. If false, a warning is given and an emptyOrderedDict
is returned.exchange_local_time
: Boolean, defaults tofalse
. If set to true, the timestamp corresponds to the exchange local time; otherwise, it's in GMT.divsplits
: Boolean, defaults tofalse
. If set to true, dividends and stock split data are also returned. Split data contains the numerator, denominator, and split ratio. The interval needs to be set to "1d" for this to work.wait
: Float, defaults to 0.0. Specifies the wait time in seconds between consecutive API calls when fetching minute data over extended periods.
Notes
- For minute data requests over periods longer than 7 days, the function automatically splits the request into multiple 7-day chunks and combines the results.
- When using
startdt
andenddt
, both must be provided.
Returns
An OrderedDict{String, Union{String,Vector{DateTime},Vector{Float64}}}
containing the requested data.
Examples
julia> get_prices("AAPL", range="1d", interval="90m")
OrderedDict{String, Union{String,Vector{DateTime},Vector{Float64}}} with 7 entries:
"ticker" => "AAPL"
"timestamp" => [DateTime("2022-12-29T14:30:00"), DateTime("2022-12-29T16:00:00"), DateTime("2022-12-29T17:30:00"), DateTime("2022-12-29T19:00:00"), DateTime("2022-12-29T20:30:00"), DateTime("2022-12-29T21:00:00")]
"open" => [127.99, 129.96, 129.992, 130.035, 129.95, 129.61]
"high" => [129.98, 130.481, 130.098, 130.24, 130.22, 129.61]
"low" => [127.73, 129.44, 129.325, 129.7, 129.56, 129.61]
"close" => [129.954, 129.998, 130.035, 129.95, 129.6, 129.61]
"vol" => [2.9101646e7, 1.4058713e7, 9.897737e6, 9.552323e6, 6.308537e6, 0.0]
## Can be easily converted to a DataFrame
julia> using DataFrames
julia> get_prices("AAPL", range="1d", interval="90m") |> DataFrame
6×7 DataFrame
Row │ ticker timestamp open high low close vol
│ String DateTime Float64 Float64 Float64 Float64 Float64
─────┼────────────────────────────────────────────────────────────────────────────
1 │ AAPL 2022-12-29T14:30:00 127.99 129.98 127.73 129.954 2.9101646e7
2 │ AAPL 2022-12-29T16:00:00 129.96 130.481 129.44 129.998 1.4058713e7
3 │ AAPL 2022-12-29T17:30:00 129.992 130.098 129.325 130.035 9.897737e6
4 │ AAPL 2022-12-29T19:00:00 130.035 130.24 129.7 129.95 9.552323e6
5 │ AAPL 2022-12-29T20:30:00 129.95 130.22 129.56 129.6 6.308537e6
6 │ AAPL 2022-12-29T21:00:00 129.61 129.61 129.61 129.61 0.0
## Broadcasting
julia> get_prices.(["AAPL","NFLX"], range="1d", interval="90m")
2-element Vector{OrderedDict{String, Union{String, Vector{DateTime}, Vector{Float64}}}}:
OrderedDict{String, Union{String, Vector{DateTime}, Vector{Float64}}} with 7 entries:
"ticker" => "AAPL"
"timestamp" => [DateTime("2022-12-29T14:30:00"), DateTime("2022-12-29T16:00:00"), DateTime("2022-12-29T17:30:00"), DateTime("2022-12-29T19:00:00"), DateTime("2022-12-29T20:30:00"), DateTime("2022-12-29T21:00:00")]
"open" => [127.98999786376953, 129.9600067138672, 129.99240112304688, 130.03500366210938, 129.9499969482422, 129.61000061035156]
"high" => [129.97999572753906, 130.4813995361328, 130.09829711914062, 130.24000549316406, 130.22000122070312, 129.61000061035156]
"low" => [127.7300033569336, 129.44000244140625, 129.3249969482422, 129.6999969482422, 129.55999755859375, 129.61000061035156]
"close" => [129.95419311523438, 129.99830627441406, 130.03500366210938, 129.9499969482422, 129.60000610351562, 129.61000061035156]
"vol" => [2.9101646e7, 1.4058713e7, 9.897737e6, 9.552323e6, 6.308537e6, 0.0]
OrderedDict{String, Union{String, Vector{DateTime}, Vector{Float64}}} with 7 entries:
"ticker" => "NFLX"
"timestamp" => [DateTime("2022-12-29T14:30:00"), DateTime("2022-12-29T16:00:00"), DateTime("2022-12-29T17:30:00"), DateTime("2022-12-29T19:00:00"), DateTime("2022-12-29T20:30:00"), DateTime("2022-12-29T21:00:00")]
"open" => [283.17999267578125, 289.5199890136719, 293.4200134277344, 290.05499267578125, 290.760009765625, 291.1199951171875]
"high" => [291.8699951171875, 295.4999084472656, 293.5, 291.32000732421875, 292.3299865722656, 291.1199951171875]
"low" => [281.010009765625, 289.489990234375, 289.5400085449219, 288.7699890136719, 290.5400085449219, 291.1199951171875]
"close" => [289.5199890136719, 293.46990966796875, 290.04998779296875, 290.82000732421875, 291.1199951171875, 291.1199951171875]
"vol" => [2.950791e6, 2.458057e6, 1.362915e6, 1.212217e6, 1.121821e6, 0.0]
## Converting it to a DataFrame:
julia> using DataFrames
julia> data = get_prices.(["AAPL","NFLX"], range="1d", interval="90m");
julia> vcat([DataFrame(i) for i in data]...)
12×7 DataFrame
Row │ ticker timestamp open high low close vol
│ String DateTime Float64 Float64 Float64 Float64 Float64
─────┼────────────────────────────────────────────────────────────────────────────
1 │ AAPL 2022-12-29T14:30:00 127.99 129.98 127.73 129.954 2.9101646e7
2 │ AAPL 2022-12-29T16:00:00 129.96 130.481 129.44 129.998 1.4058713e7
3 │ AAPL 2022-12-29T17:30:00 129.992 130.098 129.325 130.035 9.897737e6
4 │ AAPL 2022-12-29T19:00:00 130.035 130.24 129.7 129.95 9.552323e6
5 │ AAPL 2022-12-29T20:30:00 129.95 130.22 129.56 129.6 6.308537e6
6 │ AAPL 2022-12-29T21:00:00 129.61 129.61 129.61 129.61 0.0
7 │ NFLX 2022-12-29T14:30:00 283.18 291.87 281.01 289.52 2.950791e6
8 │ NFLX 2022-12-29T16:00:00 289.52 295.5 289.49 293.47 2.458057e6
9 │ NFLX 2022-12-29T17:30:00 293.42 293.5 289.54 290.05 1.362915e6
10 │ NFLX 2022-12-29T19:00:00 290.055 291.32 288.77 290.82 1.212217e6
11 │ NFLX 2022-12-29T20:30:00 290.76 292.33 290.54 291.12 1.121821e6
12 │ NFLX 2022-12-29T21:00:00 291.12 291.12 291.12 291.12 0.0
YFinance.get_quoteSummary
— Methodget_quoteSummary(symbol::String; item=nothing)
Retrievs general information from Yahoo Finance stored in a JSON3 object.
Arguments
smybol
::String
is a ticker (e.g. AAPL for Apple Computers, or ^GSPC for the S&P500)item can either be a string or multiple items as a
Vector
ofStrings
. To see valid items call_QuoteSummary_Items
(not all items are available for all types of securities)throw_error
::Bool
defaults tofalse
. If set to true the function errors when the ticker is not valid. Else a warning is given and an emptyJSON3.Object
is returned.
Examples
julia> get_quoteSummary("AAPL")
JSON3.Object{Vector{UInt8}, SubArray{UInt64, 1, Vector{UInt64}, Tuple{UnitRange{Int64}}, true}} with 31 entries:
:assetProfile => {…
:recommendationTrend => {…
:cashflowStatementHistory => {…
⋮ => ⋮
julia> get_quoteSummary("AAPL",item = "quoteType")
JSON3.Object{Vector{UInt8}, SubArray{UInt64, 1, Vector{UInt64}, Tuple{UnitRange{Int64}}, true}} with 13 entries:
:exchange => "NMS"
:quoteType => "EQUITY"
:symbol => "AAPL"
⋮ => ⋮
YFinance.get_recommendation_trend
— Methodget_recommendation_trend(quoteSummary::JSON3.Object)
Retrievs the recommendation trend from the quote summary.
Arguments
Can be either a JSON3.Object
returned from get_quoteSummary(symbol::String; item=nothing,throw_error=false)
or a ticker symbol of type AbstractString
If a ticker symbol is provided get_quoteSummary(symbol::String)
is called first.
Examples
julia> get_quoteSummary("AAPL") |> get_recommendation_trend
OrderedDict{String, Vector} with 6 entries:
"period" => ["0m", "-1m", "-2m", "-3m"]
"strongbuy" => [11, 11, 11, 13]
"buy" => [21, 25, 26, 20]
"hold" => [6, 6, 5, 8]
"sell" => [0, 1, 1, 0]
"strongsell" => [0, 0, 0, 0]
julia> get_recommendation_trend("AAPL")
OrderedDict{String, Vector} with 6 entries:
"period" => ["0m", "-1m", "-2m", "-3m"]
"strongbuy" => [11, 11, 11, 13]
"buy" => [21, 25, 26, 20]
"hold" => [6, 6, 5, 8]
"sell" => [0, 1, 1, 0]
"strongsell" => [0, 0, 0, 0]
julia> using DataFrames
julia> get_recommendation_trend("AAPL") |> DataFrame
4×6 DataFrame
Row │ period strongbuy buy hold sell strongsell
│ String Int64 Int64 Int64 Int64 Int64
─────┼────────────────────────────────────────────────────
1 │ 0m 11 21 6 0 0
2 │ -1m 11 25 6 1 0
3 │ -2m 11 26 5 1 0
4 │ -3m 13 20 8 0 0
YFinance.get_sector_industry
— Methodget_sector_industry(quoteSummary::JSON3.Object)
Retrievs the Sector and Industry from the quote summary.
Arguments
Can be either a JSON3.Object
returned from get_quoteSummary(symbol::String; item=nothing,throw_error=false)
or a ticker symbol of type AbstractString
If a ticker symbol is provided get_quoteSummary(symbol::String)
is called first.
Examples
julia> get_quoteSummary("AAPL") |> get_sector_industry
OrderedDict{String, String} with 2 entries:
"sector" => "Technology"
"industry" => "Consumer Electronics"
julia> get_sector_industry("AAPL")
OrderedDict{String, String} with 2 entries:
"sector" => "Technology"
"industry" => "Consumer Electronics"
YFinance.get_splits
— Methodget_splits(symbol::String; startdt::Union{Date,DateTime,AbstractString}="", enddt::Union{Date,DateTime,AbstractString}="", timeout::Int=10, throw_error::Bool=false, exchange_local_time::Bool=false)
Retrieves stock split data from Yahoo Finance.
Arguments
symbol
: A ticker (e.g., AAPL for Apple Inc., or ^GSPC for the S&P 500)startdt
andenddt
: Optional. Can be of typeDate
,DateTime
, or aString
in the format "yyyy-mm-dd". If not provided,startdt
defaults to the earliest available data andenddt
to the current date.timeout
: Integer, defaults to 10. The timeout for the HTTP request in seconds.throw_error
: Boolean, defaults tofalse
. If set to true, the function raises an error when the ticker is not valid or other issues occur. If false, a warning is given and an emptyOrderedDict
is returned.exchange_local_time
: Boolean, defaults tofalse
. If set to true, the timestamp corresponds to the exchange local time; otherwise, it's in GMT.
Returns
An OrderedDict{String, Union{String,Vector{DateTime},Vector{Int},Vector{Float64}}}
containing the requested split data.
Examples
julia> get_splits("AAPL", startdt = "2000-01-01", enddt = "2020-01-01")
OrderedDict{String, Union{String,Vector{DateTime},Vector{Int},Vector{Float64}}} with 5 entries:
"ticker" => "AAPL"
"timestamp" => [DateTime("2000-06-21T13:30:00"), DateTime("2005-02-28T14:30:00"), DateTime("2014-06-09T13:30:00")]
"numerator" => [2, 2, 7]
"denominator" => [1, 1, 1]
"ratio" => [2.0, 2.0, 7.0]
## Can be easily converted to a DataFrame
julia> using DataFrames
julia> get_splits("AAPL", startdt = "2000-01-01", enddt = "2020-01-01") |> DataFrame
3×5 DataFrame
Row │ ticker timestamp numerator denominator ratio
│ String DateTime Int64 Int64 Float64
─────┼──────────────────────────────────────────────────────────────
1 │ AAPL 2000-06-21T13:30:00 2 1 2.0
2 │ AAPL 2005-02-28T14:30:00 2 1 2.0
3 │ AAPL 2014-06-09T13:30:00 7 1 7.0
## Broadcasting
julia> get_splits.(["AAPL", "F"], startdt = "2000-01-01", enddt = "2020-01-01")
2-element Vector{OrderedDict{String, Union{String,Vector{DateTime},Vector{Int},Vector{Float64}}}}:
OrderedDict("ticker" => "AAPL", "timestamp" => [DateTime("2000-06-21T13:30:00"), DateTime("2005-02-28T14:30:00"), DateTime("2014-06-09T13:30:00")], "numerator" => [2, 2, 7], "denominator" => [1, 1, 1], "ratio" => [2.0, 2.0, 7.0])
OrderedDict("ticker" => "F", "timestamp" => [DateTime("2000-06-29T13:30:00"), DateTime("2000-08-03T13:30:00")], "numerator" => [10000, 1748175], "denominator" => [9607, 1000000], "ratio" => [1.0409076714895389, 1.748175])
## Converting it to a DataFrame:
julia> using DataFrames
julia> data = get_splits.(["AAPL", "F"], startdt = "2000-01-01", enddt = "2020-01-01");
julia> vcat([DataFrame(i) for i in data]...)
5×5 DataFrame
Row │ ticker timestamp numerator denominator ratio
│ String DateTime Int64 Int64 Float64
─────┼──────────────────────────────────────────────────────────────
1 │ AAPL 2000-06-21T13:30:00 2 1 2.0
2 │ AAPL 2005-02-28T14:30:00 2 1 2.0
3 │ AAPL 2014-06-09T13:30:00 7 1 7.0
4 │ F 2000-06-29T13:30:00 10000 9607 1.04091
5 │ F 2000-08-03T13:30:00 1748175 1000000 1.74818
YFinance.get_summary_detail
— Methodget_summary_detail(quoteSummary::JSON3.Object)
Retrievs the summaryDetail Item from the quote summary.
Arguments
Can be either a JSON3.Object
returned from get_quoteSummary(symbol::String; item=nothing,throw_error=false)
or a ticker symbol of type AbstractString
If a ticker symbol is provided get_quoteSummary(symbol::String)
is called first.
Examples
julia> get_quoteSummary("AAPL") |> get_summary_detail
OrderedDict{String, Any} with 41 entries:
"priceHint" => 2
"previousClose" => 126.04
"open" => 127.99
"dayLow" => 127.815
"dayHigh" => 130.48
"regularMarketPreviousClose" => 126.04
"regularMarketOpen" => 127.99
"regularMarketDayLow" => 127.815
"regularMarketDayHigh" => 130.48
"dividendRate" => 0.92
"dividendYield" => 0.0073
"exDividendDate" => 1667520000
"payoutRatio" => 0.1473
"fiveYearAvgDividendYield" => 0.99
"beta" => 1.21947
"trailingPE" => 21.2128
"forwardPE" => 19.1448
⋮ => ⋮
julia> get_summary_detail("AAPL")
OrderedDict{String, Any} with 41 entries:
"priceHint" => 2
"previousClose" => 126.04
"open" => 127.99
"dayLow" => 127.815
"dayHigh" => 130.48
"regularMarketPreviousClose" => 126.04
"regularMarketOpen" => 127.99
"regularMarketDayLow" => 127.815
"regularMarketDayHigh" => 130.48
"dividendRate" => 0.92
"dividendYield" => 0.0073
"exDividendDate" => 1667520000
"payoutRatio" => 0.1473
"fiveYearAvgDividendYield" => 0.99
"beta" => 1.21947
"trailingPE" => 21.2128
"forwardPE" => 19.1448
⋮ => ⋮
YFinance.get_symbols
— Methodget_symbols(search_term::String)
Allows searches for specific securities.
Arguments
search_term::String
: Typically a company/security name (e.g. microsoft)
Returns
- A
YahooSearch <: AbstractArray
containingYahooSearchItem
s containing the following fields: symbol::String
, shortname::String
, exchange::String
, quoteType::String
, sector::String
, industry::String
Example
julia> get_symbols("micro")
7-element YahooSearch{YahooSearchItem, 1}:
Symbol: MGC=F
Name: Micro Gold Futures,Jun-2023
Type: FUTURE
Exch.: New York Commodity Exchange (CMX)
Symbol: MSFT
Name: Microsoft Corporation
Type: EQUITY
Exch.: NASDAQ (NMS)
Sec.: Technology
Ind.: Software—Infrastructure
Symbol: AMD
Name: Advanced Micro Devices, Inc.
Type: EQUITY
Exch.: NASDAQ (NMS)
Sec.: Technology
Ind.: Semiconductors
Symbol: MU
Name: Micron Technology, Inc.
Type: EQUITY
Exch.: NASDAQ (NMS)
Sec.: Technology
Ind.: Semiconductors
Symbol: MSTR
Name: MicroStrategy Incorporated
Type: EQUITY
Exch.: NASDAQ (NMS)
Sec.: Technology
Ind.: Software—Application
Symbol: SMCI
Name: Super Micro Computer, Inc.
Type: EQUITY
Exch.: NASDAQ (NMS)
Sec.: Technology
Ind.: Computer Hardware
Symbol: FNGU
Name: MicroSectors FANG Index 3X Lev
Type: ETF
Exch.: NYSEArca (PCX)
YFinance.get_upgrade_downgrade_history
— Methodget_upgrade_downgrade_history(quoteSummary::JSON3.Object)
Retrievs the upgrade and downgrade history from the quote summary.
Arguments
Can be either a JSON3.Object
returned from get_quoteSummary(symbol::String; item=nothing,throw_error=false)
or a ticker symbol of type AbstractString
If a ticker symbol is provided get_quoteSummary(symbol::String)
is called first.
Examples
julia> get_quoteSummary("AAPL") |> get_upgrade_downgrade_history
OrderedDict{String, Vector} with 5 entries:
"firm" => ["JP Morgan", "UBS", "Morgan Stanley", "B of A Securities", "Barclays", …
"date" => Union{Missing, DateTime}[DateTime("2022-12-20T11:47:33"), DateTime("2022…
"toGrade" => Union{Missing, String}["Overweight", "Buy", "Overweight", "Neutral", "Eq…
"fromGrade" => Union{Missing, String}["", "", "", "", "", "", "", "", "", "" … "", ""…
"action" => Union{Missing, String}["main", "main", "main", "main", "main", "main", "…
julia> get_upgrade_downgrade_history("AAPL")
OrderedDict{String, Vector} with 5 entries:
"firm" => ["JP Morgan", "UBS", "Morgan Stanley", "B of A Securities", "Barclays", …
"date" => Union{Missing, DateTime}[DateTime("2022-12-20T11:47:33"), DateTime("2022…
"toGrade" => Union{Missing, String}["Overweight", "Buy", "Overweight", "Neutral", "Eq…
"fromGrade" => Union{Missing, String}["", "", "", "", "", "", "", "", "", "" … "", ""…
"action" => Union{Missing, String}["main", "main", "main", "main", "main", "main", "…
julia> using DataFrames
julia> get_upgrade_downgrade_history("AAPL") |> DataFrame
872×5 DataFrame
Row │ firm date toGrade fromGrade action
│ String DateTime? String? String? String?
─────┼──────────────────────────────────────────────────────────────────────────
1 │ JP Morgan 2022-12-20T11:47:33 Overweight main
2 │ UBS 2022-11-08T12:17:03 Buy main
3 │ Morgan Stanley 2022-11-08T12:14:23 Overweight main
4 │ B of A Securities 2022-11-07T13:08:30 Neutral main
5 │ Barclays 2022-11-07T12:39:27 Equal-Weight main
6 │ Wedbush 2022-10-28T13:19:17 Outperform main
7 │ Credit Suisse 2022-10-28T11:59:30 Outperform main
⋮ │ ⋮ ⋮ ⋮ ⋮ ⋮
867 │ Oxen Group 2012-03-14T15:25:00 Buy init
868 │ Canaccord Genuity 2012-03-14T08:21:00 Buy main
869 │ Morgan Stanley 2012-03-14T06:13:00 Overweight main
870 │ Jefferies 2012-03-13T06:08:00 Buy main
871 │ FBN Securities 2012-03-08T07:33:00 Outperform main
872 │ Canaccord Genuity 2012-02-09T08:17:00 Buy main
859 rows omitted
YFinance.get_valid_symbols
— Methodget_valid_symbols(symbol::AbstractString)
Takes a symbol. If the symbol is valid it returns the symbol in a vector if not it returns and empy vector.
Arguments
- smybol
::AbstractString
is a ticker (e.g. AAPL for Apple Computers, or ^GSPC for the S&P500)
Examples
julia> get_valid_symbols("AAPL")
1-element Vector{String}:
"AAPL"
julia> get_valid_symbols("asdfs")
String[]
YFinance.get_valid_symbols
— Methodget_valid_symbols(symbol::AbstractVector{<:AbstractString})
Takes a AbstractVector
of symbols and returns only the valid ones.
Arguments
- smybol
::AbstractVector{<:AbstractString}
is a vector of tickers (e.g. AAPL for Apple Computers, or ^GSPC for the S&P500)
Examples
julia> get_valid_symbols("AAPL","AMD","asdfs")
2-element Vector{String}:
"AAPL"
"AMD"
YFinance.links
— Methodlinks(x::YahooNews)
Returns the links of all NewsItem
s in a Vector
Arugments:
- x
::YahooNews
Returns:
Vector{String}
Example:
julia> x = search_news("MSFT");
julia> links(x)
8-element Vector{String}:
"https://finance.yahoo.com/news/" ⋯ 20 bytes ⋯ "itter-ad-program-221121298.html"
"https://finance.yahoo.com/m/06a" ⋯ 37 bytes ⋯ "chatbots-guzzle-water.-how.html"
"https://finance.yahoo.com/m/65b" ⋯ 36 bytes ⋯ "st-dow-jones-stocks-to-buy.html"
"https://finance.yahoo.com/m/9c4" ⋯ 35 bytes ⋯ "op-companies-for-financial.html"
"https://finance.yahoo.com/m/ebf" ⋯ 35 bytes ⋯ "ideo%3A-your-top-questions.html"
"https://finance.yahoo.com/news/board-oks-microsoft-data-center-163630944.html"
"https://finance.yahoo.com/news/" ⋯ 20 bytes ⋯ "-workplace-where-155427039.html"
"https://finance.yahoo.com/news/microsoft-working-space-time-add-150000132.html"
YFinance.search_news
— Methodsearch_news(str::String;lang="en-us")
Returns news related to the seach string str
.
Arugments:
- str
::String
: The search string. It is usually a symbol. - lang
::String
: The search language and region. The region is automatically set according to the language. Supported languages are: "en-us", "en-ca", "en-gb", "en-au", "en-nz", "en-SG", "en-in", "de", "es", "fr", "it", "pt-br", "zh", and "zh-tw".
Returns:
YahooNews <: AbstractArray
that containsNewsItem
s with fields: title::String
, publisher::String
, link::String
, timestamp::DateTime
, symbols::Array{String,1}
Example:
julia> search_news("MSFT")
8-element YahooNews{NewsItem, 1}:
Title: Microsoft Removes Twitter From Ad Program; Musk Threatens Suit
Timestamp: Apr 19 22:11 PM
Publisher: Bloomberg
Link: https://finance.yahoo.com/news/microsoft-removes-twitter-ad-program-221121298.html
Symbols: MSFT
Title: AI ChatBots Guzzle Water. How and Why It’s a Problem.
Timestamp: Apr 19 20:33 PM
Publisher: Barrons.com
Link: https://finance.yahoo.com/m/06a973de-215d-3928-9c99-00867b512966/ai-chatbots-guzzle-water.-how.html
Symbols: GOOGL, MSFT
Title: Best Dow Jones Stocks To Buy And Watch In April: Travelers Surges On Earnings
Timestamp: Apr 19 18:06 PM
Publisher: Investor's Business Daily
Link: https://finance.yahoo.com/m/65b53896-faf4-3a06-9d0d-a63cf3c83192/best-dow-jones-stocks-to-buy.html
Symbols: ^DJI, MSFT
Title: Top Companies for Financial Strength
Timestamp: Apr 19 18:03 PM
Publisher: The Wall Street Journal
Link: https://finance.yahoo.com/m/9c4f6782-7ce7-3e1e-8d0a-ff7f41bc5ef7/top-companies-for-financial.html
Symbols: XOM, MSFT, AAPL, NUE, MRNA
Title: VIDEO: Your Top Questions Answered on the Debt Ceiling and Portfolio Management
Timestamp: Apr 19 16:46 PM
Publisher: TheStreet.com
Link: https://finance.yahoo.com/m/ebf41ba6-6cbc-38ce-93c5-bcee152080e7/video%3A-your-top-questions.html
Symbols: CHPT, MSFT
Title: Microsoft agrees to buy 50m Foxconn parcel in Wisconsin
Timestamp: Apr 19 16:36 PM
Publisher: AP Finance
Link: https://finance.yahoo.com/news/board-oks-microsoft-data-center-163630944.html
Symbols: MSFT
Title: LinkedIn Reveals Top Workplace: Where Amazon and Netflix Rank For Happy Employees
Timestamp: Apr 19 15:54 PM
Publisher: Benzinga
Link: https://finance.yahoo.com/news/linkedin-reveals-top-workplace-where-155427039.html
Symbols: AMZN, GOOGL, MSFT, NFLX, WFC
Title: Microsoft Working With Space and Time to Add Real-Time Blockchain Data for Azure Cloud
Timestamp: Apr 19 15:00 PM
Publisher: CoinDesk
Link: https://finance.yahoo.com/news/microsoft-working-space-time-add-150000132.html
Symbols: MSFT
YFinance.sink_prices_to
— Methodsink_prices_to(::Type{OrderedDict},x::OrderedDict{String,Any})
Converts an exisitng OrderedDict output from get_prices to an OrderedDict If TimeSeries.jl or TSFrames.jl are loaded this function is extended to allow sinking into these types.
YFinance.timestamps
— Methodtimestamps(x::YahooNews)
Returns the timestamp of all NewsItem
s in a Vector
Arugments:
- x
::YahooNews
Returns:
Vector{DateTime}
Example:
julia> x = search_news("MSFT");
julia> timestamps(x)
8-element Vector{Dates.DateTime}:
2023-04-19T22:11:21
2023-04-19T20:33:00
2023-04-19T18:06:33
2023-04-19T18:03:00
2023-04-19T16:46:00
2023-04-19T16:36:30
2023-04-19T15:54:27
2023-04-19T15:00:00
YFinance.titles
— Methodtitles(x::YahooNews)
Returns the titles of all NewsItem
s in a Vector
Arugments:
- x
::YahooNews
Returns:
Vector{String}
Example:
julia> x = search_news("MSFT");
julia> titles(x)
8-element Vector{String}:
"Microsoft Removes Twitter From Ad Program; Musk Threatens Suit"
"AI ChatBots Guzzle Water. How and Why It s a Problem."
"Best Dow Jones Stocks To Buy And Watch In April: Travelers Surges On Earnings"
"Top Companies for Financial Strength"
"VIDEO: Your Top Questions Answe" ⋯ 17 bytes ⋯ "eiling and Portfolio Management"
"Microsoft agrees to buy 50m Foxconn parcel in Wisconsin"
"LinkedIn Reveals Top Workplace:" ⋯ 19 bytes ⋯ "etflix Rank For Happy Employees"
"Microsoft Working With Space an" ⋯ 24 bytes ⋯ "Blockchain Data for Azure Cloud"
YFinance.validate_symbol
— Methodvalidate_symbol(symbol::AbstractString)
Validates a Symbol (Ticker). Returns true
if the ticker is valid and false
if the ticker is not valid.
Arguments
- smybol
::String
is a ticker (e.g. AAPL for Apple Computers, or ^GSPC for the S&P500)
How it works
Checks if the HTTP request works (status 200) or whether the request errors (common status in this case: 404)