#' Get instrument info.
#'
#' Return list with symbol and name for instrument url
#' @param instrumentURL instrument url returned by rh_getInstrumentURL.
rh_getInstrumentInfo <- function(instrumentURL) {
res <- httr::GET(instrumentURL)
instrumentTicker <- httr::content(res)$symbol
instrumentName <- httr::content(res)$name
instrumentInfo <- list()
instrumentInfo$ticker <- instrumentTicker
instrumentInfo$name <- instrumentName
return(instrumentInfo)
}
rh_getInstrumentURL <- function(ticker,account) {
header <- account$user$authHeader
res <- httr::GET(paste("https://api.robinhood.com/fundamentals/", ticker, "/",sep = ""), httr::add_headers(.headers=header))
instrumentURL <- httr::content(res)$instrument
return(instrumentURL)
}
#' Get fundamentals
#'
#' Get summary fundamentals data on company ticker.
#' @param ticker Equity ticker symbol. All caps string.
#' @param account Initialized instance of the R6 Account class. Generated by Account$new(login).
rh_getFundamentals<-function(ticker,account){
ticker<-toupper(ticker)
header<-account$user$authHeader
res<-httr::GET(paste("https://api.robinhood.com/fundamentals/",ticker,"/",sep=""), httr::add_headers(.headers=header))
fundamentals_list<-httr::content(res)
fundamentals_list<-as.data.frame(fundamentals_list)
return(fundamentals_list)
}
#' Get current balances.
#' Retrieve current portfolio market value and positions.
#' @param account Initialized instance of the R6 Account class. Generated by Account$new(login).
## Order<-Orders$new(robinhoodUser$account)
## orders<-Order$orders
## current_positions<-orders$Current_Positions
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.