get_info {yfinancer}R Documentation

Retrieve asset information from Yahoo Finance

Description

This function retrieves detailed asset information from Yahoo Finance's quoteSummary API. It can fetch various types of data including asset profiles, financial statements, key statistics, and more. The function supports retrieving multiple data modules in a single request.

Usage

get_info(
  ticker,
  modules = "summaryProfile",
  output = c("tibble", "list", "response", "request"),
  proxy = NULL
)

Arguments

ticker

A ticker name or ticker object created with get_tickers().

modules

Character vector of module names to retrieve. Default is "summaryProfile". See section "Available Modules" for common options.

output

The type of output to return. Can be "tibble" (default), "list" (raw parsed JSON), "response" (httr2 response), or "request" (httr2 request).

proxy

Optional proxy settings for the request.

Value

Depending on the output parameter and number of modules requested:

Available Modules

The modules parameter accepts any of the valid module names from Yahoo Finance API. Common modules include:

See valid_modules for a complete list of available modules.

Authentication

This function requires authentication via two components:

Authentication methods (in order of priority):

  1. Environment variables: YFINANCE_CRUMB and YFINANCE_A1

  2. Saved auth file: ⁠~/.yfinance/auth⁠

  3. Auto-generated using curl-impersonate (requires installation)

Example:

Sys.setenv(YFINANCE_CRUMB = "your-crumb")
Sys.setenv(YFINANCE_A1 = "your-a1-cookie")

See https://github.com/lwthiker/curl-impersonate for curl-impersonate installation. Option 3 above expects curl_chrome110 to be installed and available in the system path.

Examples

## Not run: 
# Get a single ticker
apple <- get_tickers("AAPL")

# Get summary information
# using default module "summaryProfile"
apple_summary <- get_info(apple)

# Get basic company profile
apple_profile <- get_info(apple, modules = "assetProfile")

# Get key financial metrics
apple_financials <- get_info(apple, modules = "financialData")

# Get multiple modules as a list of tibbles
apple_data <- get_info(apple,
  modules = c("incomeStatementHistory", "balanceSheetHistory", "cashflowStatementHistory")
)

# Access specific financial statements
income_statement <- apple_data$incomeStatementHistory
balance_sheet <- apple_data$balanceSheetHistory

# Get raw JSON response for custom processing
apple_raw <- get_info(apple, modules = "assetProfile", output = "response")

## End(Not run)

[Package yfinancer version 0.1.3 Index]