R/inline_response2001_symbols.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 InlineResponse2001Symbols
#'
#' @description InlineResponse2001Symbols Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field symbol  character 
#'
#' @field status  character 
#'
#' @field baseAsset  character 
#'
#' @field baseAssetPrecision  integer 
#'
#' @field quoteAsset  character 
#'
#' @field quoteAssetPrecision  integer 
#'
#' @field baseCommissionPrecision  integer 
#'
#' @field quoteCommissionPrecision  integer 
#'
#' @field orderTypes  list( character ) 
#'
#' @field icebergAllowed  character 
#'
#' @field ocoAllowed  character 
#'
#' @field quoteOrderQtyMarketAllowed  character 
#'
#' @field allowTrailingStop  character 
#'
#' @field isSpotTradingAllowed  character 
#'
#' @field isMarginTradingAllowed  character 
#'
#' @field filters  list( \link{InlineResponse2001Filters} ) 
#'
#' @field permissions  list( character ) 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
InlineResponse2001Symbols <- R6::R6Class(
  'InlineResponse2001Symbols',
  public = list(
    `symbol` = NULL,
    `status` = NULL,
    `baseAsset` = NULL,
    `baseAssetPrecision` = NULL,
    `quoteAsset` = NULL,
    `quoteAssetPrecision` = NULL,
    `baseCommissionPrecision` = NULL,
    `quoteCommissionPrecision` = NULL,
    `orderTypes` = NULL,
    `icebergAllowed` = NULL,
    `ocoAllowed` = NULL,
    `quoteOrderQtyMarketAllowed` = NULL,
    `allowTrailingStop` = NULL,
    `isSpotTradingAllowed` = NULL,
    `isMarginTradingAllowed` = NULL,
    `filters` = NULL,
    `permissions` = NULL,
    initialize = function(
        `symbol`, `status`, `baseAsset`, `baseAssetPrecision`, `quoteAsset`, `quoteAssetPrecision`, `baseCommissionPrecision`, `quoteCommissionPrecision`, `orderTypes`, `icebergAllowed`, `ocoAllowed`, `quoteOrderQtyMarketAllowed`, `allowTrailingStop`, `isSpotTradingAllowed`, `isMarginTradingAllowed`, `filters`, `permissions`, ...
    ) {
      local.optional.var <- list(...)
      if (!missing(`symbol`)) {
        stopifnot(is.character(`symbol`), length(`symbol`) == 1)
        self$`symbol` <- `symbol`
      }
      if (!missing(`status`)) {
        stopifnot(is.character(`status`), length(`status`) == 1)
        self$`status` <- `status`
      }
      if (!missing(`baseAsset`)) {
        stopifnot(is.character(`baseAsset`), length(`baseAsset`) == 1)
        self$`baseAsset` <- `baseAsset`
      }
      if (!missing(`baseAssetPrecision`)) {
        stopifnot(is.numeric(`baseAssetPrecision`), length(`baseAssetPrecision`) == 1)
        self$`baseAssetPrecision` <- `baseAssetPrecision`
      }
      if (!missing(`quoteAsset`)) {
        stopifnot(is.character(`quoteAsset`), length(`quoteAsset`) == 1)
        self$`quoteAsset` <- `quoteAsset`
      }
      if (!missing(`quoteAssetPrecision`)) {
        stopifnot(is.numeric(`quoteAssetPrecision`), length(`quoteAssetPrecision`) == 1)
        self$`quoteAssetPrecision` <- `quoteAssetPrecision`
      }
      if (!missing(`baseCommissionPrecision`)) {
        stopifnot(is.numeric(`baseCommissionPrecision`), length(`baseCommissionPrecision`) == 1)
        self$`baseCommissionPrecision` <- `baseCommissionPrecision`
      }
      if (!missing(`quoteCommissionPrecision`)) {
        stopifnot(is.numeric(`quoteCommissionPrecision`), length(`quoteCommissionPrecision`) == 1)
        self$`quoteCommissionPrecision` <- `quoteCommissionPrecision`
      }
      if (!missing(`orderTypes`)) {
        stopifnot(is.vector(`orderTypes`), length(`orderTypes`) != 0)
        sapply(`orderTypes`, function(x) stopifnot(is.character(x)))
        self$`orderTypes` <- `orderTypes`
      }
      if (!missing(`icebergAllowed`)) {
        stopifnot(is.logical(`icebergAllowed`), length(`icebergAllowed`) == 1)
        self$`icebergAllowed` <- `icebergAllowed`
      }
      if (!missing(`ocoAllowed`)) {
        stopifnot(is.logical(`ocoAllowed`), length(`ocoAllowed`) == 1)
        self$`ocoAllowed` <- `ocoAllowed`
      }
      if (!missing(`quoteOrderQtyMarketAllowed`)) {
        stopifnot(is.logical(`quoteOrderQtyMarketAllowed`), length(`quoteOrderQtyMarketAllowed`) == 1)
        self$`quoteOrderQtyMarketAllowed` <- `quoteOrderQtyMarketAllowed`
      }
      if (!missing(`allowTrailingStop`)) {
        stopifnot(is.logical(`allowTrailingStop`), length(`allowTrailingStop`) == 1)
        self$`allowTrailingStop` <- `allowTrailingStop`
      }
      if (!missing(`isSpotTradingAllowed`)) {
        stopifnot(is.logical(`isSpotTradingAllowed`), length(`isSpotTradingAllowed`) == 1)
        self$`isSpotTradingAllowed` <- `isSpotTradingAllowed`
      }
      if (!missing(`isMarginTradingAllowed`)) {
        stopifnot(is.logical(`isMarginTradingAllowed`), length(`isMarginTradingAllowed`) == 1)
        self$`isMarginTradingAllowed` <- `isMarginTradingAllowed`
      }
      if (!missing(`filters`)) {
        stopifnot(is.vector(`filters`), length(`filters`) != 0)
        sapply(`filters`, function(x) stopifnot(R6::is.R6(x)))
        self$`filters` <- `filters`
      }
      if (!missing(`permissions`)) {
        stopifnot(is.vector(`permissions`), length(`permissions`) != 0)
        sapply(`permissions`, function(x) stopifnot(is.character(x)))
        self$`permissions` <- `permissions`
      }
    },
    toJSON = function() {
      InlineResponse2001SymbolsObject <- list()
      if (!is.null(self$`symbol`)) {
        InlineResponse2001SymbolsObject[['symbol']] <-
          self$`symbol`
      }
      if (!is.null(self$`status`)) {
        InlineResponse2001SymbolsObject[['status']] <-
          self$`status`
      }
      if (!is.null(self$`baseAsset`)) {
        InlineResponse2001SymbolsObject[['baseAsset']] <-
          self$`baseAsset`
      }
      if (!is.null(self$`baseAssetPrecision`)) {
        InlineResponse2001SymbolsObject[['baseAssetPrecision']] <-
          self$`baseAssetPrecision`
      }
      if (!is.null(self$`quoteAsset`)) {
        InlineResponse2001SymbolsObject[['quoteAsset']] <-
          self$`quoteAsset`
      }
      if (!is.null(self$`quoteAssetPrecision`)) {
        InlineResponse2001SymbolsObject[['quoteAssetPrecision']] <-
          self$`quoteAssetPrecision`
      }
      if (!is.null(self$`baseCommissionPrecision`)) {
        InlineResponse2001SymbolsObject[['baseCommissionPrecision']] <-
          self$`baseCommissionPrecision`
      }
      if (!is.null(self$`quoteCommissionPrecision`)) {
        InlineResponse2001SymbolsObject[['quoteCommissionPrecision']] <-
          self$`quoteCommissionPrecision`
      }
      if (!is.null(self$`orderTypes`)) {
        InlineResponse2001SymbolsObject[['orderTypes']] <-
          self$`orderTypes`
      }
      if (!is.null(self$`icebergAllowed`)) {
        InlineResponse2001SymbolsObject[['icebergAllowed']] <-
          self$`icebergAllowed`
      }
      if (!is.null(self$`ocoAllowed`)) {
        InlineResponse2001SymbolsObject[['ocoAllowed']] <-
          self$`ocoAllowed`
      }
      if (!is.null(self$`quoteOrderQtyMarketAllowed`)) {
        InlineResponse2001SymbolsObject[['quoteOrderQtyMarketAllowed']] <-
          self$`quoteOrderQtyMarketAllowed`
      }
      if (!is.null(self$`allowTrailingStop`)) {
        InlineResponse2001SymbolsObject[['allowTrailingStop']] <-
          self$`allowTrailingStop`
      }
      if (!is.null(self$`isSpotTradingAllowed`)) {
        InlineResponse2001SymbolsObject[['isSpotTradingAllowed']] <-
          self$`isSpotTradingAllowed`
      }
      if (!is.null(self$`isMarginTradingAllowed`)) {
        InlineResponse2001SymbolsObject[['isMarginTradingAllowed']] <-
          self$`isMarginTradingAllowed`
      }
      if (!is.null(self$`filters`)) {
        InlineResponse2001SymbolsObject[['filters']] <-
          lapply(self$`filters`, function(x) x$toJSON())
      }
      if (!is.null(self$`permissions`)) {
        InlineResponse2001SymbolsObject[['permissions']] <-
          self$`permissions`
      }

      InlineResponse2001SymbolsObject
    },
    fromJSON = function(InlineResponse2001SymbolsJson) {
      InlineResponse2001SymbolsObject <- jsonlite::fromJSON(InlineResponse2001SymbolsJson)
      if (!is.null(InlineResponse2001SymbolsObject$`symbol`)) {
        self$`symbol` <- InlineResponse2001SymbolsObject$`symbol`
      }
      if (!is.null(InlineResponse2001SymbolsObject$`status`)) {
        self$`status` <- InlineResponse2001SymbolsObject$`status`
      }
      if (!is.null(InlineResponse2001SymbolsObject$`baseAsset`)) {
        self$`baseAsset` <- InlineResponse2001SymbolsObject$`baseAsset`
      }
      if (!is.null(InlineResponse2001SymbolsObject$`baseAssetPrecision`)) {
        self$`baseAssetPrecision` <- InlineResponse2001SymbolsObject$`baseAssetPrecision`
      }
      if (!is.null(InlineResponse2001SymbolsObject$`quoteAsset`)) {
        self$`quoteAsset` <- InlineResponse2001SymbolsObject$`quoteAsset`
      }
      if (!is.null(InlineResponse2001SymbolsObject$`quoteAssetPrecision`)) {
        self$`quoteAssetPrecision` <- InlineResponse2001SymbolsObject$`quoteAssetPrecision`
      }
      if (!is.null(InlineResponse2001SymbolsObject$`baseCommissionPrecision`)) {
        self$`baseCommissionPrecision` <- InlineResponse2001SymbolsObject$`baseCommissionPrecision`
      }
      if (!is.null(InlineResponse2001SymbolsObject$`quoteCommissionPrecision`)) {
        self$`quoteCommissionPrecision` <- InlineResponse2001SymbolsObject$`quoteCommissionPrecision`
      }
      if (!is.null(InlineResponse2001SymbolsObject$`orderTypes`)) {
        self$`orderTypes` <- ApiClient$new()$deserializeObj(InlineResponse2001SymbolsObject$`orderTypes`, "array[character]", loadNamespace("binanceRapi"))
      }
      if (!is.null(InlineResponse2001SymbolsObject$`icebergAllowed`)) {
        self$`icebergAllowed` <- InlineResponse2001SymbolsObject$`icebergAllowed`
      }
      if (!is.null(InlineResponse2001SymbolsObject$`ocoAllowed`)) {
        self$`ocoAllowed` <- InlineResponse2001SymbolsObject$`ocoAllowed`
      }
      if (!is.null(InlineResponse2001SymbolsObject$`quoteOrderQtyMarketAllowed`)) {
        self$`quoteOrderQtyMarketAllowed` <- InlineResponse2001SymbolsObject$`quoteOrderQtyMarketAllowed`
      }
      if (!is.null(InlineResponse2001SymbolsObject$`allowTrailingStop`)) {
        self$`allowTrailingStop` <- InlineResponse2001SymbolsObject$`allowTrailingStop`
      }
      if (!is.null(InlineResponse2001SymbolsObject$`isSpotTradingAllowed`)) {
        self$`isSpotTradingAllowed` <- InlineResponse2001SymbolsObject$`isSpotTradingAllowed`
      }
      if (!is.null(InlineResponse2001SymbolsObject$`isMarginTradingAllowed`)) {
        self$`isMarginTradingAllowed` <- InlineResponse2001SymbolsObject$`isMarginTradingAllowed`
      }
      if (!is.null(InlineResponse2001SymbolsObject$`filters`)) {
        self$`filters` <- ApiClient$new()$deserializeObj(InlineResponse2001SymbolsObject$`filters`, "array[InlineResponse2001Filters]", loadNamespace("binanceRapi"))
      }
      if (!is.null(InlineResponse2001SymbolsObject$`permissions`)) {
        self$`permissions` <- ApiClient$new()$deserializeObj(InlineResponse2001SymbolsObject$`permissions`, "array[character]", loadNamespace("binanceRapi"))
      }
      self
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`symbol`)) {
        sprintf(
        '"symbol":
          "%s"
                ',
        self$`symbol`
        )},
        if (!is.null(self$`status`)) {
        sprintf(
        '"status":
          "%s"
                ',
        self$`status`
        )},
        if (!is.null(self$`baseAsset`)) {
        sprintf(
        '"baseAsset":
          "%s"
                ',
        self$`baseAsset`
        )},
        if (!is.null(self$`baseAssetPrecision`)) {
        sprintf(
        '"baseAssetPrecision":
          %d
                ',
        self$`baseAssetPrecision`
        )},
        if (!is.null(self$`quoteAsset`)) {
        sprintf(
        '"quoteAsset":
          "%s"
                ',
        self$`quoteAsset`
        )},
        if (!is.null(self$`quoteAssetPrecision`)) {
        sprintf(
        '"quoteAssetPrecision":
          %d
                ',
        self$`quoteAssetPrecision`
        )},
        if (!is.null(self$`baseCommissionPrecision`)) {
        sprintf(
        '"baseCommissionPrecision":
          %d
                ',
        self$`baseCommissionPrecision`
        )},
        if (!is.null(self$`quoteCommissionPrecision`)) {
        sprintf(
        '"quoteCommissionPrecision":
          %d
                ',
        self$`quoteCommissionPrecision`
        )},
        if (!is.null(self$`orderTypes`)) {
        sprintf(
        '"orderTypes":
           [%s]
        ',
        paste(unlist(lapply(self$`orderTypes`, function(x) paste0('"', x, '"'))), collapse=",")
        )},
        if (!is.null(self$`icebergAllowed`)) {
        sprintf(
        '"icebergAllowed":
          %s
                ',
        tolower(self$`icebergAllowed`)
        )},
        if (!is.null(self$`ocoAllowed`)) {
        sprintf(
        '"ocoAllowed":
          %s
                ',
        tolower(self$`ocoAllowed`)
        )},
        if (!is.null(self$`quoteOrderQtyMarketAllowed`)) {
        sprintf(
        '"quoteOrderQtyMarketAllowed":
          %s
                ',
        tolower(self$`quoteOrderQtyMarketAllowed`)
        )},
        if (!is.null(self$`allowTrailingStop`)) {
        sprintf(
        '"allowTrailingStop":
          %s
                ',
        tolower(self$`allowTrailingStop`)
        )},
        if (!is.null(self$`isSpotTradingAllowed`)) {
        sprintf(
        '"isSpotTradingAllowed":
          %s
                ',
        tolower(self$`isSpotTradingAllowed`)
        )},
        if (!is.null(self$`isMarginTradingAllowed`)) {
        sprintf(
        '"isMarginTradingAllowed":
          %s
                ',
        tolower(self$`isMarginTradingAllowed`)
        )},
        if (!is.null(self$`filters`)) {
        sprintf(
        '"filters":
        [%s]
',
        paste(sapply(self$`filters`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox=TRUE, digits = NA)), collapse=",")
        )},
        if (!is.null(self$`permissions`)) {
        sprintf(
        '"permissions":
           [%s]
        ',
        paste(unlist(lapply(self$`permissions`, function(x) paste0('"', x, '"'))), collapse=",")
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(InlineResponse2001SymbolsJson) {
      InlineResponse2001SymbolsObject <- jsonlite::fromJSON(InlineResponse2001SymbolsJson)
      self$`symbol` <- InlineResponse2001SymbolsObject$`symbol`
      self$`status` <- InlineResponse2001SymbolsObject$`status`
      self$`baseAsset` <- InlineResponse2001SymbolsObject$`baseAsset`
      self$`baseAssetPrecision` <- InlineResponse2001SymbolsObject$`baseAssetPrecision`
      self$`quoteAsset` <- InlineResponse2001SymbolsObject$`quoteAsset`
      self$`quoteAssetPrecision` <- InlineResponse2001SymbolsObject$`quoteAssetPrecision`
      self$`baseCommissionPrecision` <- InlineResponse2001SymbolsObject$`baseCommissionPrecision`
      self$`quoteCommissionPrecision` <- InlineResponse2001SymbolsObject$`quoteCommissionPrecision`
      self$`orderTypes` <- ApiClient$new()$deserializeObj(InlineResponse2001SymbolsObject$`orderTypes`, "array[character]", loadNamespace("binanceRapi"))
      self$`icebergAllowed` <- InlineResponse2001SymbolsObject$`icebergAllowed`
      self$`ocoAllowed` <- InlineResponse2001SymbolsObject$`ocoAllowed`
      self$`quoteOrderQtyMarketAllowed` <- InlineResponse2001SymbolsObject$`quoteOrderQtyMarketAllowed`
      self$`allowTrailingStop` <- InlineResponse2001SymbolsObject$`allowTrailingStop`
      self$`isSpotTradingAllowed` <- InlineResponse2001SymbolsObject$`isSpotTradingAllowed`
      self$`isMarginTradingAllowed` <- InlineResponse2001SymbolsObject$`isMarginTradingAllowed`
      self$`filters` <- ApiClient$new()$deserializeObj(InlineResponse2001SymbolsObject$`filters`, "array[InlineResponse2001Filters]", loadNamespace("binanceRapi"))
      self$`permissions` <- ApiClient$new()$deserializeObj(InlineResponse2001SymbolsObject$`permissions`, "array[character]", loadNamespace("binanceRapi"))
      self
    }
  )
)
grahamjwhite/binanceRapi documentation built on Nov. 22, 2022, 9:37 p.m.