This vignette demonstrates how to use the get_ticker
,
plot_multiple_stocks
, and filter_company_data
function to analyze potential investments.
Let’s suppose that we are interested in investing in the tech industry. Let’s compare the top 3 companies in the tech industry in the following way:
# Load the package
library(Stocks)
#let's first find the tickers for the top 3 companies in the tech industry
get_ticker("Microsoft")
## MSFT
get_ticker("Apple Inc")
## AAPL
get_ticker("Nvidia")
## NVDA
#Now let's plot these three stocks from 01/05/2023 to 01/01/2024
plot_multiple_stocks(c("AAPL", "MSFT", "NVDA"), from_date = "01/05/2023", to_date = "01/01/2024")
##
## Percentage Change for each stock:
##
##
## |symbol |start_date |end_date |pct_change |
## |:------|:----------|:----------|:----------|
## |MSFT |2023-01-05 |2023-12-29 |70.65% |
## |AAPL |2023-01-05 |2023-12-29 |54.86% |
## |NVDA |2023-01-05 |2023-12-29 |247.31% |
#Now suppose that we are interested in investing in Apple and want to analyze the financial ratios of Apple over the past few year. We can use the filter_company_data to obtain financial ratios that will allow us to see how Apple has been doing in the past few years
# Fetch data for Apple Inc. (AAPL)
company_data <- filter_company_data(tik = "AAPL")
company_data
The get_ticker() function allows users to get the ticker that
corresponds to the stock that they are interested in, the
plot_multiple_stocks() function allows users to plot the stocks of
interest and see how the stock prices have fluctuated over a period of
interest, and the table above shows financial ratios for Apple
Inc. (AAPL
) from 2015 to 2023. Users can sort, filter, or
search for specific data points interactively.