# Binance Public Spot API
#
# OpenAPI Specifications for the Binance Public Spot API API documents: - [https://github.com/binance/binance-spot-api-docs](https://github.com/binance/binance-spot-api-docs) - [https://binance-docs.github.io/apidocs/spot/en](https://binance-docs.github.io/apidocs/spot/en)
#
# The version of the OpenAPI document: 1.0
#
# Generated by: https://openapi-generator.tech
#' @docType class
#' @title PortfolioMargin operations
#' @description binanceRapi.PortfolioMargin
#' @format An \code{R6Class} generator object
#' @field apiClient Handles the client-server communication.
#'
#' @section Methods:
#' \describe{
#' \strong{ SapiV1PortfolioAccountGet } \emph{ Get Portfolio Margin Account Info (USER_DATA) }
#' Weight(IP): 1
#'
#' \itemize{
#' \item \emph{ @param } timestamp integer
#' \item \emph{ @param } signature character
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } \link{InlineResponse200114} \cr
#'
#'
#' \item status code : 200 | Portfolio account.
#'
#' \item return type : InlineResponse200114
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#' \item return type : Error
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Unauthorized Request
#'
#' \item return type : Error
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' }
#'
#'
#' @examples
#' \dontrun{
#' #################### SapiV1PortfolioAccountGet ####################
#'
#' library(binanceRapi)
#' var.timestamp <- 56 # integer | UTC timestamp in ms
#' var.signature <- 'signature_example' # character | Signature
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Get Portfolio Margin Account Info (USER_DATA)
#' api.instance <- PortfolioMarginApi$new()
#'
#' #Configure API key authorization: ApiKeyAuth
#' api.instance$apiClient$apiKeys['X-MBX-APIKEY'] <- 'TODO_YOUR_API_KEY';
#'
#' result <- api.instance$SapiV1PortfolioAccountGet(var.timestamp, var.signature, recv.window=var.recv.window)
#'
#'
#' }
#' @importFrom R6 R6Class
#' @importFrom base64enc base64encode
#' @export
PortfolioMarginApi <- R6::R6Class(
'PortfolioMarginApi',
public = list(
apiClient = NULL,
initialize = function(apiClient){
if (!missing(apiClient)) {
self$apiClient <- apiClient
}
else {
self$apiClient <- ApiClient$new()
}
},
SapiV1PortfolioAccountGet = function(timestamp, signature, recv.window=NULL, ...){
apiResponse <- self$SapiV1PortfolioAccountGetWithHttpInfo(timestamp, signature, recv.window, ...)
resp <- apiResponse$response
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
apiResponse$content
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
apiResponse
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
apiResponse
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
apiResponse
}
},
SapiV1PortfolioAccountGetWithHttpInfo = function(timestamp, signature, recv.window=NULL, ...){
args <- list(...)
queryParams <- list()
headerParams <- c()
if (missing(`timestamp`)) {
stop("Missing required parameter `timestamp`.")
}
if (missing(`signature`)) {
stop("Missing required parameter `signature`.")
}
queryParams['recvWindow'] <- recv.window
queryParams['timestamp'] <- timestamp
queryParams['signature'] <- signature
body <- NULL
urlPath <- "/sapi/v1/portfolio/account"
# API key authentication
if ("X-MBX-APIKEY" %in% names(self$apiClient$apiKeys) && nchar(self$apiClient$apiKeys["X-MBX-APIKEY"]) > 0) {
headerParams['X-MBX-APIKEY'] <- paste(unlist(self$apiClient$apiKeys["X-MBX-APIKEY"]), collapse='')
}
resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
method = "GET",
queryParams = queryParams,
headerParams = headerParams,
body = body,
...)
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
deserializedRespObj <- tryCatch(
self$apiClient$deserialize(resp, "InlineResponse200114", loadNamespace("binanceRapi")),
error = function(e){
stop("Failed to deserialize response")
}
)
ApiResponse$new(deserializedRespObj, resp)
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
ApiResponse$new("API client error", resp)
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
ApiResponse$new("API server error", resp)
}
}
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.