R/account.R

#' Get accounts for a user
#'
#' Get a list of accounts owned by the user.
#' See the following link for further information: \url{http://developer.oanda.com/rest-live/accounts/#getAccountsForUser}.
#'
#' @param oanda OANDA class object generated by \code{\link{generate_oanda}()}
#' @export
accounts <- function(oanda){
  endpoint <- "/v1/accounts"
  request(oanda, endpoint)
}

#' Get account information
#'
#' Get account information
#' See the following link for further information:
#' \url{http://developer.oanda.com/rest-live/accounts/#getAccountInformation}.
#'
#' @param oanda OANDA class object generated by \code{\link{generate_oanda}()}
#' @param account_id The account id to fetch the list of tradeable instruments for. This value will be used if it is specified.
#'   If not specified, the value which OANDA object has inside is used as a default (default value is \code{NULL}).
#' @export
account_information <- function(oanda, account_id=NULL)
{
  endpoint <- paste0("/v1/accounts/", account_id_inner(oanda, account_id))
  request(oanda, endpoint)
}
teramonagi/oandar documentation built on May 8, 2019, 8:51 a.m.