R/sub_account_coin_futures_summary_delivery_account_summary_resp.R

# 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 SubAccountCOINFuturesSummaryDeliveryAccountSummaryResp
#'
#' @description SubAccountCOINFuturesSummaryDeliveryAccountSummaryResp Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field totalMarginBalanceOfBTC  character 
#'
#' @field totalUnrealizedProfitOfBTC  character 
#'
#' @field totalWalletBalanceOfBTC  character 
#'
#' @field asset  character 
#'
#' @field subAccountList  list( \link{SubAccountCOINFuturesSummaryDeliveryAccountSummaryRespSubAccountList} ) 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
SubAccountCOINFuturesSummaryDeliveryAccountSummaryResp <- R6::R6Class(
  'SubAccountCOINFuturesSummaryDeliveryAccountSummaryResp',
  public = list(
    `totalMarginBalanceOfBTC` = NULL,
    `totalUnrealizedProfitOfBTC` = NULL,
    `totalWalletBalanceOfBTC` = NULL,
    `asset` = NULL,
    `subAccountList` = NULL,
    initialize = function(
        `totalMarginBalanceOfBTC`, `totalUnrealizedProfitOfBTC`, `totalWalletBalanceOfBTC`, `asset`, `subAccountList`, ...
    ) {
      local.optional.var <- list(...)
      if (!missing(`totalMarginBalanceOfBTC`)) {
        stopifnot(is.character(`totalMarginBalanceOfBTC`), length(`totalMarginBalanceOfBTC`) == 1)
        self$`totalMarginBalanceOfBTC` <- `totalMarginBalanceOfBTC`
      }
      if (!missing(`totalUnrealizedProfitOfBTC`)) {
        stopifnot(is.character(`totalUnrealizedProfitOfBTC`), length(`totalUnrealizedProfitOfBTC`) == 1)
        self$`totalUnrealizedProfitOfBTC` <- `totalUnrealizedProfitOfBTC`
      }
      if (!missing(`totalWalletBalanceOfBTC`)) {
        stopifnot(is.character(`totalWalletBalanceOfBTC`), length(`totalWalletBalanceOfBTC`) == 1)
        self$`totalWalletBalanceOfBTC` <- `totalWalletBalanceOfBTC`
      }
      if (!missing(`asset`)) {
        stopifnot(is.character(`asset`), length(`asset`) == 1)
        self$`asset` <- `asset`
      }
      if (!missing(`subAccountList`)) {
        stopifnot(is.vector(`subAccountList`), length(`subAccountList`) != 0)
        sapply(`subAccountList`, function(x) stopifnot(R6::is.R6(x)))
        self$`subAccountList` <- `subAccountList`
      }
    },
    toJSON = function() {
      SubAccountCOINFuturesSummaryDeliveryAccountSummaryRespObject <- list()
      if (!is.null(self$`totalMarginBalanceOfBTC`)) {
        SubAccountCOINFuturesSummaryDeliveryAccountSummaryRespObject[['totalMarginBalanceOfBTC']] <-
          self$`totalMarginBalanceOfBTC`
      }
      if (!is.null(self$`totalUnrealizedProfitOfBTC`)) {
        SubAccountCOINFuturesSummaryDeliveryAccountSummaryRespObject[['totalUnrealizedProfitOfBTC']] <-
          self$`totalUnrealizedProfitOfBTC`
      }
      if (!is.null(self$`totalWalletBalanceOfBTC`)) {
        SubAccountCOINFuturesSummaryDeliveryAccountSummaryRespObject[['totalWalletBalanceOfBTC']] <-
          self$`totalWalletBalanceOfBTC`
      }
      if (!is.null(self$`asset`)) {
        SubAccountCOINFuturesSummaryDeliveryAccountSummaryRespObject[['asset']] <-
          self$`asset`
      }
      if (!is.null(self$`subAccountList`)) {
        SubAccountCOINFuturesSummaryDeliveryAccountSummaryRespObject[['subAccountList']] <-
          lapply(self$`subAccountList`, function(x) x$toJSON())
      }

      SubAccountCOINFuturesSummaryDeliveryAccountSummaryRespObject
    },
    fromJSON = function(SubAccountCOINFuturesSummaryDeliveryAccountSummaryRespJson) {
      SubAccountCOINFuturesSummaryDeliveryAccountSummaryRespObject <- jsonlite::fromJSON(SubAccountCOINFuturesSummaryDeliveryAccountSummaryRespJson)
      if (!is.null(SubAccountCOINFuturesSummaryDeliveryAccountSummaryRespObject$`totalMarginBalanceOfBTC`)) {
        self$`totalMarginBalanceOfBTC` <- SubAccountCOINFuturesSummaryDeliveryAccountSummaryRespObject$`totalMarginBalanceOfBTC`
      }
      if (!is.null(SubAccountCOINFuturesSummaryDeliveryAccountSummaryRespObject$`totalUnrealizedProfitOfBTC`)) {
        self$`totalUnrealizedProfitOfBTC` <- SubAccountCOINFuturesSummaryDeliveryAccountSummaryRespObject$`totalUnrealizedProfitOfBTC`
      }
      if (!is.null(SubAccountCOINFuturesSummaryDeliveryAccountSummaryRespObject$`totalWalletBalanceOfBTC`)) {
        self$`totalWalletBalanceOfBTC` <- SubAccountCOINFuturesSummaryDeliveryAccountSummaryRespObject$`totalWalletBalanceOfBTC`
      }
      if (!is.null(SubAccountCOINFuturesSummaryDeliveryAccountSummaryRespObject$`asset`)) {
        self$`asset` <- SubAccountCOINFuturesSummaryDeliveryAccountSummaryRespObject$`asset`
      }
      if (!is.null(SubAccountCOINFuturesSummaryDeliveryAccountSummaryRespObject$`subAccountList`)) {
        self$`subAccountList` <- ApiClient$new()$deserializeObj(SubAccountCOINFuturesSummaryDeliveryAccountSummaryRespObject$`subAccountList`, "array[SubAccountCOINFuturesSummaryDeliveryAccountSummaryRespSubAccountList]", loadNamespace("binanceRapi"))
      }
      self
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`totalMarginBalanceOfBTC`)) {
        sprintf(
        '"totalMarginBalanceOfBTC":
          "%s"
                ',
        self$`totalMarginBalanceOfBTC`
        )},
        if (!is.null(self$`totalUnrealizedProfitOfBTC`)) {
        sprintf(
        '"totalUnrealizedProfitOfBTC":
          "%s"
                ',
        self$`totalUnrealizedProfitOfBTC`
        )},
        if (!is.null(self$`totalWalletBalanceOfBTC`)) {
        sprintf(
        '"totalWalletBalanceOfBTC":
          "%s"
                ',
        self$`totalWalletBalanceOfBTC`
        )},
        if (!is.null(self$`asset`)) {
        sprintf(
        '"asset":
          "%s"
                ',
        self$`asset`
        )},
        if (!is.null(self$`subAccountList`)) {
        sprintf(
        '"subAccountList":
        [%s]
',
        paste(sapply(self$`subAccountList`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox=TRUE, digits = NA)), collapse=",")
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(SubAccountCOINFuturesSummaryDeliveryAccountSummaryRespJson) {
      SubAccountCOINFuturesSummaryDeliveryAccountSummaryRespObject <- jsonlite::fromJSON(SubAccountCOINFuturesSummaryDeliveryAccountSummaryRespJson)
      self$`totalMarginBalanceOfBTC` <- SubAccountCOINFuturesSummaryDeliveryAccountSummaryRespObject$`totalMarginBalanceOfBTC`
      self$`totalUnrealizedProfitOfBTC` <- SubAccountCOINFuturesSummaryDeliveryAccountSummaryRespObject$`totalUnrealizedProfitOfBTC`
      self$`totalWalletBalanceOfBTC` <- SubAccountCOINFuturesSummaryDeliveryAccountSummaryRespObject$`totalWalletBalanceOfBTC`
      self$`asset` <- SubAccountCOINFuturesSummaryDeliveryAccountSummaryRespObject$`asset`
      self$`subAccountList` <- ApiClient$new()$deserializeObj(SubAccountCOINFuturesSummaryDeliveryAccountSummaryRespObject$`subAccountList`, "array[SubAccountCOINFuturesSummaryDeliveryAccountSummaryRespSubAccountList]", loadNamespace("binanceRapi"))
      self
    }
  )
)
grahamjwhite/binanceRapi documentation built on Nov. 22, 2022, 9:37 p.m.