# 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 MarginOcoOrder
#'
#' @description MarginOcoOrder Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field orderListId integer
#'
#' @field contingencyType character
#'
#' @field listStatusType character
#'
#' @field listOrderStatus character
#'
#' @field listClientOrderId character
#'
#' @field transactionTime integer
#'
#' @field symbol character
#'
#' @field isIsolated character
#'
#' @field orders list( \link{MarginOcoOrderOrders} )
#'
#' @field orderReports list( \link{MarginOcoOrderOrderReports} )
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
MarginOcoOrder <- R6::R6Class(
'MarginOcoOrder',
public = list(
`orderListId` = NULL,
`contingencyType` = NULL,
`listStatusType` = NULL,
`listOrderStatus` = NULL,
`listClientOrderId` = NULL,
`transactionTime` = NULL,
`symbol` = NULL,
`isIsolated` = NULL,
`orders` = NULL,
`orderReports` = NULL,
initialize = function(
`orderListId`, `contingencyType`, `listStatusType`, `listOrderStatus`, `listClientOrderId`, `transactionTime`, `symbol`, `isIsolated`, `orders`, `orderReports`, ...
) {
local.optional.var <- list(...)
if (!missing(`orderListId`)) {
stopifnot(is.numeric(`orderListId`), length(`orderListId`) == 1)
self$`orderListId` <- `orderListId`
}
if (!missing(`contingencyType`)) {
stopifnot(is.character(`contingencyType`), length(`contingencyType`) == 1)
self$`contingencyType` <- `contingencyType`
}
if (!missing(`listStatusType`)) {
stopifnot(is.character(`listStatusType`), length(`listStatusType`) == 1)
self$`listStatusType` <- `listStatusType`
}
if (!missing(`listOrderStatus`)) {
stopifnot(is.character(`listOrderStatus`), length(`listOrderStatus`) == 1)
self$`listOrderStatus` <- `listOrderStatus`
}
if (!missing(`listClientOrderId`)) {
stopifnot(is.character(`listClientOrderId`), length(`listClientOrderId`) == 1)
self$`listClientOrderId` <- `listClientOrderId`
}
if (!missing(`transactionTime`)) {
stopifnot(is.numeric(`transactionTime`), length(`transactionTime`) == 1)
self$`transactionTime` <- `transactionTime`
}
if (!missing(`symbol`)) {
stopifnot(is.character(`symbol`), length(`symbol`) == 1)
self$`symbol` <- `symbol`
}
if (!missing(`isIsolated`)) {
stopifnot(is.logical(`isIsolated`), length(`isIsolated`) == 1)
self$`isIsolated` <- `isIsolated`
}
if (!missing(`orders`)) {
stopifnot(is.vector(`orders`), length(`orders`) != 0)
sapply(`orders`, function(x) stopifnot(R6::is.R6(x)))
self$`orders` <- `orders`
}
if (!missing(`orderReports`)) {
stopifnot(is.vector(`orderReports`), length(`orderReports`) != 0)
sapply(`orderReports`, function(x) stopifnot(R6::is.R6(x)))
self$`orderReports` <- `orderReports`
}
},
toJSON = function() {
MarginOcoOrderObject <- list()
if (!is.null(self$`orderListId`)) {
MarginOcoOrderObject[['orderListId']] <-
self$`orderListId`
}
if (!is.null(self$`contingencyType`)) {
MarginOcoOrderObject[['contingencyType']] <-
self$`contingencyType`
}
if (!is.null(self$`listStatusType`)) {
MarginOcoOrderObject[['listStatusType']] <-
self$`listStatusType`
}
if (!is.null(self$`listOrderStatus`)) {
MarginOcoOrderObject[['listOrderStatus']] <-
self$`listOrderStatus`
}
if (!is.null(self$`listClientOrderId`)) {
MarginOcoOrderObject[['listClientOrderId']] <-
self$`listClientOrderId`
}
if (!is.null(self$`transactionTime`)) {
MarginOcoOrderObject[['transactionTime']] <-
self$`transactionTime`
}
if (!is.null(self$`symbol`)) {
MarginOcoOrderObject[['symbol']] <-
self$`symbol`
}
if (!is.null(self$`isIsolated`)) {
MarginOcoOrderObject[['isIsolated']] <-
self$`isIsolated`
}
if (!is.null(self$`orders`)) {
MarginOcoOrderObject[['orders']] <-
lapply(self$`orders`, function(x) x$toJSON())
}
if (!is.null(self$`orderReports`)) {
MarginOcoOrderObject[['orderReports']] <-
lapply(self$`orderReports`, function(x) x$toJSON())
}
MarginOcoOrderObject
},
fromJSON = function(MarginOcoOrderJson) {
MarginOcoOrderObject <- jsonlite::fromJSON(MarginOcoOrderJson)
if (!is.null(MarginOcoOrderObject$`orderListId`)) {
self$`orderListId` <- MarginOcoOrderObject$`orderListId`
}
if (!is.null(MarginOcoOrderObject$`contingencyType`)) {
self$`contingencyType` <- MarginOcoOrderObject$`contingencyType`
}
if (!is.null(MarginOcoOrderObject$`listStatusType`)) {
self$`listStatusType` <- MarginOcoOrderObject$`listStatusType`
}
if (!is.null(MarginOcoOrderObject$`listOrderStatus`)) {
self$`listOrderStatus` <- MarginOcoOrderObject$`listOrderStatus`
}
if (!is.null(MarginOcoOrderObject$`listClientOrderId`)) {
self$`listClientOrderId` <- MarginOcoOrderObject$`listClientOrderId`
}
if (!is.null(MarginOcoOrderObject$`transactionTime`)) {
self$`transactionTime` <- MarginOcoOrderObject$`transactionTime`
}
if (!is.null(MarginOcoOrderObject$`symbol`)) {
self$`symbol` <- MarginOcoOrderObject$`symbol`
}
if (!is.null(MarginOcoOrderObject$`isIsolated`)) {
self$`isIsolated` <- MarginOcoOrderObject$`isIsolated`
}
if (!is.null(MarginOcoOrderObject$`orders`)) {
self$`orders` <- ApiClient$new()$deserializeObj(MarginOcoOrderObject$`orders`, "array[MarginOcoOrderOrders]", loadNamespace("binanceRapi"))
}
if (!is.null(MarginOcoOrderObject$`orderReports`)) {
self$`orderReports` <- ApiClient$new()$deserializeObj(MarginOcoOrderObject$`orderReports`, "array[MarginOcoOrderOrderReports]", loadNamespace("binanceRapi"))
}
self
},
toJSONString = function() {
jsoncontent <- c(
if (!is.null(self$`orderListId`)) {
sprintf(
'"orderListId":
%d
',
self$`orderListId`
)},
if (!is.null(self$`contingencyType`)) {
sprintf(
'"contingencyType":
"%s"
',
self$`contingencyType`
)},
if (!is.null(self$`listStatusType`)) {
sprintf(
'"listStatusType":
"%s"
',
self$`listStatusType`
)},
if (!is.null(self$`listOrderStatus`)) {
sprintf(
'"listOrderStatus":
"%s"
',
self$`listOrderStatus`
)},
if (!is.null(self$`listClientOrderId`)) {
sprintf(
'"listClientOrderId":
"%s"
',
self$`listClientOrderId`
)},
if (!is.null(self$`transactionTime`)) {
sprintf(
'"transactionTime":
%d
',
self$`transactionTime`
)},
if (!is.null(self$`symbol`)) {
sprintf(
'"symbol":
"%s"
',
self$`symbol`
)},
if (!is.null(self$`isIsolated`)) {
sprintf(
'"isIsolated":
%s
',
tolower(self$`isIsolated`)
)},
if (!is.null(self$`orders`)) {
sprintf(
'"orders":
[%s]
',
paste(sapply(self$`orders`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox=TRUE, digits = NA)), collapse=",")
)},
if (!is.null(self$`orderReports`)) {
sprintf(
'"orderReports":
[%s]
',
paste(sapply(self$`orderReports`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox=TRUE, digits = NA)), collapse=",")
)}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
paste('{', jsoncontent, '}', sep = "")
},
fromJSONString = function(MarginOcoOrderJson) {
MarginOcoOrderObject <- jsonlite::fromJSON(MarginOcoOrderJson)
self$`orderListId` <- MarginOcoOrderObject$`orderListId`
self$`contingencyType` <- MarginOcoOrderObject$`contingencyType`
self$`listStatusType` <- MarginOcoOrderObject$`listStatusType`
self$`listOrderStatus` <- MarginOcoOrderObject$`listOrderStatus`
self$`listClientOrderId` <- MarginOcoOrderObject$`listClientOrderId`
self$`transactionTime` <- MarginOcoOrderObject$`transactionTime`
self$`symbol` <- MarginOcoOrderObject$`symbol`
self$`isIsolated` <- MarginOcoOrderObject$`isIsolated`
self$`orders` <- ApiClient$new()$deserializeObj(MarginOcoOrderObject$`orders`, "array[MarginOcoOrderOrders]", loadNamespace("binanceRapi"))
self$`orderReports` <- ApiClient$new()$deserializeObj(MarginOcoOrderObject$`orderReports`, "array[MarginOcoOrderOrderReports]", loadNamespace("binanceRapi"))
self
}
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.