R/logout.R

Defines functions logout

Documented in logout

#' Logout of RobinHood
#'
#' Send a logout call through the RobinHood API service and disable your token.
#'
#' @param RH object of class RobinHood
#' @import httr magrittr
#' @export
#' @examples
#' \dontrun{
#' # Login in to your RobinHood account
#' RH <- RobinHood("username", "password")
#'
#' logout(RH)
#'}
logout <- function(RH) {

    # Check if RH is valid
    check_rh(RH)

    # API request to revoke token
    x <- api_logout(RH)

    if (x == "") {
      cat("Logout Sucessful")
    } else {
      cat("Failed to Logout")
    }
  }

Try the RobinHood package in your browser

Any scripts or data that you put into this service are public.

RobinHood documentation built on March 1, 2021, 5:08 p.m.