R/margin_order_response_full.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 MarginOrderResponseFull
#'
#' @description MarginOrderResponseFull Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field symbol  character 
#'
#' @field orderId  integer 
#'
#' @field clientOrderId  character 
#'
#' @field transactTime  integer 
#'
#' @field price  character 
#'
#' @field origQty  character 
#'
#' @field executedQty  character 
#'
#' @field cummulativeQuoteQty  character 
#'
#' @field status  character 
#'
#' @field timeInForce  character 
#'
#' @field type  character 
#'
#' @field side  character 
#'
#' @field marginBuyBorrowAmount  numeric 
#'
#' @field marginBuyBorrowAsset  character 
#'
#' @field isIsolated  character 
#'
#' @field fills  list( \link{OrderResponseFullFills} ) 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
MarginOrderResponseFull <- R6::R6Class(
  'MarginOrderResponseFull',
  public = list(
    `symbol` = NULL,
    `orderId` = NULL,
    `clientOrderId` = NULL,
    `transactTime` = NULL,
    `price` = NULL,
    `origQty` = NULL,
    `executedQty` = NULL,
    `cummulativeQuoteQty` = NULL,
    `status` = NULL,
    `timeInForce` = NULL,
    `type` = NULL,
    `side` = NULL,
    `marginBuyBorrowAmount` = NULL,
    `marginBuyBorrowAsset` = NULL,
    `isIsolated` = NULL,
    `fills` = NULL,
    initialize = function(
        `symbol`, `orderId`, `clientOrderId`, `transactTime`, `price`, `origQty`, `executedQty`, `cummulativeQuoteQty`, `status`, `timeInForce`, `type`, `side`, `marginBuyBorrowAmount`, `marginBuyBorrowAsset`, `isIsolated`, `fills`, ...
    ) {
      local.optional.var <- list(...)
      if (!missing(`symbol`)) {
        stopifnot(is.character(`symbol`), length(`symbol`) == 1)
        self$`symbol` <- `symbol`
      }
      if (!missing(`orderId`)) {
        stopifnot(is.numeric(`orderId`), length(`orderId`) == 1)
        self$`orderId` <- `orderId`
      }
      if (!missing(`clientOrderId`)) {
        stopifnot(is.character(`clientOrderId`), length(`clientOrderId`) == 1)
        self$`clientOrderId` <- `clientOrderId`
      }
      if (!missing(`transactTime`)) {
        stopifnot(is.numeric(`transactTime`), length(`transactTime`) == 1)
        self$`transactTime` <- `transactTime`
      }
      if (!missing(`price`)) {
        stopifnot(is.character(`price`), length(`price`) == 1)
        self$`price` <- `price`
      }
      if (!missing(`origQty`)) {
        stopifnot(is.character(`origQty`), length(`origQty`) == 1)
        self$`origQty` <- `origQty`
      }
      if (!missing(`executedQty`)) {
        stopifnot(is.character(`executedQty`), length(`executedQty`) == 1)
        self$`executedQty` <- `executedQty`
      }
      if (!missing(`cummulativeQuoteQty`)) {
        stopifnot(is.character(`cummulativeQuoteQty`), length(`cummulativeQuoteQty`) == 1)
        self$`cummulativeQuoteQty` <- `cummulativeQuoteQty`
      }
      if (!missing(`status`)) {
        stopifnot(is.character(`status`), length(`status`) == 1)
        self$`status` <- `status`
      }
      if (!missing(`timeInForce`)) {
        stopifnot(is.character(`timeInForce`), length(`timeInForce`) == 1)
        self$`timeInForce` <- `timeInForce`
      }
      if (!missing(`type`)) {
        stopifnot(is.character(`type`), length(`type`) == 1)
        self$`type` <- `type`
      }
      if (!missing(`side`)) {
        stopifnot(is.character(`side`), length(`side`) == 1)
        self$`side` <- `side`
      }
      if (!missing(`marginBuyBorrowAmount`)) {
        stopifnot(is.numeric(`marginBuyBorrowAmount`), length(`marginBuyBorrowAmount`) == 1)
        self$`marginBuyBorrowAmount` <- `marginBuyBorrowAmount`
      }
      if (!missing(`marginBuyBorrowAsset`)) {
        stopifnot(is.character(`marginBuyBorrowAsset`), length(`marginBuyBorrowAsset`) == 1)
        self$`marginBuyBorrowAsset` <- `marginBuyBorrowAsset`
      }
      if (!missing(`isIsolated`)) {
        stopifnot(is.logical(`isIsolated`), length(`isIsolated`) == 1)
        self$`isIsolated` <- `isIsolated`
      }
      if (!missing(`fills`)) {
        stopifnot(is.vector(`fills`), length(`fills`) != 0)
        sapply(`fills`, function(x) stopifnot(R6::is.R6(x)))
        self$`fills` <- `fills`
      }
    },
    toJSON = function() {
      MarginOrderResponseFullObject <- list()
      if (!is.null(self$`symbol`)) {
        MarginOrderResponseFullObject[['symbol']] <-
          self$`symbol`
      }
      if (!is.null(self$`orderId`)) {
        MarginOrderResponseFullObject[['orderId']] <-
          self$`orderId`
      }
      if (!is.null(self$`clientOrderId`)) {
        MarginOrderResponseFullObject[['clientOrderId']] <-
          self$`clientOrderId`
      }
      if (!is.null(self$`transactTime`)) {
        MarginOrderResponseFullObject[['transactTime']] <-
          self$`transactTime`
      }
      if (!is.null(self$`price`)) {
        MarginOrderResponseFullObject[['price']] <-
          self$`price`
      }
      if (!is.null(self$`origQty`)) {
        MarginOrderResponseFullObject[['origQty']] <-
          self$`origQty`
      }
      if (!is.null(self$`executedQty`)) {
        MarginOrderResponseFullObject[['executedQty']] <-
          self$`executedQty`
      }
      if (!is.null(self$`cummulativeQuoteQty`)) {
        MarginOrderResponseFullObject[['cummulativeQuoteQty']] <-
          self$`cummulativeQuoteQty`
      }
      if (!is.null(self$`status`)) {
        MarginOrderResponseFullObject[['status']] <-
          self$`status`
      }
      if (!is.null(self$`timeInForce`)) {
        MarginOrderResponseFullObject[['timeInForce']] <-
          self$`timeInForce`
      }
      if (!is.null(self$`type`)) {
        MarginOrderResponseFullObject[['type']] <-
          self$`type`
      }
      if (!is.null(self$`side`)) {
        MarginOrderResponseFullObject[['side']] <-
          self$`side`
      }
      if (!is.null(self$`marginBuyBorrowAmount`)) {
        MarginOrderResponseFullObject[['marginBuyBorrowAmount']] <-
          self$`marginBuyBorrowAmount`
      }
      if (!is.null(self$`marginBuyBorrowAsset`)) {
        MarginOrderResponseFullObject[['marginBuyBorrowAsset']] <-
          self$`marginBuyBorrowAsset`
      }
      if (!is.null(self$`isIsolated`)) {
        MarginOrderResponseFullObject[['isIsolated']] <-
          self$`isIsolated`
      }
      if (!is.null(self$`fills`)) {
        MarginOrderResponseFullObject[['fills']] <-
          lapply(self$`fills`, function(x) x$toJSON())
      }

      MarginOrderResponseFullObject
    },
    fromJSON = function(MarginOrderResponseFullJson) {
      MarginOrderResponseFullObject <- jsonlite::fromJSON(MarginOrderResponseFullJson)
      if (!is.null(MarginOrderResponseFullObject$`symbol`)) {
        self$`symbol` <- MarginOrderResponseFullObject$`symbol`
      }
      if (!is.null(MarginOrderResponseFullObject$`orderId`)) {
        self$`orderId` <- MarginOrderResponseFullObject$`orderId`
      }
      if (!is.null(MarginOrderResponseFullObject$`clientOrderId`)) {
        self$`clientOrderId` <- MarginOrderResponseFullObject$`clientOrderId`
      }
      if (!is.null(MarginOrderResponseFullObject$`transactTime`)) {
        self$`transactTime` <- MarginOrderResponseFullObject$`transactTime`
      }
      if (!is.null(MarginOrderResponseFullObject$`price`)) {
        self$`price` <- MarginOrderResponseFullObject$`price`
      }
      if (!is.null(MarginOrderResponseFullObject$`origQty`)) {
        self$`origQty` <- MarginOrderResponseFullObject$`origQty`
      }
      if (!is.null(MarginOrderResponseFullObject$`executedQty`)) {
        self$`executedQty` <- MarginOrderResponseFullObject$`executedQty`
      }
      if (!is.null(MarginOrderResponseFullObject$`cummulativeQuoteQty`)) {
        self$`cummulativeQuoteQty` <- MarginOrderResponseFullObject$`cummulativeQuoteQty`
      }
      if (!is.null(MarginOrderResponseFullObject$`status`)) {
        self$`status` <- MarginOrderResponseFullObject$`status`
      }
      if (!is.null(MarginOrderResponseFullObject$`timeInForce`)) {
        self$`timeInForce` <- MarginOrderResponseFullObject$`timeInForce`
      }
      if (!is.null(MarginOrderResponseFullObject$`type`)) {
        self$`type` <- MarginOrderResponseFullObject$`type`
      }
      if (!is.null(MarginOrderResponseFullObject$`side`)) {
        self$`side` <- MarginOrderResponseFullObject$`side`
      }
      if (!is.null(MarginOrderResponseFullObject$`marginBuyBorrowAmount`)) {
        self$`marginBuyBorrowAmount` <- MarginOrderResponseFullObject$`marginBuyBorrowAmount`
      }
      if (!is.null(MarginOrderResponseFullObject$`marginBuyBorrowAsset`)) {
        self$`marginBuyBorrowAsset` <- MarginOrderResponseFullObject$`marginBuyBorrowAsset`
      }
      if (!is.null(MarginOrderResponseFullObject$`isIsolated`)) {
        self$`isIsolated` <- MarginOrderResponseFullObject$`isIsolated`
      }
      if (!is.null(MarginOrderResponseFullObject$`fills`)) {
        self$`fills` <- ApiClient$new()$deserializeObj(MarginOrderResponseFullObject$`fills`, "array[OrderResponseFullFills]", loadNamespace("binanceRapi"))
      }
      self
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`symbol`)) {
        sprintf(
        '"symbol":
          "%s"
                ',
        self$`symbol`
        )},
        if (!is.null(self$`orderId`)) {
        sprintf(
        '"orderId":
          %d
                ',
        self$`orderId`
        )},
        if (!is.null(self$`clientOrderId`)) {
        sprintf(
        '"clientOrderId":
          "%s"
                ',
        self$`clientOrderId`
        )},
        if (!is.null(self$`transactTime`)) {
        sprintf(
        '"transactTime":
          %d
                ',
        self$`transactTime`
        )},
        if (!is.null(self$`price`)) {
        sprintf(
        '"price":
          "%s"
                ',
        self$`price`
        )},
        if (!is.null(self$`origQty`)) {
        sprintf(
        '"origQty":
          "%s"
                ',
        self$`origQty`
        )},
        if (!is.null(self$`executedQty`)) {
        sprintf(
        '"executedQty":
          "%s"
                ',
        self$`executedQty`
        )},
        if (!is.null(self$`cummulativeQuoteQty`)) {
        sprintf(
        '"cummulativeQuoteQty":
          "%s"
                ',
        self$`cummulativeQuoteQty`
        )},
        if (!is.null(self$`status`)) {
        sprintf(
        '"status":
          "%s"
                ',
        self$`status`
        )},
        if (!is.null(self$`timeInForce`)) {
        sprintf(
        '"timeInForce":
          "%s"
                ',
        self$`timeInForce`
        )},
        if (!is.null(self$`type`)) {
        sprintf(
        '"type":
          "%s"
                ',
        self$`type`
        )},
        if (!is.null(self$`side`)) {
        sprintf(
        '"side":
          "%s"
                ',
        self$`side`
        )},
        if (!is.null(self$`marginBuyBorrowAmount`)) {
        sprintf(
        '"marginBuyBorrowAmount":
          %d
                ',
        self$`marginBuyBorrowAmount`
        )},
        if (!is.null(self$`marginBuyBorrowAsset`)) {
        sprintf(
        '"marginBuyBorrowAsset":
          "%s"
                ',
        self$`marginBuyBorrowAsset`
        )},
        if (!is.null(self$`isIsolated`)) {
        sprintf(
        '"isIsolated":
          %s
                ',
        tolower(self$`isIsolated`)
        )},
        if (!is.null(self$`fills`)) {
        sprintf(
        '"fills":
        [%s]
',
        paste(sapply(self$`fills`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox=TRUE, digits = NA)), collapse=",")
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(MarginOrderResponseFullJson) {
      MarginOrderResponseFullObject <- jsonlite::fromJSON(MarginOrderResponseFullJson)
      self$`symbol` <- MarginOrderResponseFullObject$`symbol`
      self$`orderId` <- MarginOrderResponseFullObject$`orderId`
      self$`clientOrderId` <- MarginOrderResponseFullObject$`clientOrderId`
      self$`transactTime` <- MarginOrderResponseFullObject$`transactTime`
      self$`price` <- MarginOrderResponseFullObject$`price`
      self$`origQty` <- MarginOrderResponseFullObject$`origQty`
      self$`executedQty` <- MarginOrderResponseFullObject$`executedQty`
      self$`cummulativeQuoteQty` <- MarginOrderResponseFullObject$`cummulativeQuoteQty`
      self$`status` <- MarginOrderResponseFullObject$`status`
      self$`timeInForce` <- MarginOrderResponseFullObject$`timeInForce`
      self$`type` <- MarginOrderResponseFullObject$`type`
      self$`side` <- MarginOrderResponseFullObject$`side`
      self$`marginBuyBorrowAmount` <- MarginOrderResponseFullObject$`marginBuyBorrowAmount`
      self$`marginBuyBorrowAsset` <- MarginOrderResponseFullObject$`marginBuyBorrowAsset`
      self$`isIsolated` <- MarginOrderResponseFullObject$`isIsolated`
      self$`fills` <- ApiClient$new()$deserializeObj(MarginOrderResponseFullObject$`fills`, "array[OrderResponseFullFills]", loadNamespace("binanceRapi"))
      self
    }
  )
)
grahamjwhite/binanceRapi documentation built on Nov. 22, 2022, 9:37 p.m.