R/trade_fees.R

#' Trade Fees
#'
#' User's Trading Fees.
#' @keywords fees
#' @export
#' @examples
#' trade_fees()


trade_fees<-function(){
  NC<-NONCE()
  mthd<-"GET"
  Pyld<-""
  url<-"https://api.bitso.com/v3/fees/"
  Pth<-"/v3/fees/"
  hdr<-paste0("Bitso ",ky,":",NC,":",openssl::sha256(paste0(NC,mthd,Pth,Pyld),scrt))
  tmp <- tempfile()
  res<-httr::GET(url, httr::add_headers(Authorization=hdr), httr::write_disk(tmp))
  cat(noquote(paste("Success:", httr::content(res)$success,"\n\n")))
  if(httr::content(res)$success== TRUE){
    R<-data.frame(suppressWarnings(jsonlite::fromJSON(readLines(tmp))$payload$fees), stringsAsFactors=FALSE)
    R<-transform(R,
                 fee_percent=as.numeric(fee_percent),
                 fee_decimal=as.numeric(fee_decimal)
    )
    return(R)
  }
}
nicholasbucher/RBitso documentation built on May 7, 2019, 1:30 p.m.