R/savings_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 Savings operations
#' @description binanceRapi.Savings
#' @format An \code{R6Class} generator object
#' @field apiClient Handles the client-server communication.
#'
#' @section Methods:
#' \describe{
#' \strong{ SapiV1LendingCustomizedFixedPurchasePost } \emph{ Purchase Fixed/Activity Project (USER_DATA) }
#' Weight(IP): 1
#'
#' \itemize{
#' \item \emph{ @param } project.id character
#' \item \emph{ @param } lot character
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } \link{InlineResponse20090} \cr
#'
#'
#' \item status code : 200 | Generated Purchase Id
#'
#' \item return type : InlineResponse20090 
#' \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{ SapiV1LendingDailyProductListGet } \emph{ Get Flexible Product List (USER_DATA) }
#' Weight(IP): 1
#'
#' \itemize{
#' \item \emph{ @param } status Enum < [ALL, SUBSCRIBABLE, UNSUBSCRIBABLE] >
#' \item \emph{ @param } featured Enum < [ALL, TRUE] >
#' \item \emph{ @param } current integer
#' \item \emph{ @param } size integer
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } list( \link{inline_response_200_84} ) \cr
#'
#'
#' \item status code : 200 | List of flexible products
#'
#' \item return type : array[InlineResponse20084] 
#' \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{ SapiV1LendingDailyPurchasePost } \emph{ Purchase Flexible Product (USER_DATA) }
#' Weight(IP): 1
#'
#' \itemize{
#' \item \emph{ @param } product.id character
#' \item \emph{ @param } amount numeric
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } \link{InlineResponse20086} \cr
#'
#'
#' \item status code : 200 | Generated Purchase Id
#'
#' \item return type : InlineResponse20086 
#' \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{ SapiV1LendingDailyRedeemPost } \emph{ Redeem Flexible Product (USER_DATA) }
#' Weight(IP): 1
#'
#' \itemize{
#' \item \emph{ @param } product.id character
#' \item \emph{ @param } amount numeric
#' \item \emph{ @param } type Enum < [FAST, NORMAL] >
#' \item \emph{ @param } recv.window integer
#'
#'
#' \item status code : 200 | OK
#'
#' \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{ SapiV1LendingDailyTokenPositionGet } \emph{ Get Flexible Product Position (USER_DATA) }
#' Weight(IP): 1
#'
#' \itemize{
#' \item \emph{ @param } asset character
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } list( \link{inline_response_200_88} ) \cr
#'
#'
#' \item status code : 200 | List of flexible product positions
#'
#' \item return type : array[InlineResponse20088] 
#' \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{ SapiV1LendingDailyUserLeftQuotaGet } \emph{ Get Left Daily Purchase Quota of Flexible Product (USER_DATA) }
#' Weight(IP): 1
#'
#' \itemize{
#' \item \emph{ @param } product.id character
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } \link{InlineResponse20085} \cr
#'
#'
#' \item status code : 200 | Daily purchase quote of flexible product left
#'
#' \item return type : InlineResponse20085 
#' \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{ SapiV1LendingDailyUserRedemptionQuotaGet } \emph{ Get Left Daily Redemption Quota of Flexible Product (USER_DATA) }
#' Weight(IP): 1
#'
#' \itemize{
#' \item \emph{ @param } product.id character
#' \item \emph{ @param } type Enum < [FAST, NORMAL] >
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } \link{InlineResponse20087} \cr
#'
#'
#' \item status code : 200 | Daily redemption quota of flexible product left
#'
#' \item return type : InlineResponse20087 
#' \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{ SapiV1LendingPositionChangedPost } \emph{ Change Fixed/Activity Position to Daily Position (USER_DATA) }
#' - PositionId is mandatory parameter for fixed position.  Weight(IP): 1
#'
#' \itemize{
#' \item \emph{ @param } project.id character
#' \item \emph{ @param } lot character
#' \item \emph{ @param } position.id character
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } \link{InlineResponse20094} \cr
#'
#'
#' \item status code : 200 | Purchase information
#'
#' \item return type : InlineResponse20094 
#' \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{ SapiV1LendingProjectListGet } \emph{ Get Fixed/Activity Project List(USER_DATA) }
#' Weight(IP): 1
#'
#' \itemize{
#' \item \emph{ @param } type Enum < [ACTIVITY, CUSTOMIZED_FIXED] >
#' \item \emph{ @param } asset character
#' \item \emph{ @param } status Enum < [ALL, SUBSCRIBABLE, UNSUBSCRIBABLE] >
#' \item \emph{ @param } is.sort.asc character
#' \item \emph{ @param } sort.by Enum < [START_TIME, LOT_SIZE, INTEREST_RATE, DURATION] >
#' \item \emph{ @param } current integer
#' \item \emph{ @param } size integer
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } list( \link{inline_response_200_89} ) \cr
#'
#'
#' \item status code : 200 | List of fixed projects
#'
#' \item return type : array[InlineResponse20089] 
#' \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{ SapiV1LendingProjectPositionListGet } \emph{ Get Fixed/Activity Project Position (USER_DATA) }
#' Weight(IP): 1
#'
#' \itemize{
#' \item \emph{ @param } asset character
#' \item \emph{ @param } project.id character
#' \item \emph{ @param } status Enum < [ALL, SUBSCRIBABLE, UNSUBSCRIBABLE] >
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } list( \link{inline_response_200_91} ) \cr
#'
#'
#' \item status code : 200 | List of fixed project positions
#'
#' \item return type : array[InlineResponse20091] 
#' \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{ SapiV1LendingUnionAccountGet } \emph{ Lending Account (USER_DATA) }
#' Weight(IP): 1
#'
#' \itemize{
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } \link{InlineResponse20092} \cr
#'
#'
#' \item status code : 200 | Lending account
#'
#' \item return type : InlineResponse20092 
#' \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{ SapiV1LendingUnionInterestHistoryGet } \emph{ Get Interest History (USER_DATA) }
#' - The time between startTime and endTime cannot be longer than 30 days. - If startTime and endTime are both not sent, then the last 30 days&#39; data will be returned.  Weight(IP): 1
#'
#' \itemize{
#' \item \emph{ @param } lending.type Enum < [DAILY, ACTIVITY, CUSTOMIZED_FIXED] >
#' \item \emph{ @param } asset 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 } recv.window integer
#' \item \emph{ @returnType } list( \link{inline_response_200_93} ) \cr
#'
#'
#' \item status code : 200 | History of interest
#'
#' \item return type : array[InlineResponse20093] 
#' \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{ SapiV1LendingUnionPurchaseRecordGet } \emph{ Get Purchase Record (USER_DATA) }
#' - The time between startTime and endTime cannot be longer than 30 days. - If startTime and endTime are both not sent, then the last 30 days&#39; data will be returned.  Weigh(IP): 1
#'
#' \itemize{
#' \item \emph{ @param } lending.type Enum < [DAILY, ACTIVITY, CUSTOMIZED_FIXED] >
#' \item \emph{ @param } asset 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 } recv.window integer
#' \item \emph{ @returnType } \link{OneOfsavingsFlexiblePurchaseRecordsavingsFixedActivityPurchaseRecord} \cr
#'
#'
#' \item status code : 200 | List of flexible or Fixed/Activity products
#'
#' \item return type : OneOfsavingsFlexiblePurchaseRecordsavingsFixedActivityPurchaseRecord 
#' \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{ SapiV1LendingUnionRedemptionRecordGet } \emph{ Get Redemption Record (USER_DATA) }
#' - The time between startTime and endTime cannot be longer than 30 days. - If startTime and endTime are both not sent, then the last 30 days&#39; data will be returned.  Weight(IP): 1
#'
#' \itemize{
#' \item \emph{ @param } lending.type Enum < [DAILY, ACTIVITY, CUSTOMIZED_FIXED] >
#' \item \emph{ @param } asset 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 } recv.window integer
#' \item \emph{ @returnType } \link{OneOfsavingsFlexibleRedemptionRecordsavingsFixedActivityRedemptionRecord} \cr
#'
#'
#' \item status code : 200 | History of Flexible or Fixed/Activity Redemptions
#'
#' \item return type : OneOfsavingsFlexibleRedemptionRecordsavingsFixedActivityRedemptionRecord 
#' \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{
#' ####################  SapiV1LendingCustomizedFixedPurchasePost  ####################
#'
#' library(binanceRapi)
#' var.project.id <- 'project.id_example' # character | 
#' var.lot <- 'lot_example' # character | 
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Purchase Fixed/Activity Project (USER_DATA)
#' api.instance <- SavingsApi$new()
#'
#' result <- api.instance$SapiV1LendingCustomizedFixedPurchasePost(var.project.id, var.lot, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1LendingDailyProductListGet  ####################
#'
#' library(binanceRapi)
#' var.status <- 'status_example' # character | Default `ALL`
#' var.featured <- 'featured_example' # character | Default `ALL`
#' 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 Flexible Product List (USER_DATA)
#' api.instance <- SavingsApi$new()
#'
#' result <- api.instance$SapiV1LendingDailyProductListGet(status=var.status, featured=var.featured, current=var.current, size=var.size, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1LendingDailyPurchasePost  ####################
#'
#' library(binanceRapi)
#' var.product.id <- 'product.id_example' # character | 
#' var.amount <- 1.01 # numeric | 
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Purchase Flexible Product (USER_DATA)
#' api.instance <- SavingsApi$new()
#'
#' result <- api.instance$SapiV1LendingDailyPurchasePost(var.product.id, var.amount, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1LendingDailyRedeemPost  ####################
#'
#' library(binanceRapi)
#' var.product.id <- 'product.id_example' # character | 
#' var.amount <- 1.01 # numeric | 
#' var.type <- 'type_example' # character | 
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Redeem Flexible Product (USER_DATA)
#' api.instance <- SavingsApi$new()
#'
#' result <- api.instance$SapiV1LendingDailyRedeemPost(var.product.id, var.amount, var.type, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1LendingDailyTokenPositionGet  ####################
#'
#' library(binanceRapi)
#' var.asset <- 'BTC' # character | 
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Get Flexible Product Position (USER_DATA)
#' api.instance <- SavingsApi$new()
#'
#' result <- api.instance$SapiV1LendingDailyTokenPositionGet(var.asset, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1LendingDailyUserLeftQuotaGet  ####################
#'
#' library(binanceRapi)
#' var.product.id <- 'product.id_example' # character | 
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Get Left Daily Purchase Quota of Flexible Product (USER_DATA)
#' api.instance <- SavingsApi$new()
#'
#' result <- api.instance$SapiV1LendingDailyUserLeftQuotaGet(var.product.id, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1LendingDailyUserRedemptionQuotaGet  ####################
#'
#' library(binanceRapi)
#' var.product.id <- 'product.id_example' # character | 
#' var.type <- 'type_example' # character | 
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Get Left Daily Redemption Quota of Flexible Product (USER_DATA)
#' api.instance <- SavingsApi$new()
#'
#' result <- api.instance$SapiV1LendingDailyUserRedemptionQuotaGet(var.product.id, var.type, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1LendingPositionChangedPost  ####################
#'
#' library(binanceRapi)
#' var.project.id <- 'project.id_example' # character | 
#' var.lot <- 'lot_example' # character | 
#' var.position.id <- 'position.id_example' # character | 
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Change Fixed/Activity Position to Daily Position (USER_DATA)
#' api.instance <- SavingsApi$new()
#'
#' result <- api.instance$SapiV1LendingPositionChangedPost(var.project.id, var.lot, position.id=var.position.id, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1LendingProjectListGet  ####################
#'
#' library(binanceRapi)
#' var.type <- 'type_example' # character | 
#' var.asset <- 'BNB' # character | 
#' var.status <- 'status_example' # character | Default `ALL`
#' var.is.sort.asc <- 'is.sort.asc_example' # character | default \"true\"
#' var.sort.by <- 'sort.by_example' # character | Default `START_TIME`
#' 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 Fixed/Activity Project List(USER_DATA)
#' api.instance <- SavingsApi$new()
#'
#' result <- api.instance$SapiV1LendingProjectListGet(var.type, asset=var.asset, status=var.status, is.sort.asc=var.is.sort.asc, sort.by=var.sort.by, current=var.current, size=var.size, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1LendingProjectPositionListGet  ####################
#'
#' library(binanceRapi)
#' var.asset <- 'BTC' # character | 
#' var.project.id <- 'project.id_example' # character | 
#' var.status <- 'status_example' # character | \"ALL\", \"SUBSCRIBABLE\", \"UNSUBSCRIBABLE\"; Default: 'ALL'
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Get Fixed/Activity Project Position (USER_DATA)
#' api.instance <- SavingsApi$new()
#'
#' result <- api.instance$SapiV1LendingProjectPositionListGet(var.asset, project.id=var.project.id, status=var.status, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1LendingUnionAccountGet  ####################
#'
#' library(binanceRapi)
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Lending Account (USER_DATA)
#' api.instance <- SavingsApi$new()
#'
#' result <- api.instance$SapiV1LendingUnionAccountGet(recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1LendingUnionInterestHistoryGet  ####################
#'
#' library(binanceRapi)
#' var.lending.type <- 'lending.type_example' # character | * `DAILY` - for flexible * `ACTIVITY` - for activity * `CUSTOMIZED_FIXED` for fixed
#' var.asset <- 'BNB' # 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 Interest History (USER_DATA)
#' api.instance <- SavingsApi$new()
#'
#' result <- api.instance$SapiV1LendingUnionInterestHistoryGet(var.lending.type, asset=var.asset, start.time=var.start.time, end.time=var.end.time, current=var.current, size=var.size, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1LendingUnionPurchaseRecordGet  ####################
#'
#' library(binanceRapi)
#' var.lending.type <- 'lending.type_example' # character | * `DAILY` - for flexible * `ACTIVITY` - for activity * `CUSTOMIZED_FIXED` for fixed
#' var.asset <- 'BNB' # 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 Purchase Record (USER_DATA)
#' api.instance <- SavingsApi$new()
#'
#' result <- api.instance$SapiV1LendingUnionPurchaseRecordGet(var.lending.type, asset=var.asset, start.time=var.start.time, end.time=var.end.time, current=var.current, size=var.size, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1LendingUnionRedemptionRecordGet  ####################
#'
#' library(binanceRapi)
#' var.lending.type <- 'lending.type_example' # character | * `DAILY` - for flexible * `ACTIVITY` - for activity * `CUSTOMIZED_FIXED` for fixed
#' var.asset <- 'BNB' # 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 Redemption Record (USER_DATA)
#' api.instance <- SavingsApi$new()
#'
#' result <- api.instance$SapiV1LendingUnionRedemptionRecordGet(var.lending.type, asset=var.asset, start.time=var.start.time, end.time=var.end.time, current=var.current, size=var.size, recv.window=var.recv.window)
#'
#'
#' }
#' @importFrom R6 R6Class
#' @importFrom base64enc base64encode
#' @export
SavingsApi <- R6::R6Class(
  'SavingsApi',
  public = list(
    apiClient = NULL,
    initialize = function(apiClient){
      if (!missing(apiClient)) {
        self$apiClient <- apiClient
      }
      else {
        self$apiClient <- ApiClient$new()
      }
    },
    SapiV1LendingCustomizedFixedPurchasePost = function(project.id, lot, recv.window=NULL, ...){
      apiResponse <- self$SapiV1LendingCustomizedFixedPurchasePostWithHttpInfo(project.id, lot, 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
      }
    },

    SapiV1LendingCustomizedFixedPurchasePostWithHttpInfo = function(project.id, lot, recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

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

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

      queryParams['projectId'] <- project.id

      queryParams['lot'] <- lot

      queryParams['recvWindow'] <- recv.window

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

      body <- NULL
      urlPath <- "/sapi/v1/lending/customizedFixed/purchase"
      # 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, "InlineResponse20090", 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)
      }
    },
    SapiV1LendingDailyProductListGet = function(status=NULL, featured=NULL, current=NULL, size=NULL, recv.window=NULL, ...){
      apiResponse <- self$SapiV1LendingDailyProductListGetWithHttpInfo(status, featured, 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
      }
    },

    SapiV1LendingDailyProductListGetWithHttpInfo = function(status=NULL, featured=NULL, current=NULL, size=NULL, recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      queryParams['status'] <- status

      queryParams['featured'] <- featured

      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/lending/daily/product/list"
      # 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[InlineResponse20084]", 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)
      }
    },
    SapiV1LendingDailyPurchasePost = function(product.id, amount, recv.window=NULL, ...){
      apiResponse <- self$SapiV1LendingDailyPurchasePostWithHttpInfo(product.id, 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
      }
    },

    SapiV1LendingDailyPurchasePostWithHttpInfo = function(product.id, amount, recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

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

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

      queryParams['productId'] <- product.id

      queryParams['amount'] <- amount

      queryParams['recvWindow'] <- recv.window

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

      body <- NULL
      urlPath <- "/sapi/v1/lending/daily/purchase"
      # 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, "InlineResponse20086", 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)
      }
    },
    SapiV1LendingDailyRedeemPost = function(product.id, amount, type, recv.window=NULL, ...){
      apiResponse <- self$SapiV1LendingDailyRedeemPostWithHttpInfo(product.id, 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
      }
    },

    SapiV1LendingDailyRedeemPostWithHttpInfo = function(product.id, amount, type, recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

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

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

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

      queryParams['productId'] <- product.id

      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/lending/daily/redeem"
      # 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)
      }
    },
    SapiV1LendingDailyTokenPositionGet = function(asset, recv.window=NULL, ...){
      apiResponse <- self$SapiV1LendingDailyTokenPositionGetWithHttpInfo(asset, 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
      }
    },

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

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

      queryParams['asset'] <- asset

      queryParams['recvWindow'] <- recv.window

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

      body <- NULL
      urlPath <- "/sapi/v1/lending/daily/token/position"
      # 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[InlineResponse20088]", 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)
      }
    },
    SapiV1LendingDailyUserLeftQuotaGet = function(product.id, recv.window=NULL, ...){
      apiResponse <- self$SapiV1LendingDailyUserLeftQuotaGetWithHttpInfo(product.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
      }
    },

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

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

      queryParams['productId'] <- product.id

      queryParams['recvWindow'] <- recv.window

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

      body <- NULL
      urlPath <- "/sapi/v1/lending/daily/userLeftQuota"
      # 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, "InlineResponse20085", 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)
      }
    },
    SapiV1LendingDailyUserRedemptionQuotaGet = function(product.id, type, recv.window=NULL, ...){
      apiResponse <- self$SapiV1LendingDailyUserRedemptionQuotaGetWithHttpInfo(product.id, 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
      }
    },

    SapiV1LendingDailyUserRedemptionQuotaGetWithHttpInfo = function(product.id, type, recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

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

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

      queryParams['productId'] <- product.id

      queryParams['type'] <- type

      queryParams['recvWindow'] <- recv.window

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

      body <- NULL
      urlPath <- "/sapi/v1/lending/daily/userRedemptionQuota"
      # 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, "InlineResponse20087", 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)
      }
    },
    SapiV1LendingPositionChangedPost = function(project.id, lot, position.id=NULL, recv.window=NULL, ...){
      apiResponse <- self$SapiV1LendingPositionChangedPostWithHttpInfo(project.id, lot, position.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
      }
    },

    SapiV1LendingPositionChangedPostWithHttpInfo = function(project.id, lot, position.id=NULL, recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

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

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

      queryParams['projectId'] <- project.id

      queryParams['lot'] <- lot

      queryParams['positionId'] <- position.id

      queryParams['recvWindow'] <- recv.window

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

      body <- NULL
      urlPath <- "/sapi/v1/lending/positionChanged"
      # 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, "InlineResponse20094", 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)
      }
    },
    SapiV1LendingProjectListGet = function(type, asset=NULL, status=NULL, is.sort.asc=NULL, sort.by=NULL, current=NULL, size=NULL, recv.window=NULL, ...){
      apiResponse <- self$SapiV1LendingProjectListGetWithHttpInfo(type, asset, status, is.sort.asc, sort.by, 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
      }
    },

    SapiV1LendingProjectListGetWithHttpInfo = function(type, asset=NULL, status=NULL, is.sort.asc=NULL, sort.by=NULL, current=NULL, size=NULL, recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

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

      queryParams['asset'] <- asset

      queryParams['type'] <- type

      queryParams['status'] <- status

      queryParams['isSortAsc'] <- is.sort.asc

      queryParams['sortBy'] <- sort.by

      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/lending/project/list"
      # 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[InlineResponse20089]", 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)
      }
    },
    SapiV1LendingProjectPositionListGet = function(asset, project.id=NULL, status=NULL, recv.window=NULL, ...){
      apiResponse <- self$SapiV1LendingProjectPositionListGetWithHttpInfo(asset, project.id, status, 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
      }
    },

    SapiV1LendingProjectPositionListGetWithHttpInfo = function(asset, project.id=NULL, status=NULL, recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

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

      queryParams['asset'] <- asset

      queryParams['projectId'] <- project.id

      queryParams['status'] <- status

      queryParams['recvWindow'] <- recv.window

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

      body <- NULL
      urlPath <- "/sapi/v1/lending/project/position/list"
      # 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[InlineResponse20091]", 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)
      }
    },
    SapiV1LendingUnionAccountGet = function(recv.window=NULL, ...){
      apiResponse <- self$SapiV1LendingUnionAccountGetWithHttpInfo(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
      }
    },

    SapiV1LendingUnionAccountGetWithHttpInfo = 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/lending/union/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, "InlineResponse20092", 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)
      }
    },
    SapiV1LendingUnionInterestHistoryGet = function(lending.type, asset=NULL, start.time=NULL, end.time=NULL, current=NULL, size=NULL, recv.window=NULL, ...){
      apiResponse <- self$SapiV1LendingUnionInterestHistoryGetWithHttpInfo(lending.type, asset, 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
      }
    },

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

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

      queryParams['lendingType'] <- lending.type

      queryParams['asset'] <- asset

      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/lending/union/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, "array[InlineResponse20093]", 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)
      }
    },
    SapiV1LendingUnionPurchaseRecordGet = function(lending.type, asset=NULL, start.time=NULL, end.time=NULL, current=NULL, size=NULL, recv.window=NULL, ...){
      apiResponse <- self$SapiV1LendingUnionPurchaseRecordGetWithHttpInfo(lending.type, asset, 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
      }
    },

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

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

      queryParams['lendingType'] <- lending.type

      queryParams['asset'] <- asset

      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/lending/union/purchaseRecord"
      # 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, "OneOfsavingsFlexiblePurchaseRecordsavingsFixedActivityPurchaseRecord", 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)
      }
    },
    SapiV1LendingUnionRedemptionRecordGet = function(lending.type, asset=NULL, start.time=NULL, end.time=NULL, current=NULL, size=NULL, recv.window=NULL, ...){
      apiResponse <- self$SapiV1LendingUnionRedemptionRecordGetWithHttpInfo(lending.type, asset, 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
      }
    },

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

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

      queryParams['lendingType'] <- lending.type

      queryParams['asset'] <- asset

      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/lending/union/redemptionRecord"
      # 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, "OneOfsavingsFlexibleRedemptionRecordsavingsFixedActivityRedemptionRecord", 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.