R/margin_api.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 Margin operations
#' @description binanceRapi.Margin
#' @format An \code{R6Class} generator object
#' @field apiClient Handles the client-server communication.
#'
#' @section Methods:
#' \describe{
#' \strong{ SapiV1BnbBurnGet } \emph{ Get All Isolated Margin Symbol(USER_DATA) }
#' Weight(IP): 1
#'
#' \itemize{
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } \link{BnbBurnStatus} \cr
#'
#'
#' \item status code : 200 | Status on BNB to pay for trading fees
#'
#' \item return type : BnbBurnStatus 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Unauthorized Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ SapiV1BnbBurnPost } \emph{ Toggle BNB Burn On Spot Trade And Margin Interest (USER_DATA) }
#' - \"spotBNBBurn\" and \"interestBNBBurn\" should be sent at least one.  Weight(IP): 1
#'
#' \itemize{
#' \item \emph{ @param } spot.bnb.burn Enum < [true, false] >
#' \item \emph{ @param } interest.bnb.burn Enum < [true, false] >
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } \link{BnbBurnStatus} \cr
#'
#'
#' \item status code : 200 | Status on BNB to pay for trading fees
#'
#' \item return type : BnbBurnStatus 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Unauthorized Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ SapiV1MarginAccountGet } \emph{ Query Cross Margin Account Details (USER_DATA) }
#' Weight(IP): 10
#'
#' \itemize{
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } \link{InlineResponse20019} \cr
#'
#'
#' \item status code : 200 | Margin account details
#'
#' \item return type : InlineResponse20019 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Unauthorized Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ SapiV1MarginAllAssetsGet } \emph{ Get All Margin Assets (MARKET_DATA) }
#' Weight(IP): 1
#'
#' \itemize{
#' \item \emph{ @returnType } list( \link{inline_response_200_14} ) \cr
#'
#'
#' \item status code : 200 | Assets details
#'
#' \item return type : array[InlineResponse20014] 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ SapiV1MarginAllOrderListGet } \emph{ Query Margin Account&#39;s all OCO (USER_DATA) }
#' Retrieves all OCO for a specific margin account based on provided optional parameters  Weight(IP): 200
#'
#' \itemize{
#' \item \emph{ @param } is.isolated Enum < [TRUE, FALSE] >
#' \item \emph{ @param } symbol character
#' \item \emph{ @param } from.id character
#' \item \emph{ @param } start.time integer
#' \item \emph{ @param } end.time integer
#' \item \emph{ @param } limit integer
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } list( \link{inline_response_200_6} ) \cr
#'
#'
#' \item status code : 200 | List of Margin OCO orders
#'
#' \item return type : array[InlineResponse2006] 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Unauthorized Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ SapiV1MarginAllOrdersGet } \emph{ Query Margin Account&#39;s All Orders (USER_DATA) }
#' - If &#x60;orderId&#x60; is set, it will get orders &gt;&#x3D; that orderId. Otherwise most recent orders are returned. - For some historical orders &#x60;cummulativeQuoteQty&#x60; will be &lt; 0, meaning the data is not available at this time.  Weight(IP): 200  Request Limit: 60 times/min per IP
#'
#' \itemize{
#' \item \emph{ @param } symbol character
#' \item \emph{ @param } is.isolated Enum < [TRUE, FALSE] >
#' \item \emph{ @param } order.id integer
#' \item \emph{ @param } start.time integer
#' \item \emph{ @param } end.time integer
#' \item \emph{ @param } limit integer
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } list( \link{marginOrderDetail} ) \cr
#'
#'
#' \item status code : 200 | Margin order list
#'
#' \item return type : array[MarginOrderDetail] 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Unauthorized Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ SapiV1MarginAllPairsGet } \emph{ Get All Cross Margin Pairs (MARKET_DATA) }
#' Weight(IP): 1
#'
#' \itemize{
#' \item \emph{ @returnType } list( \link{inline_response_200_15} ) \cr
#'
#'
#' \item status code : 200 | Margin pairs
#'
#' \item return type : array[InlineResponse20015] 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ SapiV1MarginAssetGet } \emph{ Query Margin Asset (MARKET_DATA) }
#' Weight(IP): 10
#'
#' \itemize{
#' \item \emph{ @param } asset character
#' \item \emph{ @returnType } \link{InlineResponse20012} \cr
#'
#'
#' \item status code : 200 | Asset details
#'
#' \item return type : InlineResponse20012 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ SapiV1MarginCrossMarginDataGet } \emph{ Query Cross Margin Fee Data (USER_DATA) }
#' Get cross margin fee data collection with any vip level or user&#39;s current specific data as https://www.binance.com/en/margin-fee  Weight(IP): 1 when coin is specified; 5 when the coin parameter is omitted
#'
#' \itemize{
#' \item \emph{ @param } vip.level integer
#' \item \emph{ @param } coin character
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } list( \link{inline_response_200_29} ) \cr
#'
#'
#' \item status code : 200 | Cross Margin Fee Data
#'
#' \item return type : array[InlineResponse20029] 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Unauthorized Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ SapiV1MarginForceLiquidationRecGet } \emph{ Get Force Liquidation Record (USER_DATA) }
#' - Response in descending order  Weight(IP): 1
#'
#' \itemize{
#' \item \emph{ @param } start.time integer
#' \item \emph{ @param } end.time integer
#' \item \emph{ @param } isolated.symbol character
#' \item \emph{ @param } current integer
#' \item \emph{ @param } size integer
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } \link{InlineResponse20018} \cr
#'
#'
#' \item status code : 200 | Force Liquidation History, response in descending order
#'
#' \item return type : InlineResponse20018 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Unauthorized Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ SapiV1MarginInterestHistoryGet } \emph{ Get Interest History (USER_DATA) }
#' - Response in descending order - If &#x60;isolatedSymbol&#x60; is not sent, crossed margin data will be returned - Set &#x60;archived&#x60; to &#x60;true&#x60; to query data from 6 months ago - &#x60;type&#x60; in response has 4 enums:   - &#x60;PERIODIC&#x60; interest charged per hour   - &#x60;ON_BORROW&#x60; first interest charged on borrow   - &#x60;PERIODIC_CONVERTED&#x60; interest charged per hour converted into BNB   - &#x60;ON_BORROW_CONVERTED&#x60; first interest charged on borrow converted into BNB  Weight(IP): 1
#'
#' \itemize{
#' \item \emph{ @param } asset character
#' \item \emph{ @param } isolated.symbol character
#' \item \emph{ @param } start.time integer
#' \item \emph{ @param } end.time integer
#' \item \emph{ @param } current integer
#' \item \emph{ @param } size integer
#' \item \emph{ @param } archived character
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } \link{InlineResponse20017} \cr
#'
#'
#' \item status code : 200 | Interest History, response in descending order
#'
#' \item return type : InlineResponse20017 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Unauthorized Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ SapiV1MarginInterestRateHistoryGet } \emph{ Margin Interest Rate History (USER_DATA) }
#' The max interval between startTime and endTime is 30 days.  Weight(IP): 1
#'
#' \itemize{
#' \item \emph{ @param } asset character
#' \item \emph{ @param } vip.level integer
#' \item \emph{ @param } start.time integer
#' \item \emph{ @param } end.time integer
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } list( \link{inline_response_200_28} ) \cr
#'
#'
#' \item status code : 200 | Margin Interest Rate History
#'
#' \item return type : array[InlineResponse20028] 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Unauthorized Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ SapiV1MarginIsolatedAccountDelete } \emph{ Disable Isolated Margin Account (TRADE) }
#' Disable isolated margin account for a specific symbol. Each trading pair can only be deactivated once every 24 hours .  Weight(UID): 300
#'
#' \itemize{
#' \item \emph{ @param } symbol character
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } \link{InlineResponse20025} \cr
#'
#'
#' \item status code : 200 | Isolated Margin Account status
#'
#' \item return type : InlineResponse20025 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Unauthorized Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ SapiV1MarginIsolatedAccountGet } \emph{ Query Isolated Margin Account Info (USER_DATA) }
#' - If \&quot;symbols\&quot; is not sent, all isolated assets will be returned. - If \&quot;symbols\&quot; is sent, only the isolated assets of the sent symbols will be returned.  Weight(IP): 10
#'
#' \itemize{
#' \item \emph{ @param } symbols character
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } \link{IsolatedMarginAccountInfo} \cr
#'
#'
#' \item status code : 200 | Isolated Margin Account Info when \&quot;symbols\&quot; is not sent
#'
#' \item return type : IsolatedMarginAccountInfo 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Unauthorized Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ SapiV1MarginIsolatedAccountLimitGet } \emph{ Query Enabled Isolated Margin Account Limit (USER_DATA) }
#' Query enabled isolated margin account limit.  Weight(IP): 1
#'
#' \itemize{
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } \link{InlineResponse20026} \cr
#'
#'
#' \item status code : 200 | Number of enabled Isolated Margin Account and its limit
#'
#' \item return type : InlineResponse20026 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Unauthorized Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ SapiV1MarginIsolatedAccountPost } \emph{ Enable Isolated Margin Account (TRADE) }
#' Enable isolated margin account for a specific symbol.  Weight(UID): 300
#'
#' \itemize{
#' \item \emph{ @param } symbol character
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } \link{InlineResponse20025} \cr
#'
#'
#' \item status code : 200 | Isolated Margin Account status
#'
#' \item return type : InlineResponse20025 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Unauthorized Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ SapiV1MarginIsolatedAllPairsGet } \emph{ Get All Isolated Margin Symbol(USER_DATA) }
#' Weight(IP): 10
#'
#' \itemize{
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } list( \link{inline_response_200_27} ) \cr
#'
#'
#' \item status code : 200 | All Isolated Margin Symbols
#'
#' \item return type : array[InlineResponse20027] 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Unauthorized Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ SapiV1MarginIsolatedMarginDataGet } \emph{ Query Isolated Margin Fee Data (USER_DATA) }
#' Get isolated margin fee data collection with any vip level or user&#39;s current specific data as https://www.binance.com/en/margin-fee  Weight(IP): 1 when a single is specified; 10 when the symbol parameter is omitted
#'
#' \itemize{
#' \item \emph{ @param } vip.level integer
#' \item \emph{ @param } symbol character
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } list( \link{inline_response_200_30} ) \cr
#'
#'
#' \item status code : 200 | Isolated Margin Fee Data
#'
#' \item return type : array[InlineResponse20030] 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Unauthorized Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ SapiV1MarginIsolatedMarginTierGet } \emph{ Query Isolated Margin Tier Data (USER_DATA) }
#' Get isolated margin tier data collection with any tier as https://www.binance.com/en/margin-data  Weight(IP): 1
#'
#' \itemize{
#' \item \emph{ @param } symbol character
#' \item \emph{ @param } tier character
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } list( \link{inline_response_200_31} ) \cr
#'
#'
#' \item status code : 200 | Isolated Margin Tier Data
#'
#' \item return type : array[InlineResponse20031] 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Unauthorized Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ SapiV1MarginIsolatedPairGet } \emph{ Query Isolated Margin Symbol (USER_DATA) }
#' Weight(IP): 10
#'
#' \itemize{
#' \item \emph{ @param } symbol character
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } \link{InlineResponse20027} \cr
#'
#'
#' \item status code : 200 | Isolated Margin Symbol
#'
#' \item return type : InlineResponse20027 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Unauthorized Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ SapiV1MarginIsolatedTransferGet } \emph{ Get Isolated Margin Transfer History (USER_DATA) }
#' Weight(IP): 1
#'
#' \itemize{
#' \item \emph{ @param } symbol character
#' \item \emph{ @param } asset character
#' \item \emph{ @param } trans.from Enum < [SPOT, ISOLATED_MARGIN] >
#' \item \emph{ @param } trans.to Enum < [SPOT, ISOLATED_MARGIN] >
#' \item \emph{ @param } start.time integer
#' \item \emph{ @param } end.time integer
#' \item \emph{ @param } current integer
#' \item \emph{ @param } size integer
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } \link{MarginTransferDetails} \cr
#'
#'
#' \item status code : 200 | Isolated Margin Transfer History
#'
#' \item return type : MarginTransferDetails 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Unauthorized Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ SapiV1MarginIsolatedTransferPost } \emph{ Isolated Margin Account Transfer (MARGIN) }
#' Weight(UID): 600
#'
#' \itemize{
#' \item \emph{ @param } asset character
#' \item \emph{ @param } symbol character
#' \item \emph{ @param } trans.from Enum < [SPOT, ISOLATED_MARGIN] >
#' \item \emph{ @param } trans.to Enum < [SPOT, ISOLATED_MARGIN] >
#' \item \emph{ @param } amount numeric
#' \item \emph{ @param } recv.window integer
#'
#'
#' \item status code : 200 | Transaction Id
#'
#' \item return type : object 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Unauthorized Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ SapiV1MarginLoanGet } \emph{ Query Loan Record (USER_DATA) }
#' - &#x60;txId&#x60; or &#x60;startTime&#x60; must be sent. &#x60;txId&#x60; takes precedence. - Response in descending order - If &#x60;isolatedSymbol&#x60; is not sent, crossed margin data will be returned - Set &#x60;archived&#x60; to &#x60;true&#x60; to query data from 6 months ago  Weight(IP): 10
#'
#' \itemize{
#' \item \emph{ @param } asset character
#' \item \emph{ @param } isolated.symbol character
#' \item \emph{ @param } tx.id integer
#' \item \emph{ @param } start.time integer
#' \item \emph{ @param } end.time integer
#' \item \emph{ @param } current integer
#' \item \emph{ @param } size integer
#' \item \emph{ @param } archived character
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } \link{InlineResponse20010} \cr
#'
#'
#' \item status code : 200 | Loan records
#'
#' \item return type : InlineResponse20010 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Unauthorized Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ SapiV1MarginLoanPost } \emph{ Margin Account Borrow (MARGIN) }
#' Apply for a loan.  - If \&quot;isIsolated\&quot; &#x3D; \&quot;TRUE\&quot;, \&quot;symbol\&quot; must be sent - \&quot;isIsolated\&quot; &#x3D; \&quot;FALSE\&quot; for crossed margin loan  Weight(UID): 3000
#'
#' \itemize{
#' \item \emph{ @param } asset character
#' \item \emph{ @param } amount numeric
#' \item \emph{ @param } is.isolated Enum < [TRUE, FALSE] >
#' \item \emph{ @param } symbol character
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } \link{Transaction} \cr
#'
#'
#' \item status code : 200 | Transaction id
#'
#' \item return type : Transaction 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Unauthorized Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ SapiV1MarginMaxBorrowableGet } \emph{ Query Max Borrow (USER_DATA) }
#' - If &#x60;isolatedSymbol&#x60; is not sent, crossed margin data will be sent. - &#x60;borrowLimit&#x60; is also available from https://www.binance.com/en/margin-fee  Weight(IP): 50
#'
#' \itemize{
#' \item \emph{ @param } asset character
#' \item \emph{ @param } isolated.symbol character
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } \link{InlineResponse20023} \cr
#'
#'
#' \item status code : 200 | Details on max borrow amount
#'
#' \item return type : InlineResponse20023 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Unauthorized Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ SapiV1MarginMaxTransferableGet } \emph{ Query Max Transfer-Out Amount (USER_DATA) }
#' - If &#x60;isolatedSymbol&#x60; is not sent, crossed margin data will be sent.  Weight(IP): 50
#'
#' \itemize{
#' \item \emph{ @param } asset character
#' \item \emph{ @param } isolated.symbol character
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } \link{InlineResponse20024} \cr
#'
#'
#' \item status code : 200 | Details on max transferable amount
#'
#' \item return type : InlineResponse20024 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Unauthorized Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ SapiV1MarginMyTradesGet } \emph{ Query Margin Account&#39;s Trade List (USER_DATA) }
#' - If &#x60;fromId&#x60; is set, it will get orders &gt;&#x3D; that &#x60;fromId&#x60;. Otherwise most recent trades are returned.  Weight(IP): 10
#'
#' \itemize{
#' \item \emph{ @param } symbol character
#' \item \emph{ @param } is.isolated Enum < [TRUE, FALSE] >
#' \item \emph{ @param } start.time integer
#' \item \emph{ @param } end.time integer
#' \item \emph{ @param } from.id integer
#' \item \emph{ @param } limit integer
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } list( \link{marginTrade} ) \cr
#'
#'
#' \item status code : 200 | List of margin trades
#'
#' \item return type : array[MarginTrade] 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Unauthorized Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ SapiV1MarginOpenOrderListGet } \emph{ Query Margin Account&#39;s Open OCO (USER_DATA) }
#' Weight(IP): 10
#'
#' \itemize{
#' \item \emph{ @param } is.isolated Enum < [TRUE, FALSE] >
#' \item \emph{ @param } symbol character
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } list( \link{inline_response_200_22} ) \cr
#'
#'
#' \item status code : 200 | List of Open Margin OCO orders
#'
#' \item return type : array[InlineResponse20022] 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Unauthorized Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ SapiV1MarginOpenOrdersDelete } \emph{ Margin Account Cancel all Open Orders on a Symbol (TRADE) }
#' - Cancels all active orders on a symbol for margin account. - This includes OCO orders.  Weight(IP): 1 
#'
#' \itemize{
#' \item \emph{ @param } symbol character
#' \item \emph{ @param } is.isolated Enum < [TRUE, FALSE] >
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } list( \link{anyOf&lt;canceledMarginOrderDetail,marginOcoOrder&gt;} ) \cr
#'
#'
#' \item status code : 200 | Cancelled margin orders
#'
#' \item return type : array[AnyOfcanceledMarginOrderDetailmarginOcoOrder] 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Unauthorized Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ SapiV1MarginOpenOrdersGet } \emph{ Query Margin Account&#39;s Open Orders (USER_DATA) }
#' - If the &#x60;symbol&#x60; is not sent, orders for all symbols will be returned in an array. - When all symbols are returned, the number of requests counted against the rate limiter is equal to the number of symbols currently trading on the exchange - If isIsolated &#x3D;\&quot;TRUE\&quot;, symbol must be sent.  Weight(IP): 10
#'
#' \itemize{
#' \item \emph{ @param } symbol character
#' \item \emph{ @param } is.isolated Enum < [TRUE, FALSE] >
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } list( \link{marginOrderDetail} ) \cr
#'
#'
#' \item status code : 200 | Margin open orders list
#'
#' \item return type : array[MarginOrderDetail] 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Unauthorized Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ SapiV1MarginOrderDelete } \emph{ Margin Account Cancel Order (TRADE) }
#' Cancel an active order for margin account.  Either &#x60;orderId&#x60; or &#x60;origClientOrderId&#x60; must be sent.  Weight(IP): 10
#'
#' \itemize{
#' \item \emph{ @param } symbol character
#' \item \emph{ @param } is.isolated Enum < [TRUE, FALSE] >
#' \item \emph{ @param } order.id integer
#' \item \emph{ @param } orig.client.order.id character
#' \item \emph{ @param } new.client.order.id character
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } \link{MarginOrder} \cr
#'
#'
#' \item status code : 200 | Cancelled margin order details
#'
#' \item return type : MarginOrder 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Unauthorized Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ SapiV1MarginOrderGet } \emph{ Query Margin Account&#39;s Order (USER_DATA) }
#' - Either &#x60;orderId&#x60; or &#x60;origClientOrderId&#x60; must be sent. - For some historical orders &#x60;cummulativeQuoteQty&#x60; will be &lt; 0, meaning the data is not available at this time.  Weight(IP): 10
#'
#' \itemize{
#' \item \emph{ @param } symbol character
#' \item \emph{ @param } is.isolated Enum < [TRUE, FALSE] >
#' \item \emph{ @param } order.id integer
#' \item \emph{ @param } orig.client.order.id character
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } \link{MarginOrderDetail} \cr
#'
#'
#' \item status code : 200 | Interest History, response in descending order
#'
#' \item return type : MarginOrderDetail 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Unauthorized Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ SapiV1MarginOrderListDelete } \emph{ Margin Account Cancel OCO (TRADE) }
#' Cancel an entire Order List for a margin account  - Canceling an individual leg will cancel the entire OCO - Either &#x60;orderListId&#x60; or &#x60;listClientOrderId&#x60; must be provided  Weight(UID): 1
#'
#' \itemize{
#' \item \emph{ @param } symbol character
#' \item \emph{ @param } is.isolated Enum < [TRUE, FALSE] >
#' \item \emph{ @param } order.list.id integer
#' \item \emph{ @param } list.client.order.id character
#' \item \emph{ @param } new.client.order.id character
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } \link{MarginOcoOrder} \cr
#'
#'
#' \item status code : 200 | Margin OCO details
#'
#' \item return type : MarginOcoOrder 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Unauthorized Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ SapiV1MarginOrderListGet } \emph{ Query Margin Account&#39;s OCO (USER_DATA) }
#' Retrieves a specific OCO based on provided optional parameters  - Either &#x60;orderListId&#x60; or &#x60;origClientOrderId&#x60; must be provided  Weight(IP): 10
#'
#' \itemize{
#' \item \emph{ @param } is.isolated Enum < [TRUE, FALSE] >
#' \item \emph{ @param } symbol character
#' \item \emph{ @param } order.list.id integer
#' \item \emph{ @param } orig.client.order.id character
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } \link{InlineResponse20021} \cr
#'
#'
#' \item status code : 200 | Margin OCO details
#'
#' \item return type : InlineResponse20021 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Unauthorized Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ SapiV1MarginOrderOcoPost } \emph{ Margin Account New OCO (TRADE) }
#' Send in a new OCO for a margin account  - Price Restrictions:   - SELL: Limit Price &gt; Last Price &gt; Stop Price   - BUY: Limit Price &lt; Last Price &lt; Stop Price - Quantity Restrictions:   - Both legs must have the same quantity   - ICEBERG quantities however do not have to be the same. - Order Rate Limit   - OCO counts as 2 orders against the order rate limit.  Weight(UID): 6
#'
#' \itemize{
#' \item \emph{ @param } symbol character
#' \item \emph{ @param } side Enum < [SELL, BUY] >
#' \item \emph{ @param } quantity numeric
#' \item \emph{ @param } price numeric
#' \item \emph{ @param } stop.price numeric
#' \item \emph{ @param } is.isolated Enum < [TRUE, FALSE] >
#' \item \emph{ @param } list.client.order.id character
#' \item \emph{ @param } limit.client.order.id character
#' \item \emph{ @param } limit.iceberg.qty numeric
#' \item \emph{ @param } stop.client.order.id character
#' \item \emph{ @param } stop.limit.price numeric
#' \item \emph{ @param } stop.iceberg.qty numeric
#' \item \emph{ @param } stop.limit.time.in.force Enum < [GTC, FOK, IOC] >
#' \item \emph{ @param } new.order.resp.type Enum < [ACK, RESULT, FULL] >
#' \item \emph{ @param } side.effect.type Enum < [NO_SIDE_EFFECT, MARGIN_BUY, AUTO_REPAY] >
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } \link{InlineResponse20020} \cr
#'
#'
#' \item status code : 200 | New Margin OCO details
#'
#' \item return type : InlineResponse20020 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Unauthorized Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ SapiV1MarginOrderPost } \emph{ Margin Account New Order (TRADE) }
#' Post a new order for margin account.  Weight(UID): 6
#'
#' \itemize{
#' \item \emph{ @param } symbol character
#' \item \emph{ @param } side Enum < [SELL, BUY] >
#' \item \emph{ @param } type Enum < [LIMIT, MARKET, STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, TAKE_PROFIT_LIMIT, LIMIT_MAKER] >
#' \item \emph{ @param } quantity numeric
#' \item \emph{ @param } is.isolated Enum < [TRUE, FALSE] >
#' \item \emph{ @param } quote.order.qty numeric
#' \item \emph{ @param } price numeric
#' \item \emph{ @param } stop.price numeric
#' \item \emph{ @param } new.client.order.id character
#' \item \emph{ @param } iceberg.qty numeric
#' \item \emph{ @param } new.order.resp.type Enum < [ACK, RESULT, FULL] >
#' \item \emph{ @param } side.effect.type Enum < [NO_SIDE_EFFECT, MARGIN_BUY, AUTO_REPAY] >
#' \item \emph{ @param } time.in.force Enum < [GTC, IOC, FOK] >
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } \link{OneOfmarginOrderResponseAckmarginOrderResponseResultmarginOrderResponseFull} \cr
#'
#'
#' \item status code : 200 | Margin order info
#'
#' \item return type : OneOfmarginOrderResponseAckmarginOrderResponseResultmarginOrderResponseFull 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Unauthorized Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ SapiV1MarginPairGet } \emph{ Query Cross Margin Pair (MARKET_DATA) }
#' Weight(IP): 10
#'
#' \itemize{
#' \item \emph{ @param } symbol character
#' \item \emph{ @returnType } \link{InlineResponse20013} \cr
#'
#'
#' \item status code : 200 | Margin pair details
#'
#' \item return type : InlineResponse20013 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ SapiV1MarginPriceIndexGet } \emph{ Query Margin PriceIndex (MARKET_DATA) }
#' Weight(IP): 10
#'
#' \itemize{
#' \item \emph{ @param } symbol character
#' \item \emph{ @returnType } \link{InlineResponse20016} \cr
#'
#'
#' \item status code : 200 | Price index
#'
#' \item return type : InlineResponse20016 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ SapiV1MarginRateLimitOrderGet } \emph{ Query Current Margin Order Count Usage (TRADE) }
#' Displays the user&#39;s current margin order count usage for all intervals.  Weight(IP): 20
#'
#' \itemize{
#' \item \emph{ @param } timestamp integer
#' \item \emph{ @param } signature character
#' \item \emph{ @param } is.isolated character
#' \item \emph{ @param } symbol character
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } list( \link{inline_response_200_32} ) \cr
#'
#'
#' \item status code : 200 | Usage.
#'
#' \item return type : array[InlineResponse20032] 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Unauthorized Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ SapiV1MarginRepayGet } \emph{ Query Repay Record (USER_DATA) }
#' - &#x60;txId&#x60; or &#x60;startTime&#x60; must be sent. &#x60;txId&#x60; takes precedence. - Response in descending order - If &#x60;isolatedSymbol&#x60; is not sent, crossed margin data will be returned - Set &#x60;archived&#x60; to &#x60;true&#x60; to query data from 6 months ago  Weight(IP): 10
#'
#' \itemize{
#' \item \emph{ @param } asset character
#' \item \emph{ @param } isolated.symbol character
#' \item \emph{ @param } tx.id integer
#' \item \emph{ @param } start.time integer
#' \item \emph{ @param } end.time integer
#' \item \emph{ @param } current integer
#' \item \emph{ @param } size integer
#' \item \emph{ @param } archived character
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } \link{InlineResponse20011} \cr
#'
#'
#' \item status code : 200 | Load records
#'
#' \item return type : InlineResponse20011 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Unauthorized Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ SapiV1MarginRepayPost } \emph{ Margin Account Repay (MARGIN) }
#' Repay loan for margin account.  - If \&quot;isIsolated\&quot; &#x3D; \&quot;TRUE\&quot;, \&quot;symbol\&quot; must be sent - \&quot;isIsolated\&quot; &#x3D; \&quot;FALSE\&quot; for crossed margin repay  Weight(IP): 3000
#'
#' \itemize{
#' \item \emph{ @param } asset character
#' \item \emph{ @param } amount numeric
#' \item \emph{ @param } is.isolated Enum < [TRUE, FALSE] >
#' \item \emph{ @param } symbol character
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } \link{Transaction} \cr
#'
#'
#' \item status code : 200 | Transaction id
#'
#' \item return type : Transaction 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Unauthorized Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ SapiV1MarginTransferGet } \emph{ Get Cross Margin Transfer History (USER_DATA) }
#' - Response in descending order - Returns data for last 7 days by default - Set &#x60;archived&#x60; to &#x60;true&#x60; to query data from 6 months ago  Weight(IP): 1
#'
#' \itemize{
#' \item \emph{ @param } asset character
#' \item \emph{ @param } type Enum < [ROLL_IN, ROLL_OUT] >
#' \item \emph{ @param } start.time integer
#' \item \emph{ @param } end.time integer
#' \item \emph{ @param } current integer
#' \item \emph{ @param } size integer
#' \item \emph{ @param } archived character
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } \link{InlineResponse2009} \cr
#'
#'
#' \item status code : 200 | Margin account transfer history, response in descending order
#'
#' \item return type : InlineResponse2009 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Unauthorized Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ SapiV1MarginTransferPost } \emph{ Cross Margin Account Transfer (MARGIN) }
#' Execute transfer between spot account and cross margin account.  Weight(IP): 600
#'
#' \itemize{
#' \item \emph{ @param } asset character
#' \item \emph{ @param } amount numeric
#' \item \emph{ @param } type Enum < [1, 2] >
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } \link{Transaction} \cr
#'
#'
#' \item status code : 200 | Transfer Id
#'
#' \item return type : Transaction 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Unauthorized Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' }
#'
#'
#' @examples
#' \dontrun{
#' ####################  SapiV1BnbBurnGet  ####################
#'
#' library(binanceRapi)
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Get All Isolated Margin Symbol(USER_DATA)
#' api.instance <- MarginApi$new()
#'
#' result <- api.instance$SapiV1BnbBurnGet(recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1BnbBurnPost  ####################
#'
#' library(binanceRapi)
#' var.spot.bnb.burn <- 'true' # character | Determines whether to use BNB to pay for trading fees on SPOT
#' var.interest.bnb.burn <- 'false' # character | Determines whether to use BNB to pay for margin loan's interest
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Toggle BNB Burn On Spot Trade And Margin Interest (USER_DATA)
#' api.instance <- MarginApi$new()
#'
#' result <- api.instance$SapiV1BnbBurnPost(spot.bnb.burn=var.spot.bnb.burn, interest.bnb.burn=var.interest.bnb.burn, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1MarginAccountGet  ####################
#'
#' library(binanceRapi)
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Query Cross Margin Account Details (USER_DATA)
#' api.instance <- MarginApi$new()
#'
#' result <- api.instance$SapiV1MarginAccountGet(recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1MarginAllAssetsGet  ####################
#'
#' library(binanceRapi)
#'
#' #Get All Margin Assets (MARKET_DATA)
#' api.instance <- MarginApi$new()
#'
#' result <- api.instance$SapiV1MarginAllAssetsGet()
#'
#'
#' ####################  SapiV1MarginAllOrderListGet  ####################
#'
#' library(binanceRapi)
#' var.is.isolated <- 'is.isolated_example' # character | * `TRUE` - For isolated margin * `FALSE` - Default, not for isolated margin
#' var.symbol <- 'symbol_example' # character | Mandatory for isolated margin, not supported for cross margin
#' var.from.id <- 'from.id_example' # character | If supplied, neither `startTime` or `endTime` can be provided
#' var.start.time <- 56 # integer | UTC timestamp in ms
#' var.end.time <- 56 # integer | UTC timestamp in ms
#' var.limit <- 56 # integer | Default Value: 500; Max Value: 1000
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Query Margin Account's all OCO (USER_DATA)
#' api.instance <- MarginApi$new()
#'
#' result <- api.instance$SapiV1MarginAllOrderListGet(is.isolated=var.is.isolated, symbol=var.symbol, from.id=var.from.id, start.time=var.start.time, end.time=var.end.time, limit=var.limit, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1MarginAllOrdersGet  ####################
#'
#' library(binanceRapi)
#' var.symbol <- 'BNBUSDT' # character | Trading symbol, e.g. BNBUSDT
#' var.is.isolated <- 'is.isolated_example' # character | * `TRUE` - For isolated margin * `FALSE` - Default, not for isolated margin
#' var.order.id <- 56 # integer | Order id
#' var.start.time <- 56 # integer | UTC timestamp in ms
#' var.end.time <- 56 # integer | UTC timestamp in ms
#' var.limit <- 500 # integer | Default 500; max 1000.
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Query Margin Account's All Orders (USER_DATA)
#' api.instance <- MarginApi$new()
#'
#' result <- api.instance$SapiV1MarginAllOrdersGet(var.symbol, is.isolated=var.is.isolated, order.id=var.order.id, start.time=var.start.time, end.time=var.end.time, limit=var.limit, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1MarginAllPairsGet  ####################
#'
#' library(binanceRapi)
#'
#' #Get All Cross Margin Pairs (MARKET_DATA)
#' api.instance <- MarginApi$new()
#'
#' result <- api.instance$SapiV1MarginAllPairsGet()
#'
#'
#' ####################  SapiV1MarginAssetGet  ####################
#'
#' library(binanceRapi)
#' var.asset <- 'BTC' # character | 
#'
#' #Query Margin Asset (MARKET_DATA)
#' api.instance <- MarginApi$new()
#'
#' result <- api.instance$SapiV1MarginAssetGet(var.asset)
#'
#'
#' ####################  SapiV1MarginCrossMarginDataGet  ####################
#'
#' library(binanceRapi)
#' var.vip.level <- 1 # integer | Defaults to user's vip level
#' var.coin <- 'BNB' # character | Coin name
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Query Cross Margin Fee Data (USER_DATA)
#' api.instance <- MarginApi$new()
#'
#' result <- api.instance$SapiV1MarginCrossMarginDataGet(vip.level=var.vip.level, coin=var.coin, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1MarginForceLiquidationRecGet  ####################
#'
#' library(binanceRapi)
#' var.start.time <- 56 # integer | UTC timestamp in ms
#' var.end.time <- 56 # integer | UTC timestamp in ms
#' var.isolated.symbol <- 'isolated.symbol_example' # character | Isolated symbol
#' var.current <- 1 # integer | Current querying page. Start from 1. Default:1
#' var.size <- 100 # integer | Default:10 Max:100
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Get Force Liquidation Record (USER_DATA)
#' api.instance <- MarginApi$new()
#'
#' result <- api.instance$SapiV1MarginForceLiquidationRecGet(start.time=var.start.time, end.time=var.end.time, isolated.symbol=var.isolated.symbol, current=var.current, size=var.size, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1MarginInterestHistoryGet  ####################
#'
#' library(binanceRapi)
#' var.asset <- 'BNB' # character | 
#' var.isolated.symbol <- 'isolated.symbol_example' # character | Isolated symbol
#' var.start.time <- 56 # integer | UTC timestamp in ms
#' var.end.time <- 56 # integer | UTC timestamp in ms
#' var.current <- 1 # integer | Current querying page. Start from 1. Default:1
#' var.size <- 100 # integer | Default:10 Max:100
#' var.archived <- 'archived_example' # character | Default: false. Set to true for archived data from 6 months ago
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Get Interest History (USER_DATA)
#' api.instance <- MarginApi$new()
#'
#' result <- api.instance$SapiV1MarginInterestHistoryGet(asset=var.asset, isolated.symbol=var.isolated.symbol, start.time=var.start.time, end.time=var.end.time, current=var.current, size=var.size, archived=var.archived, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1MarginInterestRateHistoryGet  ####################
#'
#' library(binanceRapi)
#' var.asset <- 'BTC' # character | 
#' var.vip.level <- 1 # integer | Defaults to user's vip level
#' var.start.time <- 56 # integer | UTC timestamp in ms
#' var.end.time <- 56 # integer | UTC timestamp in ms
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Margin Interest Rate History (USER_DATA)
#' api.instance <- MarginApi$new()
#'
#' result <- api.instance$SapiV1MarginInterestRateHistoryGet(var.asset, vip.level=var.vip.level, start.time=var.start.time, end.time=var.end.time, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1MarginIsolatedAccountDelete  ####################
#'
#' library(binanceRapi)
#' var.symbol <- 'BNBUSDT' # character | Trading symbol, e.g. BNBUSDT
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Disable Isolated Margin Account (TRADE)
#' api.instance <- MarginApi$new()
#'
#' result <- api.instance$SapiV1MarginIsolatedAccountDelete(var.symbol, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1MarginIsolatedAccountGet  ####################
#'
#' library(binanceRapi)
#' var.symbols <- 'BTCUSDT,BNBUSDT,ADAUSDT' # character | Max 5 symbols can be sent; separated by ','
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Query Isolated Margin Account Info (USER_DATA)
#' api.instance <- MarginApi$new()
#'
#' result <- api.instance$SapiV1MarginIsolatedAccountGet(symbols=var.symbols, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1MarginIsolatedAccountLimitGet  ####################
#'
#' library(binanceRapi)
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Query Enabled Isolated Margin Account Limit (USER_DATA)
#' api.instance <- MarginApi$new()
#'
#' result <- api.instance$SapiV1MarginIsolatedAccountLimitGet(recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1MarginIsolatedAccountPost  ####################
#'
#' library(binanceRapi)
#' var.symbol <- 'BNBUSDT' # character | Trading symbol, e.g. BNBUSDT
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Enable Isolated Margin Account (TRADE)
#' api.instance <- MarginApi$new()
#'
#' result <- api.instance$SapiV1MarginIsolatedAccountPost(var.symbol, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1MarginIsolatedAllPairsGet  ####################
#'
#' library(binanceRapi)
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Get All Isolated Margin Symbol(USER_DATA)
#' api.instance <- MarginApi$new()
#'
#' result <- api.instance$SapiV1MarginIsolatedAllPairsGet(recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1MarginIsolatedMarginDataGet  ####################
#'
#' library(binanceRapi)
#' var.vip.level <- 1 # integer | Defaults to user's vip level
#' var.symbol <- 'BNBUSDT' # character | Trading symbol, e.g. BNBUSDT
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Query Isolated Margin Fee Data (USER_DATA)
#' api.instance <- MarginApi$new()
#'
#' result <- api.instance$SapiV1MarginIsolatedMarginDataGet(vip.level=var.vip.level, symbol=var.symbol, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1MarginIsolatedMarginTierGet  ####################
#'
#' library(binanceRapi)
#' var.symbol <- 'BNBUSDT' # character | Trading symbol, e.g. BNBUSDT
#' var.tier <- '1' # character | All margin tier data will be returned if tier is omitted
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Query Isolated Margin Tier Data (USER_DATA)
#' api.instance <- MarginApi$new()
#' 
#' result <- api.instance$SapiV1MarginIsolatedMarginTierGet(var.symbol, tier=var.tier, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1MarginIsolatedPairGet  ####################
#'
#' library(binanceRapi)
#' var.symbol <- 'BNBUSDT' # character | Trading symbol, e.g. BNBUSDT
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Query Isolated Margin Symbol (USER_DATA)
#' api.instance <- MarginApi$new()
#'
#' result <- api.instance$SapiV1MarginIsolatedPairGet(var.symbol, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1MarginIsolatedTransferGet  ####################
#'
#' library(binanceRapi)
#' var.symbol <- 'BNBUSDT' # character | Trading symbol, e.g. BNBUSDT
#' var.asset <- 'BNB' # character | 
#' var.trans.from <- 'SPOT' # character | 
#' var.trans.to <- 'ISOLATED_MARGIN' # character | 
#' var.start.time <- 56 # integer | UTC timestamp in ms
#' var.end.time <- 56 # integer | UTC timestamp in ms
#' var.current <- 1 # integer | Current querying page. Start from 1. Default:1
#' var.size <- 100 # integer | Default:10 Max:100
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Get Isolated Margin Transfer History (USER_DATA)
#' api.instance <- MarginApi$new()
#'
#' result <- api.instance$SapiV1MarginIsolatedTransferGet(var.symbol, asset=var.asset, trans.from=var.trans.from, trans.to=var.trans.to, start.time=var.start.time, end.time=var.end.time, current=var.current, size=var.size, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1MarginIsolatedTransferPost  ####################
#'
#' library(binanceRapi)
#' var.asset <- 'BTC' # character | 
#' var.symbol <- 'BNBUSDT' # character | Trading symbol, e.g. BNBUSDT
#' var.trans.from <- 'SPOT' # character | 
#' var.trans.to <- 'ISOLATED_MARGIN' # character | 
#' var.amount <- 1.01 # numeric | 
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Isolated Margin Account Transfer (MARGIN)
#' api.instance <- MarginApi$new()
#'
#' result <- api.instance$SapiV1MarginIsolatedTransferPost(var.asset, var.symbol, var.trans.from, var.trans.to, var.amount, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1MarginLoanGet  ####################
#'
#' library(binanceRapi)
#' var.asset <- 'BTC' # character | 
#' var.isolated.symbol <- 'isolated.symbol_example' # character | Isolated symbol
#' var.tx.id <- 123456789 # integer | the tranId in  `POST /sapi/v1/margin/loan`
#' var.start.time <- 56 # integer | UTC timestamp in ms
#' var.end.time <- 56 # integer | UTC timestamp in ms
#' var.current <- 1 # integer | Current querying page. Start from 1. Default:1
#' var.size <- 100 # integer | Default:10 Max:100
#' var.archived <- 'archived_example' # character | Default: false. Set to true for archived data from 6 months ago
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Query Loan Record (USER_DATA)
#' api.instance <- MarginApi$new()
#'
#' result <- api.instance$SapiV1MarginLoanGet(var.asset, isolated.symbol=var.isolated.symbol, tx.id=var.tx.id, start.time=var.start.time, end.time=var.end.time, current=var.current, size=var.size, archived=var.archived, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1MarginLoanPost  ####################
#'
#' library(binanceRapi)
#' var.asset <- 'BTC' # character | 
#' var.amount <- 1.01 # numeric | 
#' var.is.isolated <- 'is.isolated_example' # character | * `TRUE` - For isolated margin * `FALSE` - Default, not for isolated margin
#' var.symbol <- 'BNBUSDT' # character | Trading symbol, e.g. BNBUSDT
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Margin Account Borrow (MARGIN)
#' api.instance <- MarginApi$new()
#'
#' result <- api.instance$SapiV1MarginLoanPost(var.asset, var.amount, is.isolated=var.is.isolated, symbol=var.symbol, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1MarginMaxBorrowableGet  ####################
#'
#' library(binanceRapi)
#' var.asset <- 'BTC' # character | 
#' var.isolated.symbol <- 'isolated.symbol_example' # character | Isolated symbol
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Query Max Borrow (USER_DATA)
#' api.instance <- MarginApi$new()
#'
#' result <- api.instance$SapiV1MarginMaxBorrowableGet(var.asset, isolated.symbol=var.isolated.symbol, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1MarginMaxTransferableGet  ####################
#'
#' library(binanceRapi)
#' var.asset <- 'BTC' # character | 
#' var.isolated.symbol <- 'isolated.symbol_example' # character | Isolated symbol
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Query Max Transfer-Out Amount (USER_DATA)
#' api.instance <- MarginApi$new()
#'
#' result <- api.instance$SapiV1MarginMaxTransferableGet(var.asset, isolated.symbol=var.isolated.symbol, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1MarginMyTradesGet  ####################
#'
#' library(binanceRapi)
#' var.symbol <- 'BNBUSDT' # character | Trading symbol, e.g. BNBUSDT
#' var.is.isolated <- 'is.isolated_example' # character | * `TRUE` - For isolated margin * `FALSE` - Default, not for isolated margin
#' var.start.time <- 56 # integer | UTC timestamp in ms
#' var.end.time <- 56 # integer | UTC timestamp in ms
#' var.from.id <- 56 # integer | Trade id to fetch from. Default gets most recent trades.
#' var.limit <- 500 # integer | Default 500; max 1000.
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Query Margin Account's Trade List (USER_DATA)
#' api.instance <- MarginApi$new()
#'
#' result <- api.instance$SapiV1MarginMyTradesGet(var.symbol, is.isolated=var.is.isolated, start.time=var.start.time, end.time=var.end.time, from.id=var.from.id, limit=var.limit, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1MarginOpenOrderListGet  ####################
#'
#' library(binanceRapi)
#' var.is.isolated <- 'is.isolated_example' # character | * `TRUE` - For isolated margin * `FALSE` - Default, not for isolated margin
#' var.symbol <- 'symbol_example' # character | Mandatory for isolated margin, not supported for cross margin
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Query Margin Account's Open OCO (USER_DATA)
#' api.instance <- MarginApi$new()
#'
#' result <- api.instance$SapiV1MarginOpenOrderListGet(is.isolated=var.is.isolated, symbol=var.symbol, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1MarginOpenOrdersDelete  ####################
#'
#' library(binanceRapi)
#' var.symbol <- 'BNBUSDT' # character | Trading symbol, e.g. BNBUSDT
#' var.is.isolated <- 'is.isolated_example' # character | * `TRUE` - For isolated margin * `FALSE` - Default, not for isolated margin
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Margin Account Cancel all Open Orders on a Symbol (TRADE)
#' api.instance <- MarginApi$new()
#'
#' result <- api.instance$SapiV1MarginOpenOrdersDelete(var.symbol, is.isolated=var.is.isolated, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1MarginOpenOrdersGet  ####################
#'
#' library(binanceRapi)
#' var.symbol <- 'BNBUSDT' # character | Trading symbol, e.g. BNBUSDT
#' var.is.isolated <- 'is.isolated_example' # character | * `TRUE` - For isolated margin * `FALSE` - Default, not for isolated margin
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Query Margin Account's Open Orders (USER_DATA)
#' api.instance <- MarginApi$new()
#'
#' result <- api.instance$SapiV1MarginOpenOrdersGet(symbol=var.symbol, is.isolated=var.is.isolated, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1MarginOrderDelete  ####################
#'
#' library(binanceRapi)
#' var.symbol <- 'BNBUSDT' # character | Trading symbol, e.g. BNBUSDT
#' var.is.isolated <- 'is.isolated_example' # character | * `TRUE` - For isolated margin * `FALSE` - Default, not for isolated margin
#' var.order.id <- 56 # integer | Order id
#' var.orig.client.order.id <- 'orig.client.order.id_example' # character | Order id from client
#' var.new.client.order.id <- 'new.client.order.id_example' # character | Used to uniquely identify this cancel. Automatically generated by default
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Margin Account Cancel Order (TRADE)
#' api.instance <- MarginApi$new()
#'
#' result <- api.instance$SapiV1MarginOrderDelete(var.symbol, is.isolated=var.is.isolated, order.id=var.order.id, orig.client.order.id=var.orig.client.order.id, new.client.order.id=var.new.client.order.id, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1MarginOrderGet  ####################
#'
#' library(binanceRapi)
#' var.symbol <- 'BNBUSDT' # character | Trading symbol, e.g. BNBUSDT
#' var.is.isolated <- 'is.isolated_example' # character | * `TRUE` - For isolated margin * `FALSE` - Default, not for isolated margin
#' var.order.id <- 56 # integer | Order id
#' var.orig.client.order.id <- 'orig.client.order.id_example' # character | Order id from client
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Query Margin Account's Order (USER_DATA)
#' api.instance <- MarginApi$new()
#'
#' result <- api.instance$SapiV1MarginOrderGet(var.symbol, is.isolated=var.is.isolated, order.id=var.order.id, orig.client.order.id=var.orig.client.order.id, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1MarginOrderListDelete  ####################
#'
#' library(binanceRapi)
#' var.symbol <- 'BNBUSDT' # character | Trading symbol, e.g. BNBUSDT
#' var.is.isolated <- 'is.isolated_example' # character | * `TRUE` - For isolated margin * `FALSE` - Default, not for isolated margin
#' var.order.list.id <- 56 # integer | Order list id
#' var.list.client.order.id <- 'list.client.order.id_example' # character | A unique Id for the entire orderList
#' var.new.client.order.id <- 'new.client.order.id_example' # character | Used to uniquely identify this cancel. Automatically generated by default
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Margin Account Cancel OCO (TRADE)
#' api.instance <- MarginApi$new()
#'
#' result <- api.instance$SapiV1MarginOrderListDelete(var.symbol, is.isolated=var.is.isolated, order.list.id=var.order.list.id, list.client.order.id=var.list.client.order.id, new.client.order.id=var.new.client.order.id, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1MarginOrderListGet  ####################
#'
#' library(binanceRapi)
#' var.is.isolated <- 'is.isolated_example' # character | * `TRUE` - For isolated margin * `FALSE` - Default, not for isolated margin
#' var.symbol <- 'symbol_example' # character | Mandatory for isolated margin, not supported for cross margin
#' var.order.list.id <- 56 # integer | Order list id
#' var.orig.client.order.id <- 'orig.client.order.id_example' # character | Order id from client
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Query Margin Account's OCO (USER_DATA)
#' api.instance <- MarginApi$new()
#'
#' result <- api.instance$SapiV1MarginOrderListGet(is.isolated=var.is.isolated, symbol=var.symbol, order.list.id=var.order.list.id, orig.client.order.id=var.orig.client.order.id, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1MarginOrderOcoPost  ####################
#'
#' library(binanceRapi)
#' var.symbol <- 'BNBUSDT' # character | Trading symbol, e.g. BNBUSDT
#' var.side <- 'SELL' # character | 
#' var.quantity <- 3.4 # numeric | 
#' var.price <- 3.4 # numeric | Order price
#' var.stop.price <- 3.4 # numeric | 
#' var.is.isolated <- 'is.isolated_example' # character | * `TRUE` - For isolated margin * `FALSE` - Default, not for isolated margin
#' var.list.client.order.id <- 'list.client.order.id_example' # character | A unique Id for the entire orderList
#' var.limit.client.order.id <- 'limit.client.order.id_example' # character | A unique Id for the limit order
#' var.limit.iceberg.qty <- 3.4 # numeric | 
#' var.stop.client.order.id <- 'stop.client.order.id_example' # character | A unique Id for the stop loss/stop loss limit leg
#' var.stop.limit.price <- 3.4 # numeric | If provided, stopLimitTimeInForce is required.
#' var.stop.iceberg.qty <- 3.4 # numeric | 
#' var.stop.limit.time.in.force <- 'stop.limit.time.in.force_example' # character | 
#' var.new.order.resp.type <- 'new.order.resp.type_example' # character | Set the response JSON.
#' var.side.effect.type <- 'side.effect.type_example' # character | Default `NO_SIDE_EFFECT`
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Margin Account New OCO (TRADE)
#' api.instance <- MarginApi$new()
#'
#' result <- api.instance$SapiV1MarginOrderOcoPost(var.symbol, var.side, var.quantity, var.price, var.stop.price, is.isolated=var.is.isolated, list.client.order.id=var.list.client.order.id, limit.client.order.id=var.limit.client.order.id, limit.iceberg.qty=var.limit.iceberg.qty, stop.client.order.id=var.stop.client.order.id, stop.limit.price=var.stop.limit.price, stop.iceberg.qty=var.stop.iceberg.qty, stop.limit.time.in.force=var.stop.limit.time.in.force, new.order.resp.type=var.new.order.resp.type, side.effect.type=var.side.effect.type, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1MarginOrderPost  ####################
#'
#' library(binanceRapi)
#' var.symbol <- 'BNBUSDT' # character | Trading symbol, e.g. BNBUSDT
#' var.side <- 'SELL' # character | 
#' var.type <- 'type_example' # character | Order type
#' var.quantity <- 3.4 # numeric | 
#' var.is.isolated <- 'is.isolated_example' # character | * `TRUE` - For isolated margin * `FALSE` - Default, not for isolated margin
#' var.quote.order.qty <- 3.4 # numeric | Quote quantity
#' var.price <- 3.4 # numeric | Order price
#' var.stop.price <- 20.01 # numeric | Used with STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, and TAKE_PROFIT_LIMIT orders.
#' var.new.client.order.id <- 'new.client.order.id_example' # character | Used to uniquely identify this cancel. Automatically generated by default
#' var.iceberg.qty <- 3.4 # numeric | Used with LIMIT, STOP_LOSS_LIMIT, and TAKE_PROFIT_LIMIT to create an iceberg order.
#' var.new.order.resp.type <- 'new.order.resp.type_example' # character | Set the response JSON.
#' var.side.effect.type <- 'side.effect.type_example' # character | Default `NO_SIDE_EFFECT`
#' var.time.in.force <- 'time.in.force_example' # character | Order time in force
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Margin Account New Order (TRADE)
#' api.instance <- MarginApi$new()
#'
#' result <- api.instance$SapiV1MarginOrderPost(var.symbol, var.side, var.type, var.quantity, is.isolated=var.is.isolated, quote.order.qty=var.quote.order.qty, price=var.price, stop.price=var.stop.price, new.client.order.id=var.new.client.order.id, iceberg.qty=var.iceberg.qty, new.order.resp.type=var.new.order.resp.type, side.effect.type=var.side.effect.type, time.in.force=var.time.in.force, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1MarginPairGet  ####################
#'
#' library(binanceRapi)
#' var.symbol <- 'BNBUSDT' # character | Trading symbol, e.g. BNBUSDT
#'
#' #Query Cross Margin Pair (MARKET_DATA)
#' api.instance <- MarginApi$new()
#'
#' result <- api.instance$SapiV1MarginPairGet(var.symbol)
#'
#'
#' ####################  SapiV1MarginPriceIndexGet  ####################
#'
#' library(binanceRapi)
#' var.symbol <- 'BNBUSDT' # character | Trading symbol, e.g. BNBUSDT
#'
#' #Query Margin PriceIndex (MARKET_DATA)
#' api.instance <- MarginApi$new()
#'
#' result <- api.instance$SapiV1MarginPriceIndexGet(var.symbol)
#'
#'
#' ####################  SapiV1MarginRateLimitOrderGet  ####################
#'
#' library(binanceRapi)
#' var.is.isolated <- 'is.isolated_example' # character | * `TRUE` - For isolated margin * `FALSE` - Default, not for isolated margin
#' var.symbol <- 'symbol_example' # character | isolated symbol, mandatory for isolated margin
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Query Current Margin Order Count Usage (TRADE)
#' api.instance <- MarginApi$new()
#'
#' result <- api.instance$SapiV1MarginRateLimitOrderGet(is.isolated=var.is.isolated, symbol=var.symbol, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1MarginRepayGet  ####################
#'
#' library(binanceRapi)
#' var.asset <- 'BTC' # character | 
#' var.isolated.symbol <- 'isolated.symbol_example' # character | Isolated symbol
#' var.tx.id <- 2970933056 # integer | the tranId in  `POST /sapi/v1/margin/repay`
#' var.start.time <- 56 # integer | UTC timestamp in ms
#' var.end.time <- 56 # integer | UTC timestamp in ms
#' var.current <- 1 # integer | Current querying page. Start from 1. Default:1
#' var.size <- 100 # integer | Default:10 Max:100
#' var.archived <- 'archived_example' # character | Default: false. Set to true for archived data from 6 months ago
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Query Repay Record (USER_DATA)
#' api.instance <- MarginApi$new()
#'
#' result <- api.instance$SapiV1MarginRepayGet(var.asset, isolated.symbol=var.isolated.symbol, tx.id=var.tx.id, start.time=var.start.time, end.time=var.end.time, current=var.current, size=var.size, archived=var.archived, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1MarginRepayPost  ####################
#'
#' library(binanceRapi)
#' var.asset <- 'BTC' # character | 
#' var.amount <- 1.01 # numeric | 
#' var.is.isolated <- 'is.isolated_example' # character | * `TRUE` - For isolated margin * `FALSE` - Default, not for isolated margin
#' var.symbol <- 'BNBUSDT' # character | Trading symbol, e.g. BNBUSDT
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Margin Account Repay (MARGIN)
#' api.instance <- MarginApi$new()
#'
#' result <- api.instance$SapiV1MarginRepayPost(var.asset, var.amount, is.isolated=var.is.isolated, symbol=var.symbol, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1MarginTransferGet  ####################
#'
#' library(binanceRapi)
#' var.asset <- 'BNB' # character | 
#' var.type <- 'type_example' # character | Transfer Type
#' var.start.time <- 56 # integer | UTC timestamp in ms
#' var.end.time <- 56 # integer | UTC timestamp in ms
#' var.current <- 1 # integer | Current querying page. Start from 1. Default:1
#' var.size <- 100 # integer | Default:10 Max:100
#' var.archived <- 'archived_example' # character | Default: false. Set to true for archived data from 6 months ago
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Get Cross Margin Transfer History (USER_DATA)
#' api.instance <- MarginApi$new()
#'
#' result <- api.instance$SapiV1MarginTransferGet(asset=var.asset, type=var.type, start.time=var.start.time, end.time=var.end.time, current=var.current, size=var.size, archived=var.archived, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1MarginTransferPost  ####################
#'
#' library(binanceRapi)
#' var.asset <- 'BTC' # character | 
#' var.amount <- 1.01 # numeric | 
#' var.type <- 56 # integer | * `1` - transfer from main account to margin account * `2` - transfer from margin account to main account
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Cross Margin Account Transfer (MARGIN)
#' api.instance <- MarginApi$new()
#'
#' result <- api.instance$SapiV1MarginTransferPost(var.asset, var.amount, type=var.type, recv.window=var.recv.window)
#'
#'
#' }
#' @importFrom R6 R6Class
#' @importFrom base64enc base64encode
#' @export
MarginApi <- R6::R6Class(
  'MarginApi',
  public = list(
    apiClient = NULL,
    initialize = function(apiClient){
      if (!missing(apiClient)) {
        self$apiClient <- apiClient
      }
      else {
        self$apiClient <- ApiClient$new()
      }
    },
    SapiV1BnbBurnGet = function(recv.window=NULL, ...){
      apiResponse <- self$SapiV1BnbBurnGetWithHttpInfo(recv.window, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    SapiV1BnbBurnGetWithHttpInfo = function(recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      queryParams['recvWindow'] <- recv.window

      queryParams['timestamp'] <- self$apiClient$Timestamp
      
      queryParams['signature'] <- self$apiClient$credentials$sign(queryParams)

      body <- NULL
      urlPath <- "/sapi/v1/bnbBurn"
      # API key authentication
      if (nchar(self$apiClient$credentials$key) > 0) {
        headerParams['X-MBX-APIKEY'] <- self$apiClient$credentials$key
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "BnbBurnStatus", loadNamespace("binanceRapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    SapiV1BnbBurnPost = function(spot.bnb.burn=NULL, interest.bnb.burn=NULL, recv.window=NULL, ...){
      apiResponse <- self$SapiV1BnbBurnPostWithHttpInfo(spot.bnb.burn, interest.bnb.burn, recv.window, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    SapiV1BnbBurnPostWithHttpInfo = function(spot.bnb.burn=NULL, interest.bnb.burn=NULL, recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      queryParams['spotBNBBurn'] <- spot.bnb.burn

      queryParams['interestBNBBurn'] <- interest.bnb.burn

      queryParams['recvWindow'] <- recv.window

      queryParams['timestamp'] <- self$apiClient$Timestamp
      
      queryParams['signature'] <- self$apiClient$credentials$sign(queryParams)

      body <- NULL
      urlPath <- "/sapi/v1/bnbBurn"
      # API key authentication
      if (nchar(self$apiClient$credentials$key) > 0) {
        headerParams['X-MBX-APIKEY'] <- self$apiClient$credentials$key
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "POST",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "BnbBurnStatus", loadNamespace("binanceRapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    SapiV1MarginAccountGet = function(recv.window=NULL, ...){
      apiResponse <- self$SapiV1MarginAccountGetWithHttpInfo(recv.window, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    SapiV1MarginAccountGetWithHttpInfo = function(recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      queryParams['recvWindow'] <- recv.window

      queryParams['timestamp'] <- self$apiClient$Timestamp
      
      queryParams['signature'] <- self$apiClient$credentials$sign(queryParams)

      body <- NULL
      urlPath <- "/sapi/v1/margin/account"
      # API key authentication
      if (nchar(self$apiClient$credentials$key) > 0) {
        headerParams['X-MBX-APIKEY'] <- self$apiClient$credentials$key
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "InlineResponse20019", loadNamespace("binanceRapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    SapiV1MarginAllAssetsGet = function(...){
      apiResponse <- self$SapiV1MarginAllAssetsGetWithHttpInfo(...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    SapiV1MarginAllAssetsGetWithHttpInfo = function(...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      body <- NULL
      urlPath <- "/sapi/v1/margin/allAssets"
      # API key authentication
      if (nchar(self$apiClient$credentials$key) > 0) {
        headerParams['X-MBX-APIKEY'] <- self$apiClient$credentials$key
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "array[InlineResponse20014]", loadNamespace("binanceRapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    SapiV1MarginAllOrderListGet = function(is.isolated=NULL, symbol=NULL, from.id=NULL, start.time=NULL, end.time=NULL, limit=NULL, recv.window=NULL, ...){
      apiResponse <- self$SapiV1MarginAllOrderListGetWithHttpInfo(is.isolated, symbol, from.id, start.time, end.time, limit, recv.window, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    SapiV1MarginAllOrderListGetWithHttpInfo = function(is.isolated=NULL, symbol=NULL, from.id=NULL, 
                                                       start.time=NULL, end.time=NULL, limit=NULL, 
                                                       recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      queryParams['isIsolated'] <- is.isolated

      queryParams['symbol'] <- symbol

      queryParams['fromId'] <- from.id

      queryParams['startTime'] <- start.time

      queryParams['endTime'] <- end.time

      queryParams['limit'] <- limit

      queryParams['recvWindow'] <- recv.window

      queryParams['timestamp'] <- self$apiClient$Timestamp
      
      queryParams['signature'] <- self$apiClient$credentials$sign(queryParams)

      body <- NULL
      urlPath <- "/sapi/v1/margin/allOrderList"
      # API key authentication
      if (nchar(self$apiClient$credentials$key) > 0) {
        headerParams['X-MBX-APIKEY'] <- self$apiClient$credentials$key
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "array[InlineResponse2006]", loadNamespace("binanceRapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    SapiV1MarginAllOrdersGet = function(symbol, is.isolated=NULL, order.id=NULL, start.time=NULL, 
                                        end.time=NULL, limit=NULL, recv.window=NULL, ...){
      apiResponse <- self$SapiV1MarginAllOrdersGetWithHttpInfo(symbol, is.isolated, order.id, 
                                                               start.time, end.time, limit, recv.window, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    SapiV1MarginAllOrdersGetWithHttpInfo = function(symbol, is.isolated=NULL, order.id=NULL, 
                                                    start.time=NULL, end.time=NULL, limit=NULL, 
                                                    recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`symbol`)) {
        stop("Missing required parameter `symbol`.")
      }

      queryParams['symbol'] <- symbol

      queryParams['isIsolated'] <- is.isolated

      queryParams['orderId'] <- order.id

      queryParams['startTime'] <- start.time

      queryParams['endTime'] <- end.time

      queryParams['limit'] <- limit

      queryParams['recvWindow'] <- recv.window

      queryParams['timestamp'] <- self$apiClient$Timestamp
      
      queryParams['signature'] <- self$apiClient$credentials$sign(queryParams)

      body <- NULL
      urlPath <- "/sapi/v1/margin/allOrders"
      # API key authentication
      if (nchar(self$apiClient$credentials$key) > 0) {
        headerParams['X-MBX-APIKEY'] <- self$apiClient$credentials$key
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "array[MarginOrderDetail]", loadNamespace("binanceRapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    SapiV1MarginAllPairsGet = function(...){
      apiResponse <- self$SapiV1MarginAllPairsGetWithHttpInfo(...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    SapiV1MarginAllPairsGetWithHttpInfo = function(...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      body <- NULL
      urlPath <- "/sapi/v1/margin/allPairs"
      # API key authentication
      if (nchar(self$apiClient$credentials$key) > 0) {
        headerParams['X-MBX-APIKEY'] <- self$apiClient$credentials$key
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "array[InlineResponse20015]", loadNamespace("binanceRapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    SapiV1MarginAssetGet = function(asset, ...){
      apiResponse <- self$SapiV1MarginAssetGetWithHttpInfo(asset, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    SapiV1MarginAssetGetWithHttpInfo = function(asset, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`asset`)) {
        stop("Missing required parameter `asset`.")
      }

      queryParams['asset'] <- asset

      body <- NULL
      urlPath <- "/sapi/v1/margin/asset"
      # API key authentication
      if (nchar(self$apiClient$credentials$key) > 0) {
        headerParams['X-MBX-APIKEY'] <- self$apiClient$credentials$key
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "InlineResponse20012", loadNamespace("binanceRapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    
    SapiV1MarginCrossMarginDataGet = function(vip.level=NULL, coin=NULL, recv.window=NULL, ...){
      apiResponse <- self$SapiV1MarginCrossMarginDataGetWithHttpInfo(vip.level, coin, recv.window, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },
    
    SapiV1MarginCrossMarginDataGetWithHttpInfo = function(vip.level=NULL, coin=NULL, recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()
      
      queryParams['vipLevel'] <- vip.level
      
      queryParams['coin'] <- coin
      
      queryParams['recvWindow'] <- recv.window
      
      queryParams['timestamp'] <- self$apiClient$Timestamp
      
      queryParams['signature'] <- self$apiClient$credentials$sign(queryParams)
      
      body <- NULL
      urlPath <- "/sapi/v1/margin/crossMarginData"
      # API key authentication
      if (nchar(self$apiClient$credentials$key) > 0) {
        headerParams['X-MBX-APIKEY'] <- self$apiClient$credentials$key
      }
      
      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                     method = "GET",
                                     queryParams = queryParams,
                                     headerParams = headerParams,
                                     body = body,
                                     ...)
      
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "array[InlineResponse20029]", loadNamespace("binanceRapi")),
          error = function(e){
            stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    
    SapiV1MarginForceLiquidationRecGet = function(start.time=NULL, end.time=NULL, isolated.symbol=NULL, current=NULL, size=NULL, recv.window=NULL, ...){
      apiResponse <- self$SapiV1MarginForceLiquidationRecGetWithHttpInfo(start.time, end.time, isolated.symbol, current, size, recv.window, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    SapiV1MarginForceLiquidationRecGetWithHttpInfo = function(start.time=NULL, end.time=NULL, isolated.symbol=NULL, current=NULL, size=NULL, recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      queryParams['startTime'] <- start.time

      queryParams['endTime'] <- end.time

      queryParams['isolatedSymbol'] <- isolated.symbol

      queryParams['current'] <- current

      queryParams['size'] <- size

      queryParams['recvWindow'] <- recv.window

      queryParams['timestamp'] <- self$apiClient$Timestamp
      
      queryParams['signature'] <- self$apiClient$credentials$sign(queryParams)

      body <- NULL
      urlPath <- "/sapi/v1/margin/forceLiquidationRec"
      # API key authentication
      if (nchar(self$apiClient$credentials$key) > 0) {
        headerParams['X-MBX-APIKEY'] <- self$apiClient$credentials$key
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "InlineResponse20018", loadNamespace("binanceRapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    SapiV1MarginInterestHistoryGet = function(asset=NULL, isolated.symbol=NULL, start.time=NULL, end.time=NULL, current=NULL, size=NULL, archived=NULL, recv.window=NULL, ...){
      apiResponse <- self$SapiV1MarginInterestHistoryGetWithHttpInfo(asset, isolated.symbol, start.time, end.time, current, size, archived, recv.window, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    SapiV1MarginInterestHistoryGetWithHttpInfo = function(asset=NULL, isolated.symbol=NULL, start.time=NULL, end.time=NULL, current=NULL, size=NULL, archived=NULL, recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      queryParams['asset'] <- asset

      queryParams['isolatedSymbol'] <- isolated.symbol

      queryParams['startTime'] <- start.time

      queryParams['endTime'] <- end.time

      queryParams['current'] <- current

      queryParams['size'] <- size

      queryParams['archived'] <- archived

      queryParams['recvWindow'] <- recv.window

      queryParams['timestamp'] <- self$apiClient$Timestamp
      
      queryParams['signature'] <- self$apiClient$credentials$sign(queryParams)

      body <- NULL
      urlPath <- "/sapi/v1/margin/interestHistory"
      # API key authentication
      if (nchar(self$apiClient$credentials$key) > 0) {
        headerParams['X-MBX-APIKEY'] <- self$apiClient$credentials$key
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "InlineResponse20017", loadNamespace("binanceRapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    SapiV1MarginInterestRateHistoryGet = function(asset, vip.level=NULL, start.time=NULL, end.time=NULL, 
                                                  recv.window=NULL, ...){
      apiResponse <- self$SapiV1MarginInterestRateHistoryGetWithHttpInfo(asset, vip.level, start.time, 
                                                                         end.time, recv.window, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    SapiV1MarginInterestRateHistoryGetWithHttpInfo = function(asset, vip.level=NULL, start.time=NULL, 
                                                              end.time=NULL, recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`asset`)) {
        stop("Missing required parameter `asset`.")
      }

      queryParams['asset'] <- asset

      queryParams['vipLevel'] <- vip.level

      queryParams['startTime'] <- start.time

      queryParams['endTime'] <- end.time

      queryParams['recvWindow'] <- recv.window

      queryParams['timestamp'] <- self$apiClient$Timestamp
      
      queryParams['signature'] <- self$apiClient$credentials$sign(queryParams)

      body <- NULL
      urlPath <- "/sapi/v1/margin/interestRateHistory"
      # API key authentication
      if (nchar(self$apiClient$credentials$key) > 0) {
        headerParams['X-MBX-APIKEY'] <- self$apiClient$credentials$key
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "array[InlineResponse20028]", loadNamespace("binanceRapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    SapiV1MarginIsolatedAccountDelete = function(symbol, recv.window=NULL, ...){
      apiResponse <- self$SapiV1MarginIsolatedAccountDeleteWithHttpInfo(symbol, recv.window, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    SapiV1MarginIsolatedAccountDeleteWithHttpInfo = function(symbol, recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`symbol`)) {
        stop("Missing required parameter `symbol`.")
      }

      queryParams['symbol'] <- symbol

      queryParams['recvWindow'] <- recv.window

      queryParams['timestamp'] <- self$apiClient$Timestamp
      
      queryParams['signature'] <- self$apiClient$credentials$sign(queryParams)

      body <- NULL
      urlPath <- "/sapi/v1/margin/isolated/account"
      # API key authentication
      if (nchar(self$apiClient$credentials$key) > 0) {
        headerParams['X-MBX-APIKEY'] <- self$apiClient$credentials$key
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "DELETE",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "InlineResponse20025", loadNamespace("binanceRapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    SapiV1MarginIsolatedAccountGet = function(symbols=NULL, recv.window=NULL, ...){
      apiResponse <- self$SapiV1MarginIsolatedAccountGetWithHttpInfo(symbols, recv.window, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    SapiV1MarginIsolatedAccountGetWithHttpInfo = function(symbols=NULL, recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      queryParams['symbols'] <- symbols

      queryParams['recvWindow'] <- recv.window

      queryParams['timestamp'] <- self$apiClient$Timestamp
      
      queryParams['signature'] <- self$apiClient$credentials$sign(queryParams)

      body <- NULL
      urlPath <- "/sapi/v1/margin/isolated/account"
      # API key authentication
      if (nchar(self$apiClient$credentials$key) > 0) {
        headerParams['X-MBX-APIKEY'] <- self$apiClient$credentials$key
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "IsolatedMarginAccountInfo", loadNamespace("binanceRapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    SapiV1MarginIsolatedAccountLimitGet = function(recv.window=NULL, ...){
      apiResponse <- self$SapiV1MarginIsolatedAccountLimitGetWithHttpInfo(recv.window, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    SapiV1MarginIsolatedAccountLimitGetWithHttpInfo = function(recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      queryParams['recvWindow'] <- recv.window

      queryParams['timestamp'] <- self$apiClient$Timestamp
      
      queryParams['signature'] <- self$apiClient$credentials$sign(queryParams)

      body <- NULL
      urlPath <- "/sapi/v1/margin/isolated/accountLimit"
      # API key authentication
      if (nchar(self$apiClient$credentials$key) > 0) {
        headerParams['X-MBX-APIKEY'] <- self$apiClient$credentials$key
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "InlineResponse20026", loadNamespace("binanceRapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    SapiV1MarginIsolatedAccountPost = function(symbol, recv.window=NULL, ...){
      apiResponse <- self$SapiV1MarginIsolatedAccountPostWithHttpInfo(symbol, recv.window, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    SapiV1MarginIsolatedAccountPostWithHttpInfo = function(symbol, recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`symbol`)) {
        stop("Missing required parameter `symbol`.")
      }

      queryParams['symbol'] <- symbol

      queryParams['recvWindow'] <- recv.window

      queryParams['timestamp'] <- self$apiClient$Timestamp
      
      queryParams['signature'] <- self$apiClient$credentials$sign(queryParams)

      body <- NULL
      urlPath <- "/sapi/v1/margin/isolated/account"
      # API key authentication
      if (nchar(self$apiClient$credentials$key) > 0) {
        headerParams['X-MBX-APIKEY'] <- self$apiClient$credentials$key
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "POST",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "InlineResponse20025", loadNamespace("binanceRapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    SapiV1MarginIsolatedAllPairsGet = function(recv.window=NULL, ...){
      apiResponse <- self$SapiV1MarginIsolatedAllPairsGetWithHttpInfo(recv.window, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    SapiV1MarginIsolatedAllPairsGetWithHttpInfo = function(recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      queryParams['recvWindow'] <- recv.window

      queryParams['timestamp'] <- self$apiClient$Timestamp
      
      queryParams['signature'] <- self$apiClient$credentials$sign(queryParams)

      body <- NULL
      urlPath <- "/sapi/v1/margin/isolated/allPairs"
      # API key authentication
      if (nchar(self$apiClient$credentials$key) > 0) {
        headerParams['X-MBX-APIKEY'] <- self$apiClient$credentials$key
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "array[InlineResponse20027]", loadNamespace("binanceRapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    SapiV1MarginIsolatedMarginDataGet = function(vip.level=NULL, symbol=NULL, recv.window=NULL, ...){
      apiResponse <- self$SapiV1MarginIsolatedMarginDataGetWithHttpInfo(vip.level, symbol, recv.window, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },
    
    SapiV1MarginIsolatedMarginDataGetWithHttpInfo = function(vip.level=NULL, symbol=NULL, recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()
      
      queryParams['vipLevel'] <- vip.level
      
      queryParams['symbol'] <- symbol
      
      queryParams['recvWindow'] <- recv.window
      
      queryParams['timestamp'] <- self$apiClient$Timestamp
      
      queryParams['signature'] <- self$apiClient$credentials$sign(queryParams)
      
      body <- NULL
      urlPath <- "/sapi/v1/margin/isolatedMarginData"
      # API key authentication
      if (nchar(self$apiClient$credentials$key) > 0) {
        headerParams['X-MBX-APIKEY'] <- self$apiClient$credentials$key
      }
      
      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                     method = "GET",
                                     queryParams = queryParams,
                                     headerParams = headerParams,
                                     body = body,
                                     ...)
      
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "array[InlineResponse20030]", loadNamespace("binanceRapi")),
          error = function(e){
            stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    SapiV1MarginIsolatedMarginTierGet = function(symbol, tier=NULL, recv.window=NULL, ...){
      apiResponse <- self$SapiV1MarginIsolatedMarginTierGetWithHttpInfo(symbol, tier, recv.window, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },
    
    SapiV1MarginIsolatedMarginTierGetWithHttpInfo = function(symbol, tier=NULL, recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()
      
      if (missing(`symbol`)) {
        stop("Missing required parameter `symbol`.")
      }
      
      queryParams['symbol'] <- symbol
      
      queryParams['tier'] <- tier
      
      queryParams['recvWindow'] <- recv.window
      
      queryParams['timestamp'] <- self$apiClient$Timestamp
      
      queryParams['signature'] <- self$apiClient$credentials$sign(queryParams)
      
      body <- NULL
      urlPath <- "/sapi/v1/margin/isolatedMarginTier"
      # API key authentication
      if (nchar(self$apiClient$credentials$key) > 0) {
        headerParams['X-MBX-APIKEY'] <- self$apiClient$credentials$key
      }
      
      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                     method = "GET",
                                     queryParams = queryParams,
                                     headerParams = headerParams,
                                     body = body,
                                     ...)
      
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "array[InlineResponse20031]", loadNamespace("binanceRapi")),
          error = function(e){
            stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    
    SapiV1MarginIsolatedPairGet = function(symbol, recv.window=NULL, ...){
      apiResponse <- self$SapiV1MarginIsolatedPairGetWithHttpInfo(symbol, recv.window, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    SapiV1MarginIsolatedPairGetWithHttpInfo = function(symbol, recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`symbol`)) {
        stop("Missing required parameter `symbol`.")
      }

      queryParams['symbol'] <- symbol

      queryParams['recvWindow'] <- recv.window

      queryParams['timestamp'] <- self$apiClient$Timestamp
      
      queryParams['signature'] <- self$apiClient$credentials$sign(queryParams)

      body <- NULL
      urlPath <- "/sapi/v1/margin/isolated/pair"
      # API key authentication
      if (nchar(self$apiClient$credentials$key) > 0) {
        headerParams['X-MBX-APIKEY'] <- self$apiClient$credentials$key
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "InlineResponse20027", loadNamespace("binanceRapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    SapiV1MarginIsolatedTransferGet = function(symbol, asset=NULL, trans.from=NULL, trans.to=NULL, start.time=NULL, end.time=NULL, current=NULL, size=NULL, recv.window=NULL, ...){
      apiResponse <- self$SapiV1MarginIsolatedTransferGetWithHttpInfo(symbol, asset, trans.from, trans.to, start.time, end.time, current, size, recv.window, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    SapiV1MarginIsolatedTransferGetWithHttpInfo = function(symbol, asset=NULL, trans.from=NULL, trans.to=NULL, start.time=NULL, end.time=NULL, current=NULL, size=NULL, recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`symbol`)) {
        stop("Missing required parameter `symbol`.")
      }

      queryParams['asset'] <- asset

      queryParams['symbol'] <- symbol

      queryParams['transFrom'] <- trans.from

      queryParams['transTo'] <- trans.to

      queryParams['startTime'] <- start.time

      queryParams['endTime'] <- end.time

      queryParams['current'] <- current

      queryParams['size'] <- size

      queryParams['recvWindow'] <- recv.window

      queryParams['timestamp'] <- self$apiClient$Timestamp
      
      queryParams['signature'] <- self$apiClient$credentials$sign(queryParams)

      body <- NULL
      urlPath <- "/sapi/v1/margin/isolated/transfer"
      # API key authentication
      if (nchar(self$apiClient$credentials$key) > 0) {
        headerParams['X-MBX-APIKEY'] <- self$apiClient$credentials$key
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "MarginTransferDetails", loadNamespace("binanceRapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    SapiV1MarginIsolatedTransferPost = function(asset, symbol, trans.from, trans.to, amount, recv.window=NULL, ...){
      apiResponse <- self$SapiV1MarginIsolatedTransferPostWithHttpInfo(asset, symbol, trans.from, trans.to, amount, recv.window, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    SapiV1MarginIsolatedTransferPostWithHttpInfo = function(asset, symbol, trans.from, trans.to, amount, recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`asset`)) {
        stop("Missing required parameter `asset`.")
      }

      if (missing(`symbol`)) {
        stop("Missing required parameter `symbol`.")
      }
      
      if (missing(`trans.from`)) {
        stop("Missing required parameter `trans.from`.")
      }
      
      if (missing(`trans.to`)) {
        stop("Missing required parameter `trans.to`.")
      }

      if (missing(`amount`)) {
        stop("Missing required parameter `amount`.")
      }

      queryParams['asset'] <- asset

      queryParams['symbol'] <- symbol

      queryParams['transFrom'] <- trans.from

      queryParams['transTo'] <- trans.to

      queryParams['amount'] <- amount

      queryParams['recvWindow'] <- recv.window

      queryParams['timestamp'] <- self$apiClient$Timestamp
      
      queryParams['signature'] <- self$apiClient$credentials$sign(queryParams)

      body <- NULL
      urlPath <- "/sapi/v1/margin/isolated/transfer"
      # API key authentication
      if (nchar(self$apiClient$credentials$key) > 0) {
        headerParams['X-MBX-APIKEY'] <- self$apiClient$credentials$key
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "POST",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "object", loadNamespace("binanceRapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    SapiV1MarginLoanGet = function(asset, isolated.symbol=NULL, tx.id=NULL, start.time=NULL, 
                                   end.time=NULL, current=NULL, size=NULL, archived=NULL, recv.window=NULL, ...){
      apiResponse <- self$SapiV1MarginLoanGetWithHttpInfo(asset, isolated.symbol, tx.id, 
                                                          start.time, end.time, current, size, archived, 
                                                          recv.window, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    SapiV1MarginLoanGetWithHttpInfo = function(asset, isolated.symbol=NULL, tx.id=NULL, 
                                               start.time=NULL, end.time=NULL, current=NULL, 
                                               size=NULL, archived=NULL, recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`asset`)) {
        stop("Missing required parameter `asset`.")
      }

      queryParams['asset'] <- asset

      queryParams['isolatedSymbol'] <- isolated.symbol

      queryParams['txId'] <- tx.id

      queryParams['startTime'] <- start.time

      queryParams['endTime'] <- end.time

      queryParams['current'] <- current

      queryParams['size'] <- size

      queryParams['archived'] <- archived

      queryParams['recvWindow'] <- recv.window

      queryParams['timestamp'] <- self$apiClient$Timestamp
      
      queryParams['signature'] <- self$apiClient$credentials$sign(queryParams)

      body <- NULL
      urlPath <- "/sapi/v1/margin/loan"
      # API key authentication
      if (nchar(self$apiClient$credentials$key) > 0) {
        headerParams['X-MBX-APIKEY'] <- self$apiClient$credentials$key
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "InlineResponse20010", loadNamespace("binanceRapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    SapiV1MarginLoanPost = function(asset, amount, is.isolated=NULL, symbol=NULL, recv.window=NULL, ...){
      apiResponse <- self$SapiV1MarginLoanPostWithHttpInfo(asset, amount, is.isolated, symbol, recv.window, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    SapiV1MarginLoanPostWithHttpInfo = function(asset, amount, is.isolated=NULL, symbol=NULL, recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`asset`)) {
        stop("Missing required parameter `asset`.")
      }

      if (missing(`amount`)) {
        stop("Missing required parameter `amount`.")
      }

      queryParams['asset'] <- asset

      queryParams['isIsolated'] <- is.isolated

      queryParams['symbol'] <- symbol

      queryParams['amount'] <- amount

      queryParams['recvWindow'] <- recv.window

      queryParams['timestamp'] <- self$apiClient$Timestamp
      
      queryParams['signature'] <- self$apiClient$credentials$sign(queryParams)

      body <- NULL
      urlPath <- "/sapi/v1/margin/loan"
      # API key authentication
      if (nchar(self$apiClient$credentials$key) > 0) {
        headerParams['X-MBX-APIKEY'] <- self$apiClient$credentials$key
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "POST",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "Transaction", loadNamespace("binanceRapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    SapiV1MarginMaxBorrowableGet = function(asset, isolated.symbol=NULL, recv.window=NULL, ...){
      apiResponse <- self$SapiV1MarginMaxBorrowableGetWithHttpInfo(asset, isolated.symbol, recv.window, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    SapiV1MarginMaxBorrowableGetWithHttpInfo = function(asset, isolated.symbol=NULL, recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`asset`)) {
        stop("Missing required parameter `asset`.")
      }

      queryParams['asset'] <- asset

      queryParams['isolatedSymbol'] <- isolated.symbol

      queryParams['recvWindow'] <- recv.window

      queryParams['timestamp'] <- self$apiClient$Timestamp
      
      queryParams['signature'] <- self$apiClient$credentials$sign(queryParams)

      body <- NULL
      urlPath <- "/sapi/v1/margin/maxBorrowable"
      # API key authentication
      if (nchar(self$apiClient$credentials$key) > 0) {
        headerParams['X-MBX-APIKEY'] <- self$apiClient$credentials$key
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "InlineResponse20023", loadNamespace("binanceRapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    SapiV1MarginMaxTransferableGet = function(asset, isolated.symbol=NULL, recv.window=NULL, ...){
      apiResponse <- self$SapiV1MarginMaxTransferableGetWithHttpInfo(asset, isolated.symbol, recv.window, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    SapiV1MarginMaxTransferableGetWithHttpInfo = function(asset, isolated.symbol=NULL, recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`asset`)) {
        stop("Missing required parameter `asset`.")
      }

      queryParams['asset'] <- asset

      queryParams['isolatedSymbol'] <- isolated.symbol

      queryParams['recvWindow'] <- recv.window

      queryParams['timestamp'] <- self$apiClient$Timestamp
      
      queryParams['signature'] <- self$apiClient$credentials$sign(queryParams)

      body <- NULL
      urlPath <- "/sapi/v1/margin/maxTransferable"
      # API key authentication
      if (nchar(self$apiClient$credentials$key) > 0) {
        headerParams['X-MBX-APIKEY'] <- self$apiClient$credentials$key
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "InlineResponse20024", loadNamespace("binanceRapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    SapiV1MarginMyTradesGet = function(symbol, is.isolated=NULL, start.time=NULL, end.time=NULL, from.id=NULL, limit=NULL, recv.window=NULL, ...){
      apiResponse <- self$SapiV1MarginMyTradesGetWithHttpInfo(symbol, is.isolated, start.time, end.time, from.id, limit, recv.window, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    SapiV1MarginMyTradesGetWithHttpInfo = function(symbol, is.isolated=NULL, start.time=NULL, end.time=NULL, from.id=NULL, limit=NULL, recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`symbol`)) {
        stop("Missing required parameter `symbol`.")
      }

      queryParams['symbol'] <- symbol

      queryParams['isIsolated'] <- is.isolated

      queryParams['startTime'] <- start.time

      queryParams['endTime'] <- end.time

      queryParams['fromId'] <- from.id

      queryParams['limit'] <- limit

      queryParams['recvWindow'] <- recv.window

      queryParams['timestamp'] <- self$apiClient$Timestamp
      
      queryParams['signature'] <- self$apiClient$credentials$sign(queryParams)

      body <- NULL
      urlPath <- "/sapi/v1/margin/myTrades"
      # API key authentication
      if (nchar(self$apiClient$credentials$key) > 0) {
        headerParams['X-MBX-APIKEY'] <- self$apiClient$credentials$key
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "array[MarginTrade]", loadNamespace("binanceRapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    SapiV1MarginOpenOrderListGet = function(is.isolated=NULL, symbol=NULL, recv.window=NULL, ...){
      apiResponse <- self$SapiV1MarginOpenOrderListGetWithHttpInfo(is.isolated, symbol, recv.window, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    SapiV1MarginOpenOrderListGetWithHttpInfo = function(is.isolated=NULL, symbol=NULL, recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      queryParams['isIsolated'] <- is.isolated

      queryParams['symbol'] <- symbol

      queryParams['recvWindow'] <- recv.window

      queryParams['timestamp'] <- self$apiClient$Timestamp
      
      queryParams['signature'] <- self$apiClient$credentials$sign(queryParams)

      body <- NULL
      urlPath <- "/sapi/v1/margin/openOrderList"
      # API key authentication
      if (nchar(self$apiClient$credentials$key) > 0) {
        headerParams['X-MBX-APIKEY'] <- self$apiClient$credentials$key
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "array[InlineResponse20022]", loadNamespace("binanceRapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    SapiV1MarginOpenOrdersDelete = function(symbol, is.isolated=NULL, recv.window=NULL, ...){
      apiResponse <- self$SapiV1MarginOpenOrdersDeleteWithHttpInfo(symbol, is.isolated, recv.window, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    SapiV1MarginOpenOrdersDeleteWithHttpInfo = function(symbol, is.isolated=NULL, recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`symbol`)) {
        stop("Missing required parameter `symbol`.")
      }

      queryParams['symbol'] <- symbol

      queryParams['isIsolated'] <- is.isolated

      queryParams['recvWindow'] <- recv.window

      queryParams['timestamp'] <- self$apiClient$Timestamp
      
      queryParams['signature'] <- self$apiClient$credentials$sign(queryParams)

      body <- NULL
      urlPath <- "/sapi/v1/margin/openOrders"
      # API key authentication
      if (nchar(self$apiClient$credentials$key) > 0) {
        headerParams['X-MBX-APIKEY'] <- self$apiClient$credentials$key
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "DELETE",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "array[AnyOfcanceledMarginOrderDetailmarginOcoOrder]", loadNamespace("binanceRapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    SapiV1MarginOpenOrdersGet = function(symbol=NULL, is.isolated=NULL, recv.window=NULL, ...){
      apiResponse <- self$SapiV1MarginOpenOrdersGetWithHttpInfo(symbol, is.isolated, recv.window, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    SapiV1MarginOpenOrdersGetWithHttpInfo = function(symbol=NULL, is.isolated=NULL, recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      queryParams['symbol'] <- symbol

      queryParams['isIsolated'] <- is.isolated

      queryParams['recvWindow'] <- recv.window

      queryParams['timestamp'] <- self$apiClient$Timestamp
      
      queryParams['signature'] <- self$apiClient$credentials$sign(queryParams)

      body <- NULL
      urlPath <- "/sapi/v1/margin/openOrders"
      # API key authentication
      if (nchar(self$apiClient$credentials$key) > 0) {
        headerParams['X-MBX-APIKEY'] <- self$apiClient$credentials$key
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "array[MarginOrderDetail]", loadNamespace("binanceRapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    SapiV1MarginOrderDelete = function(symbol, is.isolated=NULL, order.id=NULL, orig.client.order.id=NULL, new.client.order.id=NULL, recv.window=NULL, ...){
      apiResponse <- self$SapiV1MarginOrderDeleteWithHttpInfo(symbol, is.isolated, order.id, orig.client.order.id, new.client.order.id, recv.window, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    SapiV1MarginOrderDeleteWithHttpInfo = function(symbol, is.isolated=NULL, order.id=NULL, orig.client.order.id=NULL, new.client.order.id=NULL, recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`symbol`)) {
        stop("Missing required parameter `symbol`.")
      }

      queryParams['symbol'] <- symbol

      queryParams['isIsolated'] <- is.isolated

      queryParams['orderId'] <- order.id

      queryParams['origClientOrderId'] <- orig.client.order.id

      queryParams['newClientOrderId'] <- new.client.order.id

      queryParams['recvWindow'] <- recv.window

      queryParams['timestamp'] <- self$apiClient$Timestamp
      
      queryParams['signature'] <- self$apiClient$credentials$sign(queryParams)

      body <- NULL
      urlPath <- "/sapi/v1/margin/order"
      # API key authentication
      if (nchar(self$apiClient$credentials$key) > 0) {
        headerParams['X-MBX-APIKEY'] <- self$apiClient$credentials$key
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "DELETE",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "MarginOrder", loadNamespace("binanceRapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    SapiV1MarginOrderGet = function(symbol, is.isolated=NULL, order.id=NULL, orig.client.order.id=NULL, recv.window=NULL, ...){
      apiResponse <- self$SapiV1MarginOrderGetWithHttpInfo(symbol, is.isolated, order.id, orig.client.order.id, recv.window, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    SapiV1MarginOrderGetWithHttpInfo = function(symbol, is.isolated=NULL, order.id=NULL, orig.client.order.id=NULL, recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`symbol`)) {
        stop("Missing required parameter `symbol`.")
      }

      queryParams['symbol'] <- symbol

      queryParams['isIsolated'] <- is.isolated

      queryParams['orderId'] <- order.id

      queryParams['origClientOrderId'] <- orig.client.order.id

      queryParams['recvWindow'] <- recv.window

      queryParams['timestamp'] <- self$apiClient$Timestamp
      
      queryParams['signature'] <- self$apiClient$credentials$sign(queryParams)

      body <- NULL
      urlPath <- "/sapi/v1/margin/order"
      # API key authentication
      if (nchar(self$apiClient$credentials$key) > 0) {
        headerParams['X-MBX-APIKEY'] <- self$apiClient$credentials$key
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "MarginOrderDetail", loadNamespace("binanceRapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    SapiV1MarginOrderListDelete = function(symbol, is.isolated=NULL, order.list.id=NULL, list.client.order.id=NULL, new.client.order.id=NULL, recv.window=NULL, ...){
      apiResponse <- self$SapiV1MarginOrderListDeleteWithHttpInfo(symbol, is.isolated, order.list.id, list.client.order.id, new.client.order.id, recv.window, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    SapiV1MarginOrderListDeleteWithHttpInfo = function(symbol, is.isolated=NULL, order.list.id=NULL, list.client.order.id=NULL, new.client.order.id=NULL, recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`symbol`)) {
        stop("Missing required parameter `symbol`.")
      }

      queryParams['symbol'] <- symbol

      queryParams['isIsolated'] <- is.isolated

      queryParams['orderListId'] <- order.list.id

      queryParams['listClientOrderId'] <- list.client.order.id

      queryParams['newClientOrderId'] <- new.client.order.id

      queryParams['recvWindow'] <- recv.window

      queryParams['timestamp'] <- self$apiClient$Timestamp
      
      queryParams['signature'] <- self$apiClient$credentials$sign(queryParams)

      body <- NULL
      urlPath <- "/sapi/v1/margin/orderList"
      # API key authentication
      if (nchar(self$apiClient$credentials$key) > 0) {
        headerParams['X-MBX-APIKEY'] <- self$apiClient$credentials$key
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "DELETE",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "MarginOcoOrder", loadNamespace("binanceRapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    SapiV1MarginOrderListGet = function(is.isolated=NULL, symbol=NULL, order.list.id=NULL, orig.client.order.id=NULL, recv.window=NULL, ...){
      apiResponse <- self$SapiV1MarginOrderListGetWithHttpInfo(is.isolated, symbol, order.list.id, orig.client.order.id, recv.window, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    SapiV1MarginOrderListGetWithHttpInfo = function(is.isolated=NULL, symbol=NULL, order.list.id=NULL, orig.client.order.id=NULL, recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      queryParams['isIsolated'] <- is.isolated

      queryParams['symbol'] <- symbol

      queryParams['orderListId'] <- order.list.id

      queryParams['origClientOrderId'] <- orig.client.order.id

      queryParams['recvWindow'] <- recv.window

      queryParams['timestamp'] <- self$apiClient$Timestamp
      
      queryParams['signature'] <- self$apiClient$credentials$sign(queryParams)

      body <- NULL
      urlPath <- "/sapi/v1/margin/orderList"
      # API key authentication
      if (nchar(self$apiClient$credentials$key) > 0) {
        headerParams['X-MBX-APIKEY'] <- self$apiClient$credentials$key
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "InlineResponse20021", loadNamespace("binanceRapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    SapiV1MarginOrderOcoPost = function(symbol, side, quantity, price, stop.price, is.isolated=NULL, 
                                        list.client.order.id=NULL, limit.client.order.id=NULL, 
                                        limit.iceberg.qty=NULL, stop.client.order.id=NULL, 
                                        stop.limit.price=NULL, stop.iceberg.qty=NULL, 
                                        stop.limit.time.in.force=NULL, new.order.resp.type=NULL, 
                                        side.effect.type=NULL, recv.window=NULL, ...){
      apiResponse <- self$SapiV1MarginOrderOcoPostWithHttpInfo(symbol, side, quantity, price, stop.price, 
                                                               is.isolated, list.client.order.id, 
                                                               limit.client.order.id, limit.iceberg.qty, 
                                                               stop.client.order.id, stop.limit.price, 
                                                               stop.iceberg.qty, stop.limit.time.in.force, 
                                                               new.order.resp.type, side.effect.type, recv.window, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    SapiV1MarginOrderOcoPostWithHttpInfo = function(symbol, side, quantity, price, stop.price, 
                                                    is.isolated=NULL, list.client.order.id=NULL, 
                                                    limit.client.order.id=NULL, limit.iceberg.qty=NULL, 
                                                    stop.client.order.id=NULL, stop.limit.price=NULL, 
                                                    stop.iceberg.qty=NULL, stop.limit.time.in.force=NULL, 
                                                    new.order.resp.type=NULL, side.effect.type=NULL, 
                                                    recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`symbol`)) {
        stop("Missing required parameter `symbol`.")
      }

      if (missing(`side`)) {
        stop("Missing required parameter `side`.")
      }

      if (missing(`quantity`)) {
        stop("Missing required parameter `quantity`.")
      }

      if (missing(`price`)) {
        stop("Missing required parameter `price`.")
      }

      if (missing(`stop.price`)) {
        stop("Missing required parameter `stop.price`.")
      }

      queryParams['symbol'] <- symbol

      queryParams['isIsolated'] <- is.isolated

      queryParams['listClientOrderId'] <- list.client.order.id

      queryParams['side'] <- side

      queryParams['quantity'] <- quantity

      queryParams['limitClientOrderId'] <- limit.client.order.id

      queryParams['price'] <- price

      queryParams['limitIcebergQty'] <- limit.iceberg.qty

      queryParams['stopClientOrderId'] <- stop.client.order.id

      queryParams['stopPrice'] <- stop.price

      queryParams['stopLimitPrice'] <- stop.limit.price

      queryParams['stopIcebergQty'] <- stop.iceberg.qty

      queryParams['stopLimitTimeInForce'] <- stop.limit.time.in.force

      queryParams['newOrderRespType'] <- new.order.resp.type

      queryParams['sideEffectType'] <- side.effect.type

      queryParams['recvWindow'] <- recv.window

      queryParams['timestamp'] <- self$apiClient$Timestamp
      
      queryParams['signature'] <- self$apiClient$credentials$sign(queryParams)

      body <- NULL
      urlPath <- "/sapi/v1/margin/order/oco"
      # API key authentication
      if (nchar(self$apiClient$credentials$key) > 0) {
        headerParams['X-MBX-APIKEY'] <- self$apiClient$credentials$key
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "POST",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "InlineResponse20020", loadNamespace("binanceRapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    SapiV1MarginOrderPost = function(symbol, side, type, quantity, is.isolated=NULL, quote.order.qty=NULL, 
                                     price=NULL, stop.price=NULL, new.client.order.id=NULL, iceberg.qty=NULL, 
                                     new.order.resp.type=NULL, side.effect.type=NULL, time.in.force=NULL, 
                                     recv.window=NULL, ...){
      apiResponse <- self$SapiV1MarginOrderPostWithHttpInfo(symbol, side, type, quantity, is.isolated, 
                                                            quote.order.qty, price, stop.price, new.client.order.id, 
                                                            iceberg.qty, new.order.resp.type, side.effect.type, 
                                                            time.in.force, recv.window, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    SapiV1MarginOrderPostWithHttpInfo = function(symbol, side, type, quantity, is.isolated=NULL, 
                                                 quote.order.qty=NULL, price=NULL, stop.price=NULL, 
                                                 new.client.order.id=NULL, iceberg.qty=NULL, 
                                                 new.order.resp.type=NULL, side.effect.type=NULL, 
                                                 time.in.force=NULL, recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`symbol`)) {
        stop("Missing required parameter `symbol`.")
      }

      if (missing(`side`)) {
        stop("Missing required parameter `side`.")
      }

      if (missing(`type`)) {
        stop("Missing required parameter `type`.")
      }

      if (missing(`quantity`)) {
        stop("Missing required parameter `quantity`.")
      }

      queryParams['symbol'] <- symbol

      queryParams['isIsolated'] <- is.isolated

      queryParams['side'] <- side

      queryParams['type'] <- type

      queryParams['quantity'] <- quantity

      queryParams['quoteOrderQty'] <- quote.order.qty

      queryParams['price'] <- price

      queryParams['stopPrice'] <- stop.price

      queryParams['newClientOrderId'] <- new.client.order.id

      queryParams['icebergQty'] <- iceberg.qty

      queryParams['newOrderRespType'] <- new.order.resp.type

      queryParams['sideEffectType'] <- side.effect.type

      queryParams['timeInForce'] <- time.in.force

      queryParams['recvWindow'] <- recv.window

      queryParams['timestamp'] <- self$apiClient$Timestamp
      
      queryParams['signature'] <- self$apiClient$credentials$sign(queryParams)

      body <- NULL
      urlPath <- "/sapi/v1/margin/order"
      # API key authentication
      if (nchar(self$apiClient$credentials$key) > 0) {
        headerParams['X-MBX-APIKEY'] <- self$apiClient$credentials$key
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "POST",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "OneOfmarginOrderResponseAckmarginOrderResponseResultmarginOrderResponseFull", loadNamespace("binanceRapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    SapiV1MarginPairGet = function(symbol, ...){
      apiResponse <- self$SapiV1MarginPairGetWithHttpInfo(symbol, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    SapiV1MarginPairGetWithHttpInfo = function(symbol, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`symbol`)) {
        stop("Missing required parameter `symbol`.")
      }

      queryParams['symbol'] <- symbol

      body <- NULL
      urlPath <- "/sapi/v1/margin/pair"
      # API key authentication
      if (nchar(self$apiClient$credentials$key) > 0) {
        headerParams['X-MBX-APIKEY'] <- self$apiClient$credentials$key
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "InlineResponse20013", loadNamespace("binanceRapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    SapiV1MarginPriceIndexGet = function(symbol, ...){
      apiResponse <- self$SapiV1MarginPriceIndexGetWithHttpInfo(symbol, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    SapiV1MarginPriceIndexGetWithHttpInfo = function(symbol, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`symbol`)) {
        stop("Missing required parameter `symbol`.")
      }

      queryParams['symbol'] <- symbol

      body <- NULL
      urlPath <- "/sapi/v1/margin/priceIndex"
      # API key authentication
      if (nchar(self$apiClient$credentials$key) > 0) {
        headerParams['X-MBX-APIKEY'] <- self$apiClient$credentials$key
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "InlineResponse20016", loadNamespace("binanceRapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    SapiV1MarginRateLimitOrderGet = function(is.isolated=NULL, symbol=NULL, recv.window=NULL, ...){
      apiResponse <- self$SapiV1MarginRateLimitOrderGetWithHttpInfo(is.isolated, symbol, recv.window, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },
    
    SapiV1MarginRateLimitOrderGetWithHttpInfo = function(is.isolated=NULL, symbol=NULL, recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()
      
      queryParams['isIsolated'] <- is.isolated
      
      queryParams['symbol'] <- symbol
      
      queryParams['recvWindow'] <- recv.window
      
      queryParams['timestamp'] <- self$apiClient$Timestamp
      
      queryParams['signature'] <- self$apiClient$credentials$sign(queryParams)
      
      body <- NULL
      urlPath <- "/sapi/v1/margin/rateLimit/order"
      # API key authentication
      if (nchar(self$apiClient$credentials$key) > 0) {
        headerParams['X-MBX-APIKEY'] <- self$apiClient$credentials$key
      }
      
      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                     method = "GET",
                                     queryParams = queryParams,
                                     headerParams = headerParams,
                                     body = body,
                                     ...)
      
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "array[InlineResponse20032]", loadNamespace("binanceRapi")),
          error = function(e){
            stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    SapiV1MarginRepayGet = function(asset, isolated.symbol=NULL, tx.id=NULL, start.time=NULL, end.time=NULL, 
                                    current=NULL, size=NULL, archived=NULL, recv.window=NULL, ...){
      apiResponse <- self$SapiV1MarginRepayGetWithHttpInfo(asset, isolated.symbol, tx.id, start.time, 
                                                           end.time, current, size, archived, recv.window, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    SapiV1MarginRepayGetWithHttpInfo = function(asset, isolated.symbol=NULL, tx.id=NULL, 
                                                start.time=NULL, end.time=NULL, current=NULL, size=NULL, 
                                                archived=NULL, recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`asset`)) {
        stop("Missing required parameter `asset`.")
      }

      queryParams['asset'] <- asset

      queryParams['isolatedSymbol'] <- isolated.symbol

      queryParams['txId'] <- tx.id

      queryParams['startTime'] <- start.time

      queryParams['endTime'] <- end.time

      queryParams['current'] <- current

      queryParams['size'] <- size

      queryParams['archived'] <- archived

      queryParams['recvWindow'] <- recv.window

      queryParams['timestamp'] <- self$apiClient$Timestamp
      
      queryParams['signature'] <- self$apiClient$credentials$sign(queryParams)

      body <- NULL
      urlPath <- "/sapi/v1/margin/repay"
      # API key authentication
      if (nchar(self$apiClient$credentials$key) > 0) {
        headerParams['X-MBX-APIKEY'] <- self$apiClient$credentials$key
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "InlineResponse20011", loadNamespace("binanceRapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    SapiV1MarginRepayPost = function(asset, amount, is.isolated=NULL, symbol=NULL, recv.window=NULL, ...){
      apiResponse <- self$SapiV1MarginRepayPostWithHttpInfo(asset, amount, is.isolated, symbol, recv.window, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    SapiV1MarginRepayPostWithHttpInfo = function(asset, amount, is.isolated=NULL, symbol=NULL, recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`asset`)) {
        stop("Missing required parameter `asset`.")
      }

      if (missing(`amount`)) {
        stop("Missing required parameter `amount`.")
      }

      queryParams['asset'] <- asset

      queryParams['isIsolated'] <- is.isolated

      queryParams['symbol'] <- symbol

      queryParams['amount'] <- amount

      queryParams['recvWindow'] <- recv.window

      queryParams['timestamp'] <- self$apiClient$Timestamp
      
      queryParams['signature'] <- self$apiClient$credentials$sign(queryParams)

      body <- NULL
      urlPath <- "/sapi/v1/margin/repay"
      # API key authentication
      if (nchar(self$apiClient$credentials$key) > 0) {
        headerParams['X-MBX-APIKEY'] <- self$apiClient$credentials$key
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "POST",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "Transaction", loadNamespace("binanceRapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    SapiV1MarginTransferGet = function(asset=NULL, type=NULL, start.time=NULL, end.time=NULL, current=NULL, 
                                       size=NULL, archived=NULL, recv.window=NULL, ...){
      apiResponse <- self$SapiV1MarginTransferGetWithHttpInfo(asset, type, start.time, end.time, 
                                                              current, size, archived, recv.window, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    SapiV1MarginTransferGetWithHttpInfo = function(asset=NULL, type=NULL, start.time=NULL, 
                                                   end.time=NULL, current=NULL, size=NULL, archived=NULL, 
                                                   recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      queryParams['asset'] <- asset

      queryParams['type'] <- type

      queryParams['startTime'] <- start.time

      queryParams['endTime'] <- end.time

      queryParams['current'] <- current

      queryParams['size'] <- size

      queryParams['archived'] <- archived

      queryParams['recvWindow'] <- recv.window

      queryParams['timestamp'] <- self$apiClient$Timestamp
      
      queryParams['signature'] <- self$apiClient$credentials$sign(queryParams)

      body <- NULL
      urlPath <- "/sapi/v1/margin/transfer"
      # API key authentication
      if (nchar(self$apiClient$credentials$key) > 0) {
        headerParams['X-MBX-APIKEY'] <- self$apiClient$credentials$key
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "InlineResponse2009", loadNamespace("binanceRapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    SapiV1MarginTransferPost = function(asset, amount, type, recv.window=NULL, ...){
      apiResponse <- self$SapiV1MarginTransferPostWithHttpInfo(asset, amount, type, recv.window, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    SapiV1MarginTransferPostWithHttpInfo = function(asset, amount, type, recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`asset`)) {
        stop("Missing required parameter `asset`.")
      }

      if (missing(`amount`)) {
        stop("Missing required parameter `amount`.")
      }
      
      if (missing(`type`)) {
        stop("Missing required parameter `type`.")
      }

      queryParams['asset'] <- asset

      queryParams['amount'] <- amount

      queryParams['type'] <- type

      queryParams['recvWindow'] <- recv.window

      queryParams['timestamp'] <- self$apiClient$Timestamp
      
      queryParams['signature'] <- self$apiClient$credentials$sign(queryParams)

      body <- NULL
      urlPath <- "/sapi/v1/margin/transfer"
      # API key authentication
      if (nchar(self$apiClient$credentials$key) > 0) {
        headerParams['X-MBX-APIKEY'] <- self$apiClient$credentials$key
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "POST",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "Transaction", loadNamespace("binanceRapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    }
  )
)
grahamjwhite/binanceRapi documentation built on Nov. 22, 2022, 9:37 p.m.