Title: | Fetch Data from Yahoo Finance API |
---|---|
Description: | Obtain historical and near real time data related to stocks, index and currencies from the Yahoo Finance API. This package is community maintained and is not officially supported by 'Yahoo'. The accuracy of data is only as correct as provided on <https://finance.yahoo.com/>. |
Authors: | Aravind Hebbali [aut, cre] |
Maintainer: | Aravind Hebbali <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.4.0.9000 |
Built: | 2024-11-17 08:26:17 UTC |
Source: | https://github.com/rsquaredacademy/yahoofinancer |
Retrieve current conversion rate between two currencies as well as historical rates.
currency_converter( from = "EUR", to = "USD", start = NULL, end = NULL, period = "ytd", interval = "1d" )
currency_converter( from = "EUR", to = "USD", start = NULL, end = NULL, period = "ytd", interval = "1d" )
from |
Currency to convert from. |
to |
Currency to convert to. |
start |
Specific starting date. |
end |
Specific ending date. |
period |
Length of time. Defaults to
|
interval |
Time between data points. Defaults to
|
A data.frame
.
currency_converter('GBP', 'USD', '2022-07-01', '2022-07-10') currency_converter('GBP', 'USD', period = '1mo', interval = '1d')
currency_converter('GBP', 'USD', '2022-07-01', '2022-07-10') currency_converter('GBP', 'USD', period = '1mo', interval = '1d')
List of currencies Yahoo Finance supports.
get_currencies()
get_currencies()
Symbol, short and long name of the currencies.
get_currencies()
get_currencies()
Summary info of relevant exchanges for specific country.
get_market_summary(country = "US")
get_market_summary(country = "US")
country |
Name of the country. |
A data.frame
.
get_market_summary(country = 'US')
get_market_summary(country = 'US')
List of trending securities for specific country.
get_trending(country = "US", count = 10)
get_trending(country = "US", count = 10)
country |
Name of the country. |
count |
Number of securities. |
Securities trending in the country.
get_trending()
get_trending()
Base class for getting all data related to indices from Yahoo Finance API.
An R6 class object
index
Index for which data is retrieved
new()
Create a new Index object
Index$new(index = NA)
index
Index
A new 'Index' object
nifty_50 <- Index$new('^NSEI')
set_index()
Set a new index.
Index$set_index(index)
index
New index
indice <- Index$new('^NSEI') indice$set_index('^NDX')
get_history()
Retrieves historical data
Index$get_history(period = "ytd", interval = "1d", start = NULL, end = NULL)
period
Length of time. Defaults to 'ytd'
. Valid values are:
'1d'
'5d'
'1mo'
'3mo'
'6mo'
'1y'
'2y'
'5y'
'10y'
'ytd'
'max'
interval
Time between data points. Defaults to '1d'
. Valid values are:
'1m'
'2m'
'5m'
'15m'
'30m'
'60m'
'90m'
'1h'
'1d'
'5d'
'1wk'
'1mo'
'3mo'
start
Specific starting date. String
or date
object in yyyy-mm-dd
format.
end
Specific ending date. String
or date
object in yyyy-mm-dd
format.
A data.frame
.
\donttest{ nifty <- Index$new('^NSEI') nifty$get_history(start = '2022-07-01', interval = '1d') nifty$get_history(start = '2022-07-01', end = '2022-07-14', interval = '1d') nifty$get_history(period = '1mo', interval = '1d') }
clone()
The objects of this class are cloneable with this method.
Index$clone(deep = FALSE)
deep
Whether to make a deep clone.
## ------------------------------------------------ ## Method `Index$new` ## ------------------------------------------------ nifty_50 <- Index$new('^NSEI') ## ------------------------------------------------ ## Method `Index$set_index` ## ------------------------------------------------ indice <- Index$new('^NSEI') indice$set_index('^NDX') ## ------------------------------------------------ ## Method `Index$get_history` ## ------------------------------------------------ nifty <- Index$new('^NSEI') nifty$get_history(start = '2022-07-01', interval = '1d') nifty$get_history(start = '2022-07-01', end = '2022-07-14', interval = '1d') nifty$get_history(period = '1mo', interval = '1d')
## ------------------------------------------------ ## Method `Index$new` ## ------------------------------------------------ nifty_50 <- Index$new('^NSEI') ## ------------------------------------------------ ## Method `Index$set_index` ## ------------------------------------------------ indice <- Index$new('^NSEI') indice$set_index('^NDX') ## ------------------------------------------------ ## Method `Index$get_history` ## ------------------------------------------------ nifty <- Index$new('^NSEI') nifty$get_history(start = '2022-07-01', interval = '1d') nifty$get_history(start = '2022-07-01', end = '2022-07-14', interval = '1d') nifty$get_history(period = '1mo', interval = '1d')
Base class for getting all data related to ticker from Yahoo Finance API.
An R6 class object
symbol
Symbol for which data is retrieved.
valuation_measures
Retrieves valuation measures for most recent four quarters
recommendations
Recommended symbols
technical_insights
Technical indicators for given symbol
currency
Currency
exchange_name
Exchange name
full_exchange_name
Full exchange name
first_trade_date
First trade date
regular_market_time
Regular market time
timezone
Time zone
exchange_timezone_name
Exchange timezone name
regular_market_price
Regular market price
fifty_two_week_high
Fifty two week high
fifty_two_week_low
Fifty two week low
regular_market_day_high
Regular market day high
regular_market_day_low
Regular market day low
regular_market_volume
Regular market volume
previous_close
Previous close
new()
Create a new Ticker object.
Ticker$new(symbol = NA)
symbol
Symbol.
A new 'Ticker' object
aapl <- Ticker$new('aapl')
set_symbol()
Set a new symbol.
Ticker$set_symbol(symbol)
symbol
New symbol
aapl <- Ticker$new('aapl') aapl$set_symbol('msft')
get_history()
Retrieves historical pricing data.
Ticker$get_history(period = "ytd", interval = "1d", start = NULL, end = NULL)
period
Length of time. Defaults to 'ytd'
. Valid values are:
'1d'
'5d'
'1mo'
'3mo'
'6mo'
'1y'
'2y'
'5y'
'10y'
'ytd'
'max'
interval
Time between data points. Defaults to '1d'
. Valid values are:
'1m'
'2m'
'5m'
'15m'
'30m'
'60m'
'90m'
'1h'
'1d'
'5d'
'1wk'
'1mo'
'3mo'
start
Specific starting date. String
or date
object in yyyy-mm-dd
format.
end
Specific ending date. String
or date
object in yyyy-mm-dd
format.
A data.frame
.
\donttest{ aapl <- Ticker$new('aapl') aapl$get_history(start = '2022-07-01', interval = '1d') aapl$get_history(start = '2022-07-01', end = '2022-07-14', interval = '1d') aapl$get_history(period = '1mo', interval = '1d') }
clone()
The objects of this class are cloneable with this method.
Ticker$clone(deep = FALSE)
deep
Whether to make a deep clone.
## ------------------------------------------------ ## Method `Ticker$new` ## ------------------------------------------------ aapl <- Ticker$new('aapl') ## ------------------------------------------------ ## Method `Ticker$set_symbol` ## ------------------------------------------------ aapl <- Ticker$new('aapl') aapl$set_symbol('msft') ## ------------------------------------------------ ## Method `Ticker$get_history` ## ------------------------------------------------ aapl <- Ticker$new('aapl') aapl$get_history(start = '2022-07-01', interval = '1d') aapl$get_history(start = '2022-07-01', end = '2022-07-14', interval = '1d') aapl$get_history(period = '1mo', interval = '1d')
## ------------------------------------------------ ## Method `Ticker$new` ## ------------------------------------------------ aapl <- Ticker$new('aapl') ## ------------------------------------------------ ## Method `Ticker$set_symbol` ## ------------------------------------------------ aapl <- Ticker$new('aapl') aapl$set_symbol('msft') ## ------------------------------------------------ ## Method `Ticker$get_history` ## ------------------------------------------------ aapl <- Ticker$new('aapl') aapl$get_history(start = '2022-07-01', interval = '1d') aapl$get_history(start = '2022-07-01', end = '2022-07-14', interval = '1d') aapl$get_history(period = '1mo', interval = '1d')
Validate symbols before retrieving data.
validate(symbol = NULL)
validate(symbol = NULL)
symbol |
Ticker, index or fund name. |
validate("aapl") validate("aapls")
validate("aapl") validate("aapls")