Indice-class: R6 Class Representing an Index

Indice-classR Documentation

R6 Class Representing an Index

Description

Class for retrieving data related to market indices from the Yahoo Finance API. Inherits get_history() from YahooFinanceBase-class.

Format

An R6 class object

Super class

YahooFinanceBase -> Index

Active bindings

index

Deprecated. Returns self$symbol.

Methods

Public methods

Inherited methods

Index$new()

Create a new Index object.

Usage
Index$new(symbol = NA, index = NA, validate = TRUE)
Arguments
symbol

Symbol (e.g., "^NSEI").

index

Deprecated. Use symbol instead.

validate

Logical; if TRUE, validate symbol against Yahoo Finance. Defaults to TRUE.

Returns

A new Index object.

Examples
nifty_50 <- Index$new('^NSEI')

Index$set_index()

Set a new index symbol.

Usage
Index$set_index(symbol = NA, index = NA, validate = TRUE)
Arguments
symbol

New symbol.

index

Deprecated. Use symbol instead.

validate

Logical; if TRUE, validate symbol against Yahoo Finance. Defaults to TRUE.

Examples
indice <- Index$new('^NSEI')
indice$set_index('^NDX')

Index$clone()

The objects of this class are cloneable with this method.

Usage
Index$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

See Also

Other historical data: Ticker-class, Tickers, yf_download_prices(), yf_get_index_quotes()

Examples


## ------------------------------------------------
## Method `Index$new()`
## ------------------------------------------------

## Not run: 
nifty_50 <- Index$new('^NSEI')

## End(Not run)

## ------------------------------------------------
## Method `Index$set_index()`
## ------------------------------------------------

## Not run: 
indice <- Index$new('^NSEI')
indice$set_index('^NDX')

## End(Not run)

yahoofinancer documentation built on Nov. 17, 2026, 9:06 a.m.