getFundamentals

getFundamentals retrieves detailed company metrics for supplied tickers.

Syntax

  • T=getFundamentals(ticker)example
  • T=getFundamentals(ticker,Name,Value)example

Description

getTickers, getYahoo and getFundamentals can be used jointly to build a complete workflow: from the selection of representative market tickers, to the retrieval and dynamic interactive plot of their price time series, and finally to the extraction of their fundamental financial information.

For background on financial data and market analysis, see: Yahoo Finance API documentation https://finance.yahoo.com/

example

T =getFundamentals(ticker) One ticker.

example

T =getFundamentals(ticker, Name, Value) Multiple tickers Example 1.

Examples

expand all

  • One ticker.
  • T = getFundamentals('ENEL.MI');

  • Multiple tickers Example 1.
  • The input is a cell array of character vectors.

    T = getFundamentals({'ENEL.MI','AAPL','MSFT'});

    Related Examples

    expand all

  • Multiple tickers Example 2.
  • The input is a string array.

    T = getFundamentals(["ENEL.MI","RACE.MI","AAPL"]);

  • Basic information only.
  • T = getFundamentals('AAPL','Fields','basic');

  • Valuation metrics.
  • T = getFundamentals(["AAPL","MSFT","NVDA"],'Fields','valuation');

  • Performance metrics.
  • T = getFundamentals('ENEL.MI','Fields','performance');

  • Custom fields.
  • T = getFundamentals('AAPL','Fields',{'marketCap','trailingPE'});

  • Rank by market capitalization T = getFundamentals(["AAPL","MSFT","NVDA"], .
  • T = getFundamentals(["AAPL","MSFT","NVDA"], ...
    'Fields','basic','RankBy','marketCap');
    disp(T)
        ticker            Name       
        _______    __________________
    
        "^IXIC"    "Nasdaq Composite"
        "AAPL"     "Apple"           
        "MSFT"     "Microsoft"       
        "NVDA"     "NVIDIA"          
        "AMZN"     "Amazon"          
        "GOOGL"    "Alphabet Class A"
    
    Requested pair range=1y, interval=1m is not supported.
    Using interval=1d instead.
    
    Processing ticker 1 of 5: AAPL
    
    Processing ticker 2 of 5: MSFT
    
    Processing ticker 3 of 5: NVDA
    
    Processing ticker 4 of 5: AMZN
    
    Processing ticker 5 of 5: GOOGL
      5×1 struct array with fields:
    
        Ticker
        LastPeriod
        intervalRequested
        intervalActual
        TimeZone
        TT
        Indicators
        Success
        Message
        class
    
                                       CompanyName           TickerSymbol    marketCap               sector                           industry             
                                _________________________    ____________    __________    __________________________    __________________________________
    
        AppleInc_               {'Apple Inc.'           }     {'AAPL' }      3.7615e+12    {'Technology'            }    {'Consumer Electronics'          }
        MicrosoftCorporation    {'Microsoft Corporation'}     {'MSFT' }      2.7757e+12    {'Technology'            }    {'Software - Infrastructure'     }
        NVIDIACorporation       {'NVIDIA Corporation'   }     {'NVDA' }      4.3115e+12    {'Technology'            }    {'Semiconductors'                }
        Amazon_com_Inc_         {'Amazon.com, Inc.'     }     {'AMZN' }      2.2519e+12    {'Consumer Cyclical'     }    {'Internet Retail'               }
        AlphabetInc_            {'Alphabet Inc.'        }     {'GOOGL'}      3.5779e+12    {'Communication Services'}    {'Internet Content & Information'}
    
    
    Click here for the graphical output of this example (link to Ro.S.A. website)

  • Rank by forward PE T = getFundamentals(["AAPL","MSFT","NVDA"], .
  • T = getFundamentals(["AAPL","MSFT","NVDA"], ...
    'Fields','valuation','RankBy','forwardPE');

  • Rank performance metrics.
  • T = getFundamentals(["AAPL","MSFT","NVDA"], ...
    'Fields','performance','RankBy','returnOnEquity');

  • Example of combined use of getTickers with getFundamentals.
  • T = getTickers('market','DAX','nStocks',8,'RankByCap',true);
    % Retrieve selected fields only
    F = getFundamentals(T.ticker(2:end), ...
    'Fields',{'marketCap','trailingPE','returnOnEquity'});
    disp(F)
        ticker            Name       
        _______    __________________
    
        "^IXIC"    "Nasdaq Composite"
        "AAPL"     "Apple"           
        "MSFT"     "Microsoft"       
        "NVDA"     "NVIDIA"          
        "AMZN"     "Amazon"          
        "GOOGL"    "Alphabet Class A"
    
    Requested pair range=1y, interval=1m is not supported.
    Using interval=1d instead.
    
    Processing ticker 1 of 5: AAPL
    
    Processing ticker 2 of 5: MSFT
    
    Processing ticker 3 of 5: NVDA
    
    Processing ticker 4 of 5: AMZN
    
    Processing ticker 5 of 5: GOOGL
      5×1 struct array with fields:
    
        Ticker
        LastPeriod
        intervalRequested
        intervalActual
        TimeZone
        TT
        Indicators
        Success
        Message
        class
    
                                       CompanyName           TickerSymbol    marketCap               sector                           industry             
                                _________________________    ____________    __________    __________________________    __________________________________
    
        AppleInc_               {'Apple Inc.'           }     {'AAPL' }      3.7615e+12    {'Technology'            }    {'Consumer Electronics'          }
        MicrosoftCorporation    {'Microsoft Corporation'}     {'MSFT' }      2.7757e+12    {'Technology'            }    {'Software - Infrastructure'     }
        NVIDIACorporation       {'NVIDIA Corporation'   }     {'NVDA' }      4.3115e+12    {'Technology'            }    {'Semiconductors'                }
        Amazon_com_Inc_         {'Amazon.com, Inc.'     }     {'AMZN' }      2.2519e+12    {'Consumer Cyclical'     }    {'Internet Retail'               }
        AlphabetInc_            {'Alphabet Inc.'        }     {'GOOGL'}      3.5779e+12    {'Communication Services'}    {'Internet Content & Information'}
    
    
    Click here for the graphical output of this example (link to Ro.S.A. website)

    Input Arguments

    expand all

    ticker — Ticker symbol(s). Character, string, string array or cell array of char.

    It can be: - a character vector, for example 'ENEL.MI';

    - a string scalar, for example "ENEL.MI";

    - a string array, for example ["ENEL.MI" "AAPL" "MSFT"];

    - a cell array of char, for example {'ENEL.MI','AAPL','MSFT'};

    Data Types: single| double

    Name-Value Pair Arguments

    Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

    Example: 'RankBy','marketCap' , 'ExplainFields','valuation' , 'Fields','basic'

    RankBy —Rank rows by a numeric variable in descending order.if the requested field is missing, an error is produced.

    Missing numeric values are placed at the bottom.

    Default is '', which means no ranking. Note that ranking happens before field reduction

    Example: 'RankBy','marketCap'

    Data Types: char | string

    ExplainFields —Display explanation of available fields.logical | string.

    If true, prints a description of the most relevant fields.

    If equal to: 'basic' → explain basic preset 'valuation' → explain valuation preset 'performance' → explain performance preset Default is false.

    Example: 'ExplainFields','valuation'

    Data Types: logical | char | string

    Fields —Select subset of output variables.possible values: 'all' = return all available fields (default) 'basic' = {'CompanyName','TickerSymbol',.

    ..

    'marketCap','sector','industry'} 'valuation' = {'CompanyName','TickerSymbol',...

    'marketCap','enterpriseValue',...

    'trailingPE','forwardPE','priceToBook'} 'performance' = {'CompanyName','TickerSymbol',...

    'returnOnEquity','profitMargins','revenueGrowth'} Alternatively, a custom list of fields can be supplied: For instance 'Fields',{'marketCap','trailingPE'}

    Example: 'Fields','basic'

    Data Types: char | string | cell array of characters

    Output Arguments

    expand all

    T —Table with one row for each ticker. Table with k columns

    The company name is stored in the row names (making sure that there are no repeated elements and that the names are valid) and is repeated as the first table variable. The second variable of the output table is TickerSymbol. The remaining columns contain all available information returned by Yahoo Finance through Python yfinance module.

    References

    Damodaran, A. (2012), "Investment Valuation: Tools and Techniques for Determining the Value of Any Asset", 3rd Edition, Wiley.

    Cochrane, J. H. (2023), "Asset Pricing, Revised Edition", Princeton University Press, Princeton.

    Koller, T., Goedhart, M., and Wessels, D. (2020), "Valuation: Measuring and Managing the Value of Companies, 7th Edition", Wiley, Hoboken.

    This page has been automatically generated by our routine publishFS