account_portfolio | R Documentation |
The portfolio history endpoint returns a timeseries of equity and profit/loss summaries for the account over a period
previous aggregated by a given timeframe
.
account_portfolio(
period = NULL,
timeframe = NULL,
date_end = NULL,
extended_hours = FALSE,
live = get_live()
)
period |
Defaults to |
timeframe |
If omitted, " |
date_end |
|
extended_hours |
|
live |
|
All (Date/POSIXlt)
will parse correctly if in YYYY-MM-DD
RFC 3339 format or (Datetime/POSIXct)
, YYYY-MM-DD HH:MM
ISO8601 format. Other formats will often work, but are not guaranteed to parse correctly.
A PortfolioHistory (tibble)
Object with R amenable data types. Note that base value & timeframe can be accessed by calling attr(out, "info")
on the returned tibble.
timestamp
(Date/POSIXlt/Datetime(POSIXct)/character)
time of each data element, with the first element being the beginning of the time window.
equity
(numeric)
equity value of the account in dollar amount as of the end of each time window
profit_loss
(numeric)
profit/loss in dollar from the base value
profit_loss_pct
(numeric)
profit/loss in percentage from the base value
base_value
(numeric)
basis in dollar of the profit loss calculation
timeframe
(character)
time window size of each data element
Other Account:
account_activities()
,
account_config()
,
account()
# Get the previous year's returns for the paper account
account_portfolio("1y")
# Get portfolio history when the COVID-19 pandemic overtook the US
account_portfolio("3m", date_end = "2020-05-20")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.