All Functions

YFinance.get_ESGMethod
get_ESG(symbol::String)

Retrievs ESG Scores from Yahoo Finance stored in a Dictionary 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 to false. If set to true the function errors when the ticker is not valid. Else a warning is given and an empty dictionary is returned.

Examples

julia> get_ESG("AAPL")
Dict{String, Dict{String, Any}} with 2 entries:
"peer_score" => Dict("governanceScore"=>Union{Missing, Float64}[63.2545, 63.454…  
"score"      => Dict("governanceScore"=>Union{Missing, Real}[62, 62, 62, 62, 62… 

julia> using DataFrames
julia> get_ESG("AAPL")["score"] |> DataFrame
96×6 DataFrame
Row │ environmentScore  esgScore    governanceScore  socialScore  symbol  times ⋯
    │ Real?             Real?       Real?            Real?        String  DateT ⋯
────┼────────────────────────────────────────────────────────────────────────────
  1 │            74          61               62           45     AAPL    2014- ⋯
  2 │            74          60               62           45     AAPL    2014-  
 ⋮  │        ⋮              ⋮              ⋮              ⋮         ⋮           ⋱
 95 │       missing     missing          missing      missing     AAPL    2022-  
 96 │             0.65       16.68             9.18         6.86  AAPL    2022-  
                                                        1 column and 92 rows omitted
YFinance.get_FundamentalMethod
get_Fundamental(symbol::AbstractString, item::AbstractString,interval::AbstractString, startdt, enddt)

Retrievs financial statement information from Yahoo Finance stored in a Dictionary.

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:"incomestatement", "valuation", "cashflow", "balancesheet". To see valid sub items grouped by financial statement type in a Dictionary call `Fundamental_Types`

  • interval::String can be one of "annual", "quarterly", "monthly"

  • startdt and enddt take the following types: ::Date,::DateTime, or a String of the following form yyyy-mm-dd

  • throw_error::Bool defaults to false. If set to true the function errors when the ticker is not valid. Else a warning is given and an empty dictionary is returned.

Examples

julia> get_Fundamental("NFLX", "income_statement","quarterly","2000-01-01","2022-12-31")

Dict{String, Any} with 39 entries:
"NetNonOperatingInterestIncomeExpense" => Any[-94294000, -80917000, 8066000, 44771000, 88829000]
"NetInterestIncome"                    => Any[-94294000, -80917000, 8066000, 44771000, 88829000]
"InterestExpense"                      => Any[190429000, 189429000, 187579000, 175455000, 172575000]
⋮                                      => ⋮

julia> using DataFrames
julia> get_Fundamental("AAPL", "InterestExpense","quarterly","2000-01-01","2022-12-31") |> DataFrame
5×2 DataFrame
Row │ InterestExpense  timestamp
    │ Any              DateTime
────┼──────────────────────────────────────
  1 │ 672000000        2021-09-30T00:00:00 
  2 │ 694000000        2021-12-31T00:00:00
  3 │ 691000000        2022-03-31T00:00:00
  4 │ 719000000        2022-06-30T00:00:00
  5 │ 827000000        2022-09-30T00:00:00
YFinance.get_OptionsMethod
get_Options(symbol::String)

Retrievs options data from Yahoo Finance stored in a Dictionary with two items. One contains Call options the other Put options. These subitems are dictionaries themselves. The call and put options Dictionaries 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 to false. If set to true the function errors when the ticker is not valid. Else a warning is given and an empty dictionary is returned.

Examples

julia> get_Options("AAPL")
Dict{String, Dict{String, Vector{Any}}} with 2 entries:
"calls" => Dict("percentChange"=>[ -2.90804  …   0], "expiration"=>[DateTime("2022-12-09T00:…  
"puts"  => Dict("percentChange"=>[0,  …   0], "expiration"=>[DateTime("2022-12-09T00:00:00"), DateTime("20…

julia> using DataFrames
julia> get_Options("AAPL")["calls"] |> DataFrame
65×16 DataFrame
Row │ ask    bid    change     contractSize  contractSymbol       currency  exp ⋯
    │ Any    Any    Any        Any           Any                  Any       Any ⋯
────┼────────────────────────────────────────────────────────────────────────────
  1 │ 94.3   94.1   0          REGULAR       AAPL221209C00050000  USD       202 ⋯
  2 │ 84.3   84.15  0          REGULAR       AAPL221209C00060000  USD       202  
 ⋮  │   ⋮      ⋮        ⋮           ⋮                 ⋮              ⋮          ⋱  
 64 │ 0.01   0      0          REGULAR       AAPL221209C00240000  USD       202  
 65 │ 0      0      0          REGULAR       AAPL221209C00250000  USD       202  
                                                    10 columns and 61 rows omitted

julia> using DataFrames
julia> data  = get_Options("AAPL")
julia> vcat( [DataFrame(i) for i in values(data)]...)
124×16 DataFrame
Row │ ask    bid    change     contractSize  contractSymbol       cur ⋯
    │ Any    Any    Any        Any           Any                  Any ⋯
────┼──────────────────────────────────────────────────────────────────
  1 │ 94.3   94.1   0          REGULAR       AAPL221209C00050000  USD ⋯
  2 │ 84.55  84.35  0          REGULAR       AAPL221209C00060000  USD  
 ⋮  │   ⋮      ⋮        ⋮           ⋮                 ⋮               ⋱ 
123 │ 75.85  75.15  0          REGULAR       AAPL221209P00220000  USD  
124 │ 85.85  85.15  0          REGULAR       AAPL221209P00230000  USD  
                                        11 columns and 120 rows omitted
YFinance.get_calendar_eventsMethod
get_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
Dict{String, Any} with 3 entries:
  "earnings_dates"  => [DateTime("2023-01-25T10:59:00"), DateTime("2023-01-30T12:00:00")]
  "dividend_date"   => DateTime("2022-11-10T00:00:00")
  "exdividend_date" => DateTime("2022-11-04T00:00:00")

julia> get_calendar_events("AAPL")
Dict{String, Any} with 3 entries:
  "earnings_dates"  => [DateTime("2023-01-25T10:59:00"), DateTime("2023-01-30T12:00:00")]
  "dividend_date"   => DateTime("2022-11-10T00: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_earnings_estimatesMethod
get_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
Dict{String, Vector} with 3 entries:
  "quarter"  => ["4Q2021", "1Q2022", "2Q2022", "3Q2022", "4Q2022"]
  "estimate" => [1.89, 1.43, 1.16, 1.27, 2.01]
  "actual"   => Union{Missing, Float64}[2.1, 1.52, 1.2, 1.29, missing]

julia> get_earnings_estimates("AAPL")
Dict{String, Vector} with 3 entries:
  "quarter"  => ["4Q2021", "1Q2022", "2Q2022", "3Q2022", "4Q2022"]
  "estimate" => [1.89, 1.43, 1.16, 1.27, 2.01]
  "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 │ actual      estimate  quarter 
     │ Float64?    Float64   String  
─────┼───────────────────────────────
   1 │       2.1       1.89  4Q2021
   2 │       1.52      1.43  1Q2022
   3 │       1.2       1.16  2Q2022
   4 │       1.29      1.27  3Q2022
   5 │ missing         2.01  4Q2022
YFinance.get_epsMethod
get_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
Dict{String, Vector} with 4 entries:
  "surprise" => [0.111, 0.063, 0.034, 0.016]
  "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]

julia> get_eps("AAPL")
Dict{String, Vector} with 4 entries:
  "surprise" => [0.111, 0.063, 0.034, 0.016]
  "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]

julia> using DataFrames
julia> get_eps("AAPL") |> DataFrame
4×4 DataFrame
 Row │ actual   estimate  quarter              surprise 
     │ Float64  Float64   DateTime             Float64  
─────┼──────────────────────────────────────────────────
   1 │    2.1       1.89  2021-12-31T00:00:00     0.111
   2 │    1.52      1.43  2022-03-31T00:00:00     0.063
   3 │    1.2       1.16  2022-06-30T00:00:00     0.034
   4 │    1.29      1.27  2022-09-30T00:00:00     0.016
YFinance.get_insider_holdersMethod
get_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
Dict{String, Vector} with 8 entries:
  "name"                 => ["ADAMS KATHERINE L", "BELL JAMES A", "JUNG AND…
  "lastestTransDate"     => Union{Missing, DateTime}[DateTime("2022-10-03T0…
  "positionDirect"       => Union{Missing, Int64}[427334, 34990, 139594, 31…
  "relation"             => Union{Missing, String}["General Counsel", "Dire…
  "positionIndirect"     => Union{Missing, Int64}[missing, missing, missing…
  "description"          => Union{Missing, String}["Sale", "Stock Gift", "C…
  "positionDirectDate"   => Union{Missing, DateTime}[DateTime("2022-10-03T0…
  "positionIndirectDate" => Union{Missing, DateTime}[missing, missing, miss…

julia> get_insider_holders("AAPL")
Dict{String, Vector} with 8 entries:
  "name"                 => ["ADAMS KATHERINE L", "BELL JAMES A", "JUNG AND…
   "lastestTransDate"     => Union{Missing, DateTime}[DateTime("2022-10-03T0…
   "positionDirect"       => Union{Missing, Int64}[427334, 34990, 139594, 31…
   "relation"             => Union{Missing, String}["General Counsel", "Dire…
   "positionIndirect"     => Union{Missing, Int64}[missing, missing, missing…
   "description"          => Union{Missing, String}["Sale", "Stock Gift", "C…
   "positionDirectDate"   => Union{Missing, DateTime}[DateTime("2022-10-03T0…
   "positionIndirectDate" => Union{Missing, DateTime}[missing, missing, miss…

julia> using DataFrames
julia> get_insider_holders("AAPL") |> DataFrame
10×8 DataFrame
 Row │ description                        lastestTransDate     name        ⋯
     │ String?                            DateTime?            String      ⋯
─────┼──────────────────────────────────────────────────────────────────────
   1 │ Sale                               2022-10-03T00:00:00  ADAMS KATHE ⋯
   2 │ Stock Gift                         2022-05-06T00:00:00  BELL JAMES   
   3 │ Conversion of Exercise of deriva…  2022-02-01T00:00:00  JUNG ANDREA  
   4 │ Sale                               2022-11-22T00:00:00  KONDO CHRIS  
   5 │ Sale                               2022-02-01T00:00:00  LEVINSON AR ⋯
   6 │ Sale                               2022-10-28T00:00:00  MAESTRI LUC  
   7 │ Sale                               2022-10-17T00:00:00  O'BRIEN DEI  
   8 │ Conversion of Exercise of deriva…  2022-02-01T00:00:00  SUGAR RONAL  
   9 │ Conversion of Exercise of deriva…  2022-02-01T00:00:00  WAGNER SUSA ⋯
  10 │ Conversion of Exercise of deriva…  2022-09-30T00:00:00  WILLIAMS JE  
                                                           6 columns omitted
YFinance.get_insider_transactionsMethod
get_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
Dict{String, Vector} with 7 entries:
  "shares"          => Union{Missing, Int64}[20200, 176299, 8053, 13136, 16…
  "filerRelation"   => Union{Missing, String}["Officer", "Chief Financial O…
  "transactionText" => Union{Missing, String}["Sale at price 148.72 per sha…
  "filerName"       => ["KONDO CHRISTOPHER", "MAESTRI LUCA", "O'BRIEN DEIRD…
  "ownership"       => Union{Missing, String}["D", "D", "D", "D", "D", "D",…
  "date"            => Union{Missing, DateTime}[DateTime("2022-11-22T00:00:…
  "value"           => Union{Missing, Int64}[3004144, 27493275, 1147150, mi…

julia> get_insider_transactions("AAPL")
Dict{String, Vector} with 7 entries:
  "shares"          => Union{Missing, Int64}[20200, 176299, 8053, 13136, 16…
  "filerRelation"   => Union{Missing, String}["Officer", "Chief Financial O…
  "transactionText" => Union{Missing, String}["Sale at price 148.72 per sha…
  "filerName"       => ["KONDO CHRISTOPHER", "MAESTRI LUCA", "O'BRIEN DEIRD…
  "ownership"       => Union{Missing, String}["D", "D", "D", "D", "D", "D",…
  "date"            => Union{Missing, DateTime}[DateTime("2022-11-22T00:00:…
  "value"           => Union{Missing, Int64}[3004144, 27493275, 1147150, mi…

julia> using DataFrames
julia> get_insider_transactions("AAPL") |> DataFrame
75×7 DataFrame
 Row │ date                 filerName          filerRelation            ⋯
     │ DateTime?            String             String?                  ⋯
─────┼───────────────────────────────────────────────────────────────────
   1 │ 2022-11-22T00:00:00  KONDO CHRISTOPHER  Officer                  ⋯
   2 │ 2022-10-28T00:00:00  MAESTRI LUCA       Chief Financial Officer   
   3 │ 2022-10-17T00:00:00  O'BRIEN DEIRDRE    Officer
  ⋮  │          ⋮                   ⋮                     ⋮             ⋱
  73 │ 2021-02-01T00:00:00  LOZANO MONICA C.   Director
  74 │ 2021-02-01T00:00:00  GORE ALBERT A JR   Director                 ⋯
  75 │ 2021-02-01T00:00:00  ADAMS KATHERINE L  General Counsel
                                            4 columns and 69 rows omitted
YFinance.get_institutional_ownershipMethod
get_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
Dict{String, Vector} with 6 entries:
  "organization" => ["Vanguard Group, Inc. (The)", "Blackrock Inc.", "Be…
  "pctChange"    => Union{Missing, Float64}[-0.0039, -0.0082, 0.0, -0.01…
  "pctHeld"      => Union{Missing, Float64}[0.08, 0.0641, 0.0562, 0.0372…
  "position"     => Union{Missing, Int64}[1272378901, 1020245185, 894802…
  "value"        => Union{Missing, Int64}[180881389225, 145038059235, 12…
  "reportDate"   => Union{Missing, DateTime}[DateTime("2022-09-30T00:00:…

julia> get_institutional_ownership("AAPL")
Dict{String, Vector} with 6 entries:
  "organization" => ["Vanguard Group, Inc. (The)", "Blackrock Inc.", "Be…
  "pctChange"    => Union{Missing, Float64}[-0.0039, -0.0082, 0.0, -0.01…
  "pctHeld"      => Union{Missing, Float64}[0.08, 0.0641, 0.0562, 0.0372…
  "position"     => Union{Missing, Int64}[1272378901, 1020245185, 894802…
  "value"        => Union{Missing, Int64}[180881389225, 145038059235, 12…
  "reportDate"   => Union{Missing, DateTime}[DateTime("2022-09-30T00:00:…

julia> using DataFrames
julia> get_institutional_ownership("AAPL") |> DataFrame
10×6 DataFrame
 Row │ organization                   pctChange  pctHeld   position     ⋯
     │ String                         Float64?   Float64?  Int64?       ⋯
─────┼───────────────────────────────────────────────────────────────────
   1 │ Vanguard Group, Inc. (The)       -0.0039    0.08    1272378901   ⋯
   2 │ Blackrock Inc.                   -0.0082    0.0641  1020245185    
   3 │ Berkshire Hathaway, Inc           0.0       0.0562   894802319    
  ⋮  │               ⋮                    ⋮         ⋮          ⋮        ⋱
   8 │ Morgan Stanley                    0.0015    0.0115   182728771    
   9 │ Northern Trust Corporation       -0.0208    0.0111   176084862   ⋯
  10 │ Bank of America Corporation      -0.0461    0.0089   142260591    
                                             2 columns and 4 rows omitted
YFinance.get_major_holders_breakdownMethod
get_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
Dict{String, Real} with 4 entries:
  "institutionsCount"            => 5525
  "insidersPercentHeld"          => 0.00072
  "institutionsFloatPercentHeld" => 0.60065
  "institutionsPercentHeld"      => 0.60021

julia> get_major_holders_breakdown("AAPL")
Dict{String, Real} with 4 entries:
  "institutionsCount"            => 5525
  "insidersPercentHeld"          => 0.00072
  "institutionsFloatPercentHeld" => 0.60065
  "institutionsPercentHeld"      => 0.60021
YFinance.get_pricesMethod
get_prices(symbol::AbstractString; range::AbstractString="1mo", interval::AbstractString="1d",startdt="", enddt="",prepost=false,autoadjust=true,timeout = 10,throw_error=false)

Retrievs prices from Yahoo Finance.

Arguments

  • Smybol is a ticker (e.g. AAPL for Apple Computers, or ^GSPC for the S&P500)

You can either provide a range or a startdt and an enddt.

  • range takes the following values: "1d","5d","1mo","3mo","6mo","1y","2y","5y","10y","ytd","max"

  • startdt and enddt take the following types: ::Date,::DateTime, or a String of the following form yyyy-mm-dd

  • prepost is a boolean indicating whether pre and post periods should be included. Defaults to false

  • autoadjust defaults to true. It 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.

  • throw_error::Bool defaults to false. If set to true the function errors when the ticker is not valid. Else a warning is given and an empty dictionary is returned.

  • exchangelocaltime::Bool defaults to false. If set to true the timestamp corresponds to the exchange local time else to GMT.

Examples

julia> get_prices("AAPL",range="1d",interval="90m")
Dict{String, Any} with 7 entries:
"vol"    => [10452686, 0]
"ticker" => "AAPL"
"high"   => [142.55, 142.045]
"open"   => [142.34, 142.045]
"timestamp"     => [DateTime("2022-12-09T14:30:00"), DateTime("2022-12-09T15:08:33")]
"low"    => [140.9, 142.045]
"close"  => [142.28, 142.045]

Can be easily converted to a DataFrame

julia> using DataFrames
julia> get_prices("AAPL",range="1d",interval="90m") |> DataFrame
2×7 DataFrame
Row │ close    timestamp            high     low      open     ticker  vol      
    │ Float64  DateTime             Float64  Float64  Float64  String  Int64    
────┼───────────────────────────────────────────────────────────────────────────
  1 │  142.28  2022-12-09T14:30:00   142.55   140.9    142.34  AAPL    10452686
  2 │  142.19  2022-12-09T15:08:03   142.19   142.19   142.19  AAPL           0

Broadcasting

julia> get_prices.(["AAPL","NFLX"],range="1d",interval="90m")
2-element Vector{Dict{String, Any}}:
Dict(
    "vol" => [11085386, 0], 
    "ticker" => "AAPL", 
    "high" => [142.5500030517578, 142.2949981689453], 
    "open" => [142.33999633789062, 142.2949981689453], 
    "timestamp" => [DateTime("2022-12-09T14:30:00"), DateTime("2022-12-09T15:15:34")], 
    "low" => [140.89999389648438, 142.2949981689453], 
    "close" => [142.27000427246094, 142.2949981689453])
Dict(
    "vol" => [4435651, 0], 
    "ticker" => "NFLX", 
    "high" => [326.29998779296875, 325.30999755859375], 
    "open" => [321.45001220703125, 325.30999755859375], 
    "timestamp" => [DateTime("2022-12-09T14:30:00"), DateTime("2022-12-09T15:15:35")], 
    "low" => [319.5199890136719, 325.30999755859375], 
    "close" => [325.79998779296875, 325.30999755859375])

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]...)
4×7 DataFrame
Row │ close    timestamp            high     low      open     ticker  vol      
    │ Float64  DateTime             Float64  Float64  Float64  String  Int64    
────┼───────────────────────────────────────────────────────────────────────────
  1 │  142.21  2022-12-09T14:30:00   142.55   140.9    142.34  AAPL    11111223
  2 │  142.16  2022-12-09T15:12:20   142.16   142.16   142.16  AAPL           0
  3 │  324.51  2022-12-09T14:30:00   326.3    319.52   321.45  NFLX     4407336
  4 │  324.65  2022-12-09T15:12:20   324.65   324.65   324.65  NFLX           0
YFinance.get_quoteSummaryMethod
get_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 of Strings. To see valid items call _QuoteSummary_Items (not all items are available for all types of securities)

  • throw_error::Bool defaults to false. If set to true the function errors when the ticker is not valid. Else a warning is given and an empty JSON3.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_trendMethod
get_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
Dict{String, Vector} with 6 entries:
  "strongbuy"  => [11, 11, 13, 13]
  "sell"       => [0, 1, 1, 0]
  "buy"        => [21, 26, 25, 20]
  "period"     => ["0m", "-1m", "-2m", "-3m"]
  "hold"       => [6, 5, 6, 8]
  "strongsell" => [0, 0, 0, 0]

julia> get_recommendation_trend("AAPL")
Dict{String, Vector} with 6 entries:
  "strongbuy"  => [11, 11, 13, 13]
  "sell"       => [0, 1, 1, 0]
  "buy"        => [21, 26, 25, 20]
  "period"     => ["0m", "-1m", "-2m", "-3m"]
  "hold"       => [6, 5, 6, 8]
  "strongsell" => [0, 0, 0, 0]
  
julia> using DataFrames
julia> get_recommendation_trend("AAPL") |> DataFrame
4×6 DataFrame
 Row │ buy    hold   period  sell   strongbuy  strongsell 
     │ Int64  Int64  String  Int64  Int64      Int64      
─────┼────────────────────────────────────────────────────
   1 │    21      6  0m          0         11           0
   2 │    26      5  -1m         1         11           0
   3 │    25      6  -2m         1         13           0
   4 │    20      8  -3m         0         13           0
YFinance.get_sector_industryMethod
get_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_get_quoteSummary("AAPL") |> sector_industry
Dict{String, String} with 2 entries:
  "industry" => "Consumer Electronics"
  "sector"   => "Technology"

julia> get_sector_industry("AAPL")
Dict{String, String} with 2 entries:
  "industry" => "Consumer Electronics"
  "sector"   => "Technology"
YFinance.get_summary_detailMethod
get_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
Dict{String, Any} with 41 entries:
  "tradeable"                  => false
  "dayLow"                     => 140.91
  "coinMarketCapLink"          => nothing
  "priceHint"                  => 2
  "regularMarketPreviousClose" => 142.65
  "askSize"                    => 900
  ⋮                            => ⋮

julia> get_summary_detail("AAPL")
Dict{String, Any} with 41 entries:
  "tradeable"                  => false
  "dayLow"                     => 140.91
  "coinMarketCapLink"          => nothing
  "priceHint"                  => 2
  "regularMarketPreviousClose" => 142.65
  "askSize"                    => 900
  ⋮                            => ⋮
YFinance.get_upgrade_downgrade_historyMethod
get_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
Dict{String, Vector} with 5 entries:
  "firm"      => ["UBS", "Morgan Stanley", "B of A Securities", "Barclay…
  "action"    => Union{Missing, String}["main", "main", "main", "main", …
  "fromGrade" => Union{Missing, String}["", "", "", "", "", "", "", "", …
  "date"      => Union{Missing, DateTime}[DateTime("2022-11-08T12:17:03"…
  "toGrade"   => Union{Missing, String}["Buy", "Overweight", "Neutral", …

julia> get_upgrade_downgrade_history("AAPL")
Dict{String, Vector} with 5 entries:
  "firm"      => ["UBS", "Morgan Stanley", "B of A Securities", "Barclay…
  "action"    => Union{Missing, String}["main", "main", "main", "main", …
  "fromGrade" => Union{Missing, String}["", "", "", "", "", "", "", "", …
  "date"      => Union{Missing, DateTime}[DateTime("2022-11-08T12:17:03"…
  "toGrade"   => Union{Missing, String}["Buy", "Overweight", "Neutral", …
  
julia> using DataFrames
julia> get_upgrade_downgrade_history("AAPL") |> DataFrame
871×5 DataFrame
 Row │ action   date                 firm               fromGrade  toGr ⋯
     │ String?  DateTime?            String             String?    Stri ⋯
─────┼───────────────────────────────────────────────────────────────────
   1 │ main     2022-11-08T12:17:03  UBS                           Buy  ⋯
   2 │ main     2022-11-08T12:14:23  Morgan Stanley                Over  
   3 │ main     2022-11-07T13:08:30  B of A Securities             Neut  
  ⋮  │    ⋮              ⋮                   ⋮              ⋮           ⋱
 870 │ main     2012-03-08T07:33:00  FBN Securities                Outp  
 871 │ main     2012-02-09T08:17:00  Canaccord Genuity             Buy  ⋯
                                             1 column and 866 rows omitted
YFinance.get_valid_symbolsMethod
get_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_symbolsMethod
get_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.validate_symbolMethod
validate_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)