R/bswap_add_liquidity_preview_single.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 BswapAddLiquidityPreviewSingle
#'
#' @description BswapAddLiquidityPreviewSingle Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field quoteAsset  character 
#'
#' @field quoteAmt  integer 
#'
#' @field price  numeric 
#'
#' @field share  numeric 
#'
#' @field slippage  numeric 
#'
#' @field fee  numeric 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
BswapAddLiquidityPreviewSingle <- R6::R6Class(
  'BswapAddLiquidityPreviewSingle',
  public = list(
    `quoteAsset` = NULL,
    `quoteAmt` = NULL,
    `price` = NULL,
    `share` = NULL,
    `slippage` = NULL,
    `fee` = NULL,
    initialize = function(
        `quoteAsset`, `quoteAmt`, `price`, `share`, `slippage`, `fee`, ...
    ) {
      local.optional.var <- list(...)
      if (!missing(`quoteAsset`)) {
        stopifnot(is.character(`quoteAsset`), length(`quoteAsset`) == 1)
        self$`quoteAsset` <- `quoteAsset`
      }
      if (!missing(`quoteAmt`)) {
        stopifnot(is.numeric(`quoteAmt`), length(`quoteAmt`) == 1)
        self$`quoteAmt` <- `quoteAmt`
      }
      if (!missing(`price`)) {
        stopifnot(is.numeric(`price`), length(`price`) == 1)
        self$`price` <- `price`
      }
      if (!missing(`share`)) {
        stopifnot(is.numeric(`share`), length(`share`) == 1)
        self$`share` <- `share`
      }
      if (!missing(`slippage`)) {
        stopifnot(is.numeric(`slippage`), length(`slippage`) == 1)
        self$`slippage` <- `slippage`
      }
      if (!missing(`fee`)) {
        stopifnot(is.numeric(`fee`), length(`fee`) == 1)
        self$`fee` <- `fee`
      }
    },
    toJSON = function() {
      BswapAddLiquidityPreviewSingleObject <- list()
      if (!is.null(self$`quoteAsset`)) {
        BswapAddLiquidityPreviewSingleObject[['quoteAsset']] <-
          self$`quoteAsset`
      }
      if (!is.null(self$`quoteAmt`)) {
        BswapAddLiquidityPreviewSingleObject[['quoteAmt']] <-
          self$`quoteAmt`
      }
      if (!is.null(self$`price`)) {
        BswapAddLiquidityPreviewSingleObject[['price']] <-
          self$`price`
      }
      if (!is.null(self$`share`)) {
        BswapAddLiquidityPreviewSingleObject[['share']] <-
          self$`share`
      }
      if (!is.null(self$`slippage`)) {
        BswapAddLiquidityPreviewSingleObject[['slippage']] <-
          self$`slippage`
      }
      if (!is.null(self$`fee`)) {
        BswapAddLiquidityPreviewSingleObject[['fee']] <-
          self$`fee`
      }

      BswapAddLiquidityPreviewSingleObject
    },
    fromJSON = function(BswapAddLiquidityPreviewSingleJson) {
      BswapAddLiquidityPreviewSingleObject <- jsonlite::fromJSON(BswapAddLiquidityPreviewSingleJson)
      if (!is.null(BswapAddLiquidityPreviewSingleObject$`quoteAsset`)) {
        self$`quoteAsset` <- BswapAddLiquidityPreviewSingleObject$`quoteAsset`
      }
      if (!is.null(BswapAddLiquidityPreviewSingleObject$`quoteAmt`)) {
        self$`quoteAmt` <- BswapAddLiquidityPreviewSingleObject$`quoteAmt`
      }
      if (!is.null(BswapAddLiquidityPreviewSingleObject$`price`)) {
        self$`price` <- BswapAddLiquidityPreviewSingleObject$`price`
      }
      if (!is.null(BswapAddLiquidityPreviewSingleObject$`share`)) {
        self$`share` <- BswapAddLiquidityPreviewSingleObject$`share`
      }
      if (!is.null(BswapAddLiquidityPreviewSingleObject$`slippage`)) {
        self$`slippage` <- BswapAddLiquidityPreviewSingleObject$`slippage`
      }
      if (!is.null(BswapAddLiquidityPreviewSingleObject$`fee`)) {
        self$`fee` <- BswapAddLiquidityPreviewSingleObject$`fee`
      }
      self
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`quoteAsset`)) {
        sprintf(
        '"quoteAsset":
          "%s"
                ',
        self$`quoteAsset`
        )},
        if (!is.null(self$`quoteAmt`)) {
        sprintf(
        '"quoteAmt":
          %d
                ',
        self$`quoteAmt`
        )},
        if (!is.null(self$`price`)) {
        sprintf(
        '"price":
          %d
                ',
        self$`price`
        )},
        if (!is.null(self$`share`)) {
        sprintf(
        '"share":
          %d
                ',
        self$`share`
        )},
        if (!is.null(self$`slippage`)) {
        sprintf(
        '"slippage":
          %d
                ',
        self$`slippage`
        )},
        if (!is.null(self$`fee`)) {
        sprintf(
        '"fee":
          %d
                ',
        self$`fee`
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(BswapAddLiquidityPreviewSingleJson) {
      BswapAddLiquidityPreviewSingleObject <- jsonlite::fromJSON(BswapAddLiquidityPreviewSingleJson)
      self$`quoteAsset` <- BswapAddLiquidityPreviewSingleObject$`quoteAsset`
      self$`quoteAmt` <- BswapAddLiquidityPreviewSingleObject$`quoteAmt`
      self$`price` <- BswapAddLiquidityPreviewSingleObject$`price`
      self$`share` <- BswapAddLiquidityPreviewSingleObject$`share`
      self$`slippage` <- BswapAddLiquidityPreviewSingleObject$`slippage`
      self$`fee` <- BswapAddLiquidityPreviewSingleObject$`fee`
      self
    }
  )
)
grahamjwhite/binanceRapi documentation built on Nov. 22, 2022, 9:37 p.m.