watchlist | R Documentation |
Access all Watchlist endpoints. See link for details. \lifecyclestable
watchlist(
watchlist_id = NULL,
symbols = NULL,
action = "get",
new_name,
live = get_live()
)
watchlist_id |
|
symbols |
|
action |
|
new_name |
|
live |
|
Watchlist
(tibble)
If watchlist()
is called with no arguments, an tibble
of Watchlist Object. For all others action
s, a tibble
of Asset Objects with the Watchlist
stored as an attribute retrieved with attr(Asset, "info")
and query metadata stored as attr(Asset, "query")
. A Watchlist
object has the following information:
name
(character)
The name of the watchlist.
updated_at
(POSIXct)
The timestamp of the last update.
id
(character)
Watchlist ID
account_id
(character)
The account ID associated with the watchlist
created_at
(POSIXct)
The timestamp of the watchlist creation.
## Not run:
# get the existing watchlists
watchlist()
# create a watchlist named test with Microsoft
(wl <- watchlist("test", symbols = "AAPL", action = "c"))
# See it in the list of watchlists
watchlist()
# Get it
(test <- watchlist("test"))
all.equal(test,wl, check.attributes = FALSE)
# Get that Watchlist's info
attr(wl, "info")
# Add "FB", "AMZN", "NFLX", "GOOG" and update the watchlist name to "FAANG"
(wl <- watchlist("test", new_name = "FAANG", symbols = c("FB", "AMZN", "NFLX", "GOOG")))
# Add individual stocks by specifying symbols (action assumed to be add when symbols are present)
(wl <- watchlist("FAANG", symbol = "GOOGL"))
# Delete individual items (or multiple)
(wl <- watchlist("FAANG", action = "d", symbols = "GOOGL"))
# Rename it appropriately and replace the symbols to match the name by specifying action = "update" explicitly.
(wl <- watchlist("FAANG", new_name = "FANG", symbols = c("FB", "AAPL", "NFLX", "GOOG"), action = "u"))
# Delete it using a partial argument (may cause a warning)
watchlist("FANG", a = "d")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.