Class BSwap
java.lang.Object
com.binance.connector.client.impl.spot.BSwap
BSwap Endpoints
All endpoints under the BSwap Endpoint section of the API documentation will be implemented in this class.Response will be returned in String format.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddLiquidityPreview(LinkedHashMap<String,Object> parameters)
Calculate expected share amount for adding liquidity in single or dual token.liquidity(LinkedHashMap<String,Object> parameters)
Get liquidity information and user share of a pool.liquidityAdd(LinkedHashMap<String,Object> parameters)
Add liquidity to a pool.liquidityOps(LinkedHashMap<String,Object> parameters)
Get liquidity operation (add/remove) records.liquidityRemove(LinkedHashMap<String,Object> parameters)
Remove liquidity from a pool, type include SINGLE and COMBINATION, asset is mandatory for single asset removal.poolConfigure(LinkedHashMap<String,Object> parameters)
GET /sapi/v1/bswap/poolConfigurequote(LinkedHashMap<String,Object> parameters)
Request a quote for swap quote asset (selling asset) for base asset (buying asset), essentially price/exchange rates.
quoteQty is quantity of quote asset (to sell).
Please be noted the quote is for reference only, the actual price will change as the liquidity changes, it's recommended to swap immediate after request a quote for slippage prevention.removeLiquidityPreview(LinkedHashMap<String,Object> parameters)
Calculate the expected asset amount of single token redemption or dual token redemption.swap(LinkedHashMap<String,Object> parameters)
Swap quoteAsset for baseAsset.swapHistory(LinkedHashMap<String,Object> parameters)
Get swap history.Get metadata about all swap pools.
-
Constructor Details
-
BSwap
-
-
Method Details
-
swapPools
Get metadata about all swap pools.
GET /sapi/v1/bswap/pools- Returns:
- String
- See Also:
- https://binance-docs.github.io/apidocs/spot/en/#list-all-swap-pools-market_data
-
liquidity
Get liquidity information and user share of a pool.
GET /sapi/v1/bswap/liquidity- Parameters:
parameters
- LinkedHashedMap of String,Object pair where String is the name of the parameter and Object is the value of the parameter
poolId -- optional/long
recvWindow -- optional/long- Returns:
- String
- See Also:
- https://binance-docs.github.io/apidocs/spot/en/#subscribe-blvt-user_data
-
liquidityAdd
Add liquidity to a pool.
POST /sapi/v1/bswap/liquidityAdd- Parameters:
parameters
- LinkedHashedMap of String,Object pair where String is the name of the parameter and Object is the value of the parameter
poolId -- mandatory/long
type -- optional/string -- "Single" to add a single token; "Combination" to add dual tokens. Default "Single"
asset -- mandatory/string
quantity -- mandatory/decimal
recvWindow -- optional/long- Returns:
- String
- See Also:
- https://binance-docs.github.io/apidocs/spot/en/#add-liquidity-trade
-
liquidityRemove
Remove liquidity from a pool, type include SINGLE and COMBINATION, asset is mandatory for single asset removal.
POST /sapi/v1/bswap/liquidityRemove- Parameters:
parameters
- LinkedHashedMap of String,Object pair where String is the name of the parameter and Object is the value of the parameter
poolId -- mandatory/long
type -- mandatory/string -- SINGLE for single asset removal, COMBINATION for combination of all coins removal
asset -- optional/string
shareAmount -- mandatory/decimal
recvWindow -- optional/long- Returns:
- String
- See Also:
- https://binance-docs.github.io/apidocs/spot/en/#remove-liquidity-trade
-
liquidityOps
Get liquidity operation (add/remove) records.
GET /sapi/v1/bswap/liquidityOps- Parameters:
parameters
- LinkedHashedMap of String,Object pair where String is the name of the parameter and Object is the value of the parameter
operationId -- optional/long
poolId -- optional/long
operation -- optional/enum -- ADD or REMOVE
startTime -- optional/long
endTime -- optional/long
limit -- optional/long -- default 3, max 100
recvWindow -- optional/long- Returns:
- String
- See Also:
- https://binance-docs.github.io/apidocs/spot/en/#get-liquidity-operation-record-user_data
-
quote
Request a quote for swap quote asset (selling asset) for base asset (buying asset), essentially price/exchange rates.
quoteQty is quantity of quote asset (to sell).
Please be noted the quote is for reference only, the actual price will change as the liquidity changes, it's recommended to swap immediate after request a quote for slippage prevention.
GET /sapi/v1/bswap/quote- Parameters:
parameters
- LinkedHashedMap of String,Object pair where String is the name of the parameter and Object is the value of the parameter
quoteAsset -- mandatory/string
baseAsset -- mandatory/string
quoteQty -- mandatory/decimal
recvWindow -- optional/long- Returns:
- String
- See Also:
- https://binance-docs.github.io/apidocs/spot/en/#get-liquidity-operation-record-user_data
-
swap
Swap quoteAsset for baseAsset.
POST /sapi/v1/bswap/swap- Parameters:
parameters
- LinkedHashedMap of String,Object pair where String is the name of the parameter and Object is the value of the parameter
quoteAsset -- mandatory/string
baseAsset -- mandatory/string
quoteQty -- mandatory/decimal
recvWindow -- optional/long- Returns:
- String
- See Also:
- https://binance-docs.github.io/apidocs/spot/en/#swap-trade
-
swapHistory
Get swap history.
GET /sapi/v1/bswap/swap- Parameters:
parameters
- LinkedHashedMap of String,Object pair where String is the name of the parameter and Object is the value of the parameter
swapId -- optional/long
startTime -- optional/long
endTime -- optional/long
status -- optional/int -- 0: pending for swap, 1: success, 2: failed
quoteAsset -- optional/string
baseAsset -- optional/string
limit -- optional/long -- default 3, max 100
recvWindow -- optional/long- Returns:
- String
- See Also:
- https://binance-docs.github.io/apidocs/spot/en/#get-swap-history-user_data
-
poolConfigure
GET /sapi/v1/bswap/poolConfigure- Parameters:
parameters
- LinkedHashedMap of String,Object pair where String is the name of the parameter and Object is the value of the parameter
poolId -- optional/long
recvWindow -- optional/long- Returns:
- String
- See Also:
- https://binance-docs.github.io/apidocs/spot/en/#get-pool-configure-user_data
-
addLiquidityPreview
Calculate expected share amount for adding liquidity in single or dual token.
GET /sapi/v1/bswap/addLiquidityPreview- Parameters:
parameters
- LinkedHashedMap of String,Object pair where String is the name of the parameter and Object is the value of the parameter
poolId -- mandatory/long
type -- mandatory/string -- "SINGLE" for adding a single token;"COMBINATION" for adding dual tokens
quoteAsset -- mandatory/string
quoteQty -- mandatory/decimal
recvWindow -- optional/long- Returns:
- String
- See Also:
- https://binance-docs.github.io/apidocs/spot/en/#add-liquidity-preview-user_data
-
removeLiquidityPreview
Calculate the expected asset amount of single token redemption or dual token redemption.
GET /sapi/v1/bswap/removeLiquidityPreview- Parameters:
parameters
- LinkedHashedMap of String,Object pair where String is the name of the parameter and Object is the value of the parameter
poolId -- mandatory/long
type -- mandatory/string -- "SINGLE" for adding a single token;"COMBINATION" for adding dual tokens
quoteAsset -- mandatory/string
shareAmount -- mandatory/decimal
recvWindow -- optional/long- Returns:
- String
- See Also:
- https://binance-docs.github.io/apidocs/spot/en/#remove-liquidity-preview-user_data
-