From fca6d061d93eec2c305d705aebaa7e6898282a16 Mon Sep 17 00:00:00 2001 From: Joel Fisch <6702422+joelfisch@users.noreply.github.com> Date: Thu, 11 Nov 2021 14:21:06 +0100 Subject: [PATCH] fix: support top level array schema declarations with custom object nested beneath --- .circleci/golden/expected/openapi.cabal | 1 + .circleci/golden/expected/src/OpenAPI.hs | 2 + .../golden/expected/src/OpenAPI/Types.hs | 2 + .../expected/src/OpenAPI/Types/CoverType.hs | 5 +- .../expected/src/OpenAPI/Types/Test7.hs | 56 + .../expected/src/OpenAPI/Types/Test7.hs-boot | 9 + .circleci/specifications/spot_api.yml | 14482 ++++++++++++++++ .../z_complex_self_made_example.yml | 10 + .circleci/test_system_1 | 4 +- .../src/OpenAPI/Generate/Model.hs | 5 +- .../src/OpenAPI/Generate/OptParse.hs | 3 + .../Generate/OptParse/Configuration.hs | 2 + .../src/OpenAPI/Generate/OptParse/Flags.hs | 12 + 13 files changed, 14590 insertions(+), 3 deletions(-) create mode 100644 .circleci/golden/expected/src/OpenAPI/Types/Test7.hs create mode 100644 .circleci/golden/expected/src/OpenAPI/Types/Test7.hs-boot create mode 100644 .circleci/specifications/spot_api.yml diff --git a/.circleci/golden/expected/openapi.cabal b/.circleci/golden/expected/openapi.cabal index c642a09..c66702f 100644 --- a/.circleci/golden/expected/openapi.cabal +++ b/.circleci/golden/expected/openapi.cabal @@ -21,6 +21,7 @@ library OpenAPI.Types.PetByAge OpenAPI.Types.PetByType OpenAPI.Types.Test6 + OpenAPI.Types.Test7 OpenAPI.Configuration OpenAPI.SecuritySchemes OpenAPI.Common diff --git a/.circleci/golden/expected/src/OpenAPI.hs b/.circleci/golden/expected/src/OpenAPI.hs index 792392e..8ef5b15 100644 --- a/.circleci/golden/expected/src/OpenAPI.hs +++ b/.circleci/golden/expected/src/OpenAPI.hs @@ -16,6 +16,7 @@ module OpenAPI ( module OpenAPI.Types.PetByAge, module OpenAPI.Types.PetByType, module OpenAPI.Types.Test6, + module OpenAPI.Types.Test7, module OpenAPI.Configuration, module OpenAPI.SecuritySchemes, module OpenAPI.Common, @@ -35,6 +36,7 @@ import OpenAPI.Types.Mischling import OpenAPI.Types.PetByAge import OpenAPI.Types.PetByType import OpenAPI.Types.Test6 +import OpenAPI.Types.Test7 import OpenAPI.Configuration import OpenAPI.SecuritySchemes import OpenAPI.Common diff --git a/.circleci/golden/expected/src/OpenAPI/Types.hs b/.circleci/golden/expected/src/OpenAPI/Types.hs index e8ade92..e49c172 100644 --- a/.circleci/golden/expected/src/OpenAPI/Types.hs +++ b/.circleci/golden/expected/src/OpenAPI/Types.hs @@ -10,6 +10,7 @@ module OpenAPI.Types ( module OpenAPI.Types.PetByAge, module OpenAPI.Types.PetByType, module OpenAPI.Types.Test6, + module OpenAPI.Types.Test7, ) where import OpenAPI.TypeAlias @@ -20,3 +21,4 @@ import OpenAPI.Types.Mischling import OpenAPI.Types.PetByAge import OpenAPI.Types.PetByType import OpenAPI.Types.Test6 +import OpenAPI.Types.Test7 diff --git a/.circleci/golden/expected/src/OpenAPI/Types/CoverType.hs b/.circleci/golden/expected/src/OpenAPI/Types/CoverType.hs index 3578e36..6bfc9c7 100644 --- a/.circleci/golden/expected/src/OpenAPI/Types/CoverType.hs +++ b/.circleci/golden/expected/src/OpenAPI/Types/CoverType.hs @@ -33,6 +33,7 @@ import OpenAPI.TypeAlias import {-# SOURCE #-} OpenAPI.Types.Mischling import {-# SOURCE #-} OpenAPI.Types.PetByAge import {-# SOURCE #-} OpenAPI.Types.Test6 +import {-# SOURCE #-} OpenAPI.Types.Test7 -- | Defines the object schema located at @components.schemas.CoverType@ in the specification. -- @@ -62,6 +63,7 @@ data CoverTypeCoverVariants = | CoverTypeCoverTest4 Test4 | CoverTypeCoverTest5 Test5 | CoverTypeCoverTest6 Test6 + | CoverTypeCoverTest7 Test7 deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON CoverTypeCoverVariants where toJSON (CoverTypeCoverPetByAge a) = Data.Aeson.Types.ToJSON.toJSON a @@ -72,7 +74,8 @@ instance Data.Aeson.Types.ToJSON.ToJSON CoverTypeCoverVariants toJSON (CoverTypeCoverTest4 a) = Data.Aeson.Types.ToJSON.toJSON a toJSON (CoverTypeCoverTest5 a) = Data.Aeson.Types.ToJSON.toJSON a toJSON (CoverTypeCoverTest6 a) = Data.Aeson.Types.ToJSON.toJSON a + toJSON (CoverTypeCoverTest7 a) = Data.Aeson.Types.ToJSON.toJSON a instance Data.Aeson.Types.FromJSON.FromJSON CoverTypeCoverVariants - where parseJSON val = case (CoverTypeCoverPetByAge Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((CoverTypeCoverMischling Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((CoverTypeCoverTest Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((CoverTypeCoverTest2 Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((CoverTypeCoverTest3 Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((CoverTypeCoverTest4 Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((CoverTypeCoverTest5 Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((CoverTypeCoverTest6 Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> Data.Aeson.Types.Internal.Error "No variant matched"))))))) of + where parseJSON val = case (CoverTypeCoverPetByAge Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((CoverTypeCoverMischling Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((CoverTypeCoverTest Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((CoverTypeCoverTest2 Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((CoverTypeCoverTest3 Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((CoverTypeCoverTest4 Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((CoverTypeCoverTest5 Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((CoverTypeCoverTest6 Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> ((CoverTypeCoverTest7 Data.Functor.<$> Data.Aeson.Types.FromJSON.fromJSON val) GHC.Base.<|> Data.Aeson.Types.Internal.Error "No variant matched")))))))) of Data.Aeson.Types.Internal.Success a -> GHC.Base.pure a Data.Aeson.Types.Internal.Error a -> Control.Monad.Fail.fail a diff --git a/.circleci/golden/expected/src/OpenAPI/Types/Test7.hs b/.circleci/golden/expected/src/OpenAPI/Types/Test7.hs new file mode 100644 index 0000000..ae7055e --- /dev/null +++ b/.circleci/golden/expected/src/OpenAPI/Types/Test7.hs @@ -0,0 +1,56 @@ +-- CHANGE WITH CAUTION: This is a generated code file generated by https://github.com/Haskell-OpenAPI-Code-Generator/Haskell-OpenAPI-Client-Code-Generator. + +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE MultiWayIf #-} + +-- | Contains the types generated from the schema Test7 +module OpenAPI.Types.Test7 where + +import qualified Prelude as GHC.Integer.Type +import qualified Prelude as GHC.Maybe +import qualified Control.Monad.Fail +import qualified Data.Aeson +import qualified Data.Aeson as Data.Aeson.Encoding.Internal +import qualified Data.Aeson as Data.Aeson.Types +import qualified Data.Aeson as Data.Aeson.Types.FromJSON +import qualified Data.Aeson as Data.Aeson.Types.ToJSON +import qualified Data.Aeson as Data.Aeson.Types.Internal +import qualified Data.ByteString.Char8 +import qualified Data.ByteString.Char8 as Data.ByteString.Internal +import qualified Data.Functor +import qualified Data.Scientific +import qualified Data.Text +import qualified Data.Text.Internal +import qualified Data.Time.Calendar as Data.Time.Calendar.Days +import qualified Data.Time.LocalTime as Data.Time.LocalTime.Internal.ZonedTime +import qualified GHC.Base +import qualified GHC.Classes +import qualified GHC.Int +import qualified GHC.Show +import qualified GHC.Types +import qualified OpenAPI.Common +import OpenAPI.TypeAlias + +-- | Defines the object schema located at @components.schemas.Test7.items@ in the specification. +-- +-- +data Test7Item = Test7Item { + -- | prop1 + test7ItemProp1 :: (GHC.Maybe.Maybe GHC.Types.Int) + -- | prop2 + , test7ItemProp2 :: (GHC.Maybe.Maybe Data.Text.Internal.Text) + } deriving (GHC.Show.Show + , GHC.Classes.Eq) +instance Data.Aeson.Types.ToJSON.ToJSON Test7Item + where toJSON obj = Data.Aeson.Types.Internal.object ("prop1" Data.Aeson.Types.ToJSON..= test7ItemProp1 obj : "prop2" Data.Aeson.Types.ToJSON..= test7ItemProp2 obj : GHC.Base.mempty) + toEncoding obj = Data.Aeson.Encoding.Internal.pairs (("prop1" Data.Aeson.Types.ToJSON..= test7ItemProp1 obj) GHC.Base.<> ("prop2" Data.Aeson.Types.ToJSON..= test7ItemProp2 obj)) +instance Data.Aeson.Types.FromJSON.FromJSON Test7Item + where parseJSON = Data.Aeson.Types.FromJSON.withObject "Test7Item" (\obj -> (GHC.Base.pure Test7Item GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "prop1")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:? "prop2")) +-- | Create a new 'Test7Item' with all required fields. +mkTest7Item :: Test7Item +mkTest7Item = Test7Item{test7ItemProp1 = GHC.Maybe.Nothing, + test7ItemProp2 = GHC.Maybe.Nothing} +-- | Defines an alias for the schema located at @components.schemas.Test7@ in the specification. +-- +-- +type Test7 = [Test7Item] diff --git a/.circleci/golden/expected/src/OpenAPI/Types/Test7.hs-boot b/.circleci/golden/expected/src/OpenAPI/Types/Test7.hs-boot new file mode 100644 index 0000000..1e10fc6 --- /dev/null +++ b/.circleci/golden/expected/src/OpenAPI/Types/Test7.hs-boot @@ -0,0 +1,9 @@ +module OpenAPI.Types.Test7 where +import Data.Aeson +import qualified Data.Aeson as Data.Aeson.Types.Internal +data Test7Item +instance Show Test7Item +instance Eq Test7Item +instance FromJSON Test7Item +instance ToJSON Test7Item +type Test7 = [Test7Item] diff --git a/.circleci/specifications/spot_api.yml b/.circleci/specifications/spot_api.yml new file mode 100644 index 0000000..207140b --- /dev/null +++ b/.circleci/specifications/spot_api.yml @@ -0,0 +1,14482 @@ +openapi: '3.0.2' +info: + title: Binance Public Spot API + description: |- + 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) + version: '1.0' + +servers: + - url: https://api.binance.com + - url: https://testnet.binance.vision + +tags: + - name: Market + description: Market Data + - name: Trade + description: Account/Trade + - name: Margin + description: Margin Account/Trade + - name: Wallet + description: Wallet Endpoints + - name: Sub-Account + description: Sub-account Endpoints + - name: Stream + description: User Data Stream + - name: Margin Stream + description: Margin User Data Stream + - name: Isolated Margin Stream + description: Isolated User Data Stream + - name: Savings + description: Savings Endpoints + - name: Mining + description: Mining Endpoints + - name: BLVT + description: Binance Leveraged Tokens Endpoints + - name: BSwap + description: Binance Swap Endpoints + - name: Fiat + description: Fiat Endpoints + - name: C2C + description: Consumer-To-Consumer Endpoints + +paths: + /api/v3/ping: + get: + summary: Test Connectivity + description: |- + Test connectivity to the Rest API. + + Weight(IP): 1 + tags: + - Market + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + /api/v3/time: + get: + summary: Check Server Time + description: |- + Test connectivity to the Rest API and get the current server time. + + Weight(IP): 1 + tags: + - Market + responses: + '200': + description: Binance server UTC timestamp + content: + application/json: + schema: + type: object + properties: + serverTime: + type: integer + format: int64 + example: 1499827319559 + required: + - serverTime + /api/v3/exchangeInfo: + get: + summary: Exchange Information + description: |- + Current exchange trading rules and symbol information + + - If any symbol provided in either symbol or symbols do not exist, the endpoint will throw an error. + + Weight(IP): 10 + tags: + - Market + parameters: + - $ref: '#/components/parameters/optionalSymbol' + - $ref: '#/components/parameters/arraySymbols' + responses: + '200': + description: Current exchange trading rules and symbol information + content: + application/json: + schema: + type: object + properties: + timezone: + type: string + example: UTC + serverTime: + type: integer + format: int64 + example: 1592882214236 + rateLimits: + type: array + items: + type: object + properties: + rateLimitType: + type: string + example: "REQUEST_WEIGHT" + interval: + type: string + example: "MINUTE" + intervalNum: + type: integer + format: int32 + example: 1 + limit: + type: integer + format: int32 + example: 1200 + required: + - rateLimitType + - interval + - intervalNum + - limit + exchangeFilters: + type: array + items: + type: object + symbols: + type: array + items: + type: object + properties: + symbol: + type: string + example: "ETHBTC" + status: + type: string + example: "TRADING" + baseAsset: + type: string + example: "ETH" + baseAssetPrecision: + type: integer + format: int32 + example: 8 + quoteAsset: + type: string + example: "BTC" + quoteAssetPrecision: + type: integer + format: int32 + example: 8 + baseCommissionPrecision: + type: integer + format: int32 + example: 8 + quoteCommissionPrecision: + type: integer + format: int32 + example: 8 + orderTypes: + type: array + items: + type: string + example: "LIMIT" + icebergAllowed: + type: boolean + ocoAllowed: + type: boolean + quoteOrderQtyMarketAllowed: + type: boolean + isSpotTradingAllowed: + type: boolean + isMarginTradingAllowed: + type: boolean + filters: + type: array + items: + type: object + properties: + filterType: + type: string + example: "PRICE_FILTER" + minPrice: + type: string + example: "0.00000100" + maxPrice: + type: string + example: "100000.00000000" + tickSize: + type: string + example: "0.00000100" + required: + - filterType + - minPrice + - maxPrice + - tickSize + permissions: + type: array + items: + type: string + example: "SPOT" + required: + - symbol + - status + - baseAsset + - baseAssetPrecision + - quoteAsset + - quoteAssetPrecision + - baseCommissionPrecision + - quoteCommissionPrecision + - orderTypes + - icebergAllowed + - ocoAllowed + - quoteOrderQtyMarketAllowed + - isSpotTradingAllowed + - isMarginTradingAllowed + - filters + - permissions + required: + - timezone + - serverTime + - rateLimits + - exchangeFilters + - symbols + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /api/v3/depth: + get: + summary: Order Book + description: |- + | Limit | Weight(IP) | + |---------------------|-------------| + | 5, 10, 20, 50, 100 | 1 | + | 500 | 5 | + | 1000 | 10 | + | 5000 | 50 | + tags: + - Market + parameters: + - $ref: '#/components/parameters/symbol' + - name: limit + in: query + schema: + type: integer + format: int32 + default: 100 + maximum: 5000 + enum: [5, 10, 20, 50, 100, 500, 1000, 5000] + example: 100 + responses: + '200': + description: Order book + content: + application/json: + schema: + type: object + properties: + lastUpdateId: + type: integer + format: int64 + bids: + type: array + items: + type: array + items: + type: string + minItems: 2 + maxItems: 2 + asks: + type: array + items: + type: array + items: + type: string + minItems: 2 + maxItems: 2 + required: + - lastUpdateId + - bids + - asks + example: + lastUpdateId: 1027024 + bids: + - + - "4.00000000" + - "431.00000000" + asks: + - + - "4.00000200" + - "12.00000000" + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /api/v3/trades: + get: + summary: Recent Trades List + description: |- + Get recent trades. + + Weight(IP): 1 + tags: + - Market + parameters: + - $ref: '#/components/parameters/symbol' + - $ref: '#/components/parameters/limit' + responses: + '200': + description: Trade list + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/trade' + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /api/v3/historicalTrades: + get: + summary: Old Trade Lookup + description: |- + Get older market trades. + + Weight(IP): 5 + tags: + - Market + parameters: + - $ref: '#/components/parameters/symbol' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/fromId' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Trade list + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/trade' + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /api/v3/aggTrades: + get: + summary: Compressed/Aggregate Trades List + description: |- + Get compressed, aggregate trades. Trades that fill at the time, from the same order, with the same price will have the quantity aggregated. + - If `startTime` and `endTime` are sent, time between startTime and endTime must be less than 1 hour. + - If `fromId`, `startTime`, and `endTime` are not sent, the most recent aggregate trades will be returned. + + Weight(IP): 1 + tags: + - Market + parameters: + - $ref: '#/components/parameters/symbol' + - $ref: '#/components/parameters/fromId' + - $ref: '#/components/parameters/startTime' + - $ref: '#/components/parameters/endTime' + - $ref: '#/components/parameters/limit' + responses: + '200': + description: Trade list + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/aggTrade' + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /api/v3/klines: + get: + summary: Kline/Candlestick Data + description: |- + Kline/candlestick bars for a symbol.\ + Klines are uniquely identified by their open time. + + - If `startTime` and `endTime` are not sent, the most recent klines are returned. + + Weight(IP): 1 + tags: + - Market + parameters: + - $ref: '#/components/parameters/symbol' + - name: interval + in: query + required: true + description: kline intervals + schema: + type: string + enum: [1m,3m,5m,15m,30m,1h,2h,4h,6h,8h,12h,1d,3d,1w,1M] + - $ref: '#/components/parameters/startTime' + - $ref: '#/components/parameters/endTime' + - $ref: '#/components/parameters/limit' + responses: + '200': + description: Kline data + content: + application/json: + schema: + type: array + items: + type: array + items: + oneOf: + - type: integer + format: int64 + - type: string + minItems: 12 + maxItems: 12 + example: + - 1499040000000 + - "0.01634790" + - "0.80000000" + - "0.01575800" + - "0.01577100" + - "148976.11427815" + - 1499644799999 + - "2434.19055334" + - 308 + - "1756.87402397" + - "28.46694368" + - "17928899.62484339" + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /api/v3/avgPrice: + get: + summary: Current Average Price + description: |- + Current average price for a symbol. + + Weight(IP): 1 + tags: + - Market + parameters: + - $ref: '#/components/parameters/symbol' + responses: + '200': + description: Average price + content: + application/json: + schema: + type: object + properties: + mins: + type: integer + format: int64 + example: 5 + price: + type: string + example: "9.35751834" + required: + - mins + - price + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /api/v3/ticker/24hr: + get: + summary: 24hr Ticker Price Change Statistics + description: |- + 24 hour rolling window price change statistics. Careful when accessing this with no symbol. + + - If the symbol is not sent, tickers for all symbols will be returned in an array. + + Weight(IP):\ + `1` for a single symbol;\ + `40` when the symbol parameter is omitted; + + tags: + - Market + parameters: + - $ref: '#/components/parameters/optionalSymbol' + responses: + '200': + description: 24hr ticker + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/ticker' + - $ref: '#/components/schemas/tickerList' + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /api/v3/ticker/price: + get: + summary: Symbol Price Ticker + description: |- + Latest price for a symbol or symbols. + + - If the symbol is not sent, prices for all symbols will be returned in an array. + + Weight(IP):\ + `1` for a single symbol;\ + `2` when the symbol parameter is omitted; + tags: + - Market + parameters: + - $ref: '#/components/parameters/optionalSymbol' + responses: + '200': + description: Price ticker + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/priceTicker' + - $ref: '#/components/schemas/priceTickerList' + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /api/v3/ticker/bookTicker: + get: + summary: Symbol Order Book Ticker + description: |- + Best price/qty on the order book for a symbol or symbols. + + - If the symbol is not sent, bookTickers for all symbols will be returned in an array. + + Weight(IP):\ + `1` for a single symbol;\ + `2` when the symbol parameter is omitted; + tags: + - Market + parameters: + - $ref: '#/components/parameters/optionalSymbol' + responses: + '200': + description: Order book ticker + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/bookTicker' + - $ref: '#/components/schemas/bookTickerList' + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /api/v3/order/test: + post: + summary: Test New Order (TRADE) + description: |- + Test new order creation and signature/recvWindow long. + Creates and validates a new order but does not send it into the matching engine. + + Weight(IP): 1 + tags: + - Trade + parameters: + - $ref: '#/components/parameters/symbol' + - $ref: '#/components/parameters/side' + - $ref: '#/components/parameters/orderType' + - $ref: '#/components/parameters/timeInForce' + - $ref: '#/components/parameters/optionalQuantity' + - $ref: '#/components/parameters/quoteOrderQty' + - $ref: '#/components/parameters/optionalPrice' + - $ref: '#/components/parameters/newClientOrderId' + - $ref: '#/components/parameters/stopPrice' + - $ref: '#/components/parameters/icebergQty' + - $ref: '#/components/parameters/newOrderRespType' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /api/v3/order: + get: + summary: Query Order (USER_DATA) + description: |- + Check an order's status. + + - Either `orderId` or `origClientOrderId` must be sent. + - For some historical orders `cummulativeQuoteQty` will be < 0, meaning the data is not available at this time. + + Weight(IP): 2 + tags: + - Trade + parameters: + - $ref: '#/components/parameters/symbol' + - $ref: '#/components/parameters/orderId' + - $ref: '#/components/parameters/origClientOrderId' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Order details + content: + application/json: + schema: + $ref: '#/components/schemas/orderDetails' + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + post: + summary: New Order (TRADE) + description: |- + Send in a new order. + + - `LIMIT_MAKER` are `LIMIT` orders that will be rejected if they would immediately match and trade as a taker. + - `STOP_LOSS` and `TAKE_PROFIT` will execute a `MARKET` order when the `stopPrice` is reached. + - Any `LIMIT` or `LIMIT_MAKER` type order can be made an iceberg order by sending an `icebergQty`. + - Any order with an `icebergQty` MUST have `timeInForce` set to `GTC`. + - `MARKET` orders using `quantity` specifies how much a user wants to buy or sell based on the market price. + - `MARKET` orders using `quoteOrderQty` specifies the amount the user wants to spend (when buying) or receive (when selling) of the quote asset; the correct quantity will be determined based on the market liquidity and `quoteOrderQty`. + - `MARKET` orders using `quoteOrderQty` will not break `LOT_SIZE` filter rules; the order will execute a quantity that will have the notional value as close as possible to `quoteOrderQty`. + - same `newClientOrderId` can be accepted only when the previous one is filled, otherwise the order will be rejected. + + Trigger order price rules against market price for both `MARKET` and `LIMIT` versions: + + - Price above market price: `STOP_LOSS` `BUY`, `TAKE_PROFIT` `SELL` + - Price below market price: `STOP_LOSS` `SELL`, `TAKE_PROFIT` `BUY` + + + Weight(IP): 1 + tags: + - Trade + parameters: + - $ref: '#/components/parameters/symbol' + - $ref: '#/components/parameters/side' + - $ref: '#/components/parameters/orderType' + - $ref: '#/components/parameters/timeInForce' + - $ref: '#/components/parameters/optionalQuantity' + - $ref: '#/components/parameters/quoteOrderQty' + - $ref: '#/components/parameters/optionalPrice' + - $ref: '#/components/parameters/newClientOrderId' + - $ref: '#/components/parameters/stopPrice' + - $ref: '#/components/parameters/icebergQty' + - $ref: '#/components/parameters/newOrderRespType' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Order result + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/orderResponseAck' + - $ref: '#/components/schemas/orderResponseResult' + - $ref: '#/components/schemas/orderResponseFull' + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + delete: + summary: Cancel Order (TRADE) + description: |- + Cancel an active order. + + Either `orderId` or `origClientOrderId` must be sent. + + Weight(IP): 1 + tags: + - Trade + parameters: + - $ref: '#/components/parameters/symbol' + - $ref: '#/components/parameters/orderId' + - $ref: '#/components/parameters/origClientOrderId' + - $ref: '#/components/parameters/newClientOrderId' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Cancelled order + content: + application/json: + schema: + $ref: '#/components/schemas/order' + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /api/v3/openOrders: + get: + summary: Current Open Orders (USER_DATA) + description: |- + Get all open orders on a symbol. Careful when accessing this with no symbol. + + Weight(IP):\ + `3` for a single symbol;\ + `40` when the symbol parameter is omitted; + tags: + - Trade + parameters: + - $ref: '#/components/parameters/optionalSymbol' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Current open orders + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/orderDetails' + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + delete: + summary: Cancel all Open Orders on a Symbol (TRADE) + description: |- + Cancels all active orders on a symbol.\ + This includes OCO orders. + + Weight(IP): 1 + tags: + - Trade + parameters: + - $ref: '#/components/parameters/symbol' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Cancelled orders + content: + application/json: + schema: + type: array + items: + anyOf: + - $ref: '#/components/schemas/order' + - $ref: '#/components/schemas/ocoOrder' + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /api/v3/allOrders: + get: + summary: All Orders (USER_DATA) + description: |- + Get all account orders; active, canceled, or filled.. + + - If `orderId` is set, it will get orders >= that `orderId`. Otherwise most recent orders are returned. + - For some historical orders `cummulativeQuoteQty` will be < 0, meaning the data is not available at this time. + - If `startTime` and/or `endTime` provided, `orderId` is not required + + Weight(IP): 10 + tags: + - Trade + parameters: + - $ref: '#/components/parameters/symbol' + - $ref: '#/components/parameters/orderId' + - $ref: '#/components/parameters/startTime' + - $ref: '#/components/parameters/endTime' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Current open orders + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/orderDetails' + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /api/v3/order/oco: + post: + summary: New OCO (TRADE) + description: |- + Send in a new OCO + + - Price Restrictions: + - `SELL`: Limit Price > Last Price > Stop Price + - `BUY`: Limit Price < Last Price < 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(IP): 1 + tags: + - Trade + parameters: + - $ref: '#/components/parameters/symbol' + - $ref: '#/components/parameters/listClientOrderId' + - $ref: '#/components/parameters/side' + - $ref: '#/components/parameters/quantity' + - $ref: '#/components/parameters/limitClientOrderId' + - $ref: '#/components/parameters/price' + - $ref: '#/components/parameters/limitIcebergQty' + - $ref: '#/components/parameters/stopClientOrderId' + - $ref: '#/components/parameters/ocoStopPrice' + - $ref: '#/components/parameters/stopLimitPrice' + - $ref: '#/components/parameters/stopIcebergQty' + - $ref: '#/components/parameters/stopLimitTimeInForce' + - $ref: '#/components/parameters/ocoNewOrderRespType' + - $ref: '#/components/parameters/sideEffectType' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: New OCO details + content: + application/json: + schema: + type: object + properties: + orderListId: + type: integer + format: int64 + example: 0 + contingencyType: + type: string + example: "OCO" + listStatusType: + type: string + example: "EXEC_STARTED" + listOrderStatus: + type: string + example: "EXECUTING" + listClientOrderId: + type: string + example: "JYVpp3F0f5CAG15DhtrqLp" + transactionTime: + type: integer + format: int64 + example: 1563417480525 + symbol: + type: string + example: "LTCBTC" + orders: + type: array + items: + type: object + properties: + symbol: + type: string + orderId: + type: integer + format: int64 + clientOrderId: + type: string + required: + - symbol + - orderId + - clientOrderId + example: + - symbol: "LTCBTC" + orderId: 2 + clientOrderId: "Kk7sqHb9J6mJWTMDVW7Vos" + - symbol: "LTCBTC" + orderId: 3 + clientOrderId: "xTXKaGYd4bluPVp78IVRvl" + orderReports: + type: array + items: + type: object + properties: + symbol: + type: string + orderId: + type: integer + format: int64 + orderListId: + type: integer + format: int64 + clientOrderId: + type: string + transactTime: + type: integer + format: int64 + price: + type: string + origQty: + type: string + executedQty: + type: string + cummulativeQuoteQty: + type: string + status: + type: string + timeInForce: + type: string + type: + type: string + side: + type: string + stopPrice: + type: string + required: + - symbol + - orderId + - orderListId + - clientOrderId + - transactTime + - price + - origQty + - executedQty + - cummulativeQuoteQty + - status + - timeInForce + - type + - side + - stopPrice + example: + - symbol: "LTCBTC" + orderId: 2 + orderListId: 0 + clientOrderId: "Kk7sqHb9J6mJWTMDVW7Vos" + transactTime: 1563417480525 + price: "0.000000" + origQty: "0.624363" + executedQty: "0.000000" + cummulativeQuoteQty: "0.000000" + status: "NEW" + timeInForce: "GTC" + type: "STOP_LOSS" + side: "BUY" + stopPrice: "0.960664" + - symbol: "LTCBTC" + orderId: 3 + orderListId: 0 + clientOrderId: "xTXKaGYd4bluPVp78IVRvl" + transactTime: 1563417480525 + price: "0.036435" + origQty: "0.624363" + executedQty: "0.000000" + cummulativeQuoteQty: "0.000000" + status: "NEW" + timeInForce: "GTC" + type: "LIMIT_MAKER" + side: "BUY" + required: + - orderListId + - contingencyType + - listStatusType + - listOrderStatus + - listClientOrderId + - transactionTime + - symbol + - orders + - orderReports + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /api/v3/orderList: + get: + summary: Query OCO (USER_DATA) + description: |- + Retrieves a specific OCO based on provided optional parameters + + Weight(IP): 2 + tags: + - Trade + parameters: + - $ref: '#/components/parameters/orderListId' + - $ref: '#/components/parameters/origClientOrderId' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: OCO details + content: + application/json: + schema: + type: object + properties: + orderListId: + type: integer + format: int64 + example: 27 + contingencyType: + type: string + example: "OCO" + listStatusType: + type: string + example: "EXEC_STARTED" + listOrderStatus: + type: string + example: "EXECUTING" + listClientOrderId: + type: string + example: "h2USkA5YQpaXHPIrkd96xE" + transactionTime: + type: integer + format: int64 + example: 1565245656253 + symbol: + type: string + example: "LTCBTC" + orders: + type: array + items: + type: object + properties: + symbol: + type: string + orderId: + type: integer + format: int64 + clientOrderId: + type: string + example: + - symbol: "LTCBTC" + orderId: 4 + clientOrderId: "qD1gy3kc3Gx0rihm9Y3xwS" + - symbol: "LTCBTC" + orderId: 5 + clientOrderId: "ARzZ9I00CPM8i3NhmU9Ega" + required: + - symbol + - orderId + - clientOrderId + required: + - orderListId + - contingencyType + - listStatusType + - listOrderStatus + - listClientOrderId + - transactionTime + - symbol + - orders + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + delete: + summary: Cancel OCO (TRADE) + description: |- + Cancel an entire Order List + + Canceling an individual leg will cancel the entire OCO + + Weight(IP): 1 + tags: + - Trade + parameters: + - $ref: '#/components/parameters/symbol' + - $ref: '#/components/parameters/orderListId' + - $ref: '#/components/parameters/listClientOrderId' + - $ref: '#/components/parameters/newClientOrderId' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Report on deleted OCO + content: + application/json: + schema: + $ref: '#/components/schemas/ocoOrder' + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /api/v3/allOrderList: + get: + summary: Query all OCO (USER_DATA) + description: |- + Retrieves all OCO based on provided optional parameters + + Weight(IP): 10 + tags: + - Trade + parameters: + - $ref: '#/components/parameters/fromId' + - $ref: '#/components/parameters/startTime' + - $ref: '#/components/parameters/endTime' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: List of OCO orders + content: + application/json: + schema: + type: array + items: + type: object + properties: + orderListId: + type: integer + format: int64 + example: 29 + contingencyType: + type: string + example: "OCO" + listStatusType: + type: string + example: "EXEC_STARTED" + listOrderStatus: + type: string + example: "EXECUTING" + listClientOrderId: + type: string + example: "amEEAXryFzFwYF1FeRpUoZ" + transactionTime: + type: integer + format: int64 + example: 1565245913483 + symbol: + type: string + example: "LTCBTC" + isIsolated: + type: boolean + orders: + type: array + items: + type: object + properties: + symbol: + type: string + orderId: + type: integer + format: int64 + clientOrderId: + type: string + example: + - symbol: "LTCBTC" + orderId: 4 + clientOrderId: "oD7aesZqjEGlZrbtRpy5zB" + - symbol: "LTCBTC" + orderId: 5 + clientOrderId: "Jr1h6xirOxgeJOUuYQS7V3" + required: + - symbol + - orderId + - clientOrderId + required: + - orderListId + - contingencyType + - listStatusType + - listOrderStatus + - listClientOrderId + - transactionTime + - symbol + - isIsolated + - orders + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /api/v3/openOrderList: + get: + summary: Query Open OCO (USER_DATA) + description: 'Weight(IP): 3' + tags: + - Trade + parameters: + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: List of OCO orders + content: + application/json: + schema: + type: array + items: + type: object + properties: + orderListId: + type: integer + format: int64 + example: 31 + contingencyType: + type: string + example: "OCO" + listStatusType: + type: string + example: "EXEC_STARTED" + listOrderStatus: + type: string + example: "EXECUTING" + listClientOrderId: + type: string + example: "wuB13fmulKj3YjdqWEcsnp" + transactionTime: + type: integer + format: int64 + example: 1565246080644 + symbol: + type: string + example: "LTCBTC" + orders: + type: array + items: + type: object + properties: + symbol: + type: string + orderId: + type: integer + format: int64 + clientOrderId: + type: string + required: + - symbol + - orderId + - clientOrderId + example: + - symbol: "LTCBTC" + orderId: 4 + clientOrderId: "r3EH2N76dHfLoSZWIUw1bT" + - symbol: "LTCBTC" + orderId: 5 + clientOrderId: "Cv1SnyPD3qhqpbjpYEHbd2" + required: + - orderListId + - contingencyType + - listStatusType + - listOrderStatus + - listClientOrderId + - transactionTime + - symbol + - orders + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /api/v3/account: + get: + summary: Account Information (USER_DATA) + description: |- + Get current account information. + + Weight(IP): 10 + tags: + - Trade + parameters: + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Account details + content: + application/json: + schema: + $ref: '#/components/schemas/account' + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /api/v3/myTrades: + get: + summary: Account Trade List (USER_DATA) + description: |- + Get trades for a specific account and symbol. + + If `fromId` is set, it will get id >= that `fromId`. Otherwise most recent orders are returned. + + Weight(IP): 10 + tags: + - Trade + parameters: + - $ref: '#/components/parameters/symbol' + - name: orderId + in: query + description: This can only be used in combination with symbol. + schema: + type: integer + format: int64 + - $ref: '#/components/parameters/startTime' + - $ref: '#/components/parameters/endTime' + - $ref: '#/components/parameters/fromId' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: List of trades + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/myTrade' + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /api/v3/rateLimit/order: + get: + summary: Query Current Order Count Usage (TRADE) + description: |- + Displays the user's current order count usage for all intervals. + + Weight(IP): 20 + tags: + - Trade + parameters: + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Order rate limits + content: + application/json: + schema: + type: array + items: + type: object + properties: + rateLimitType: + type: string + interval: + type: string + intervalNum: + type: integer + format: int32 + limit: + type: integer + format: int32 + count: + type: integer + format: int32 + required: + - rateLimitType + - interval + - intervalNum + - limit + example: + - rateLimitType: "ORDERS" + interval: "SECOND" + intervalNum: 10 + limit: 10000 + count: 0 + - rateLimitType: "ORDERS" + interval: "DAY" + intervalNum: 1 + limit: 20000 + count: 0 + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/margin/transfer: + post: + summary: Cross Margin Account Transfer (MARGIN) + description: |- + Execute transfer between spot account and cross margin account. + + Weight(IP): 600 + tags: + - Margin + parameters: + - $ref: '#/components/parameters/asset' + - $ref: '#/components/parameters/amount' + - name: type + in: query + description: |- + 1 -> transfer from main account to margin account \ + 2 -> transfer from margin account to main account + schema: + type: integer + format: int32 + enum: [1,2] + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Transfer Id + content: + application/json: + schema: + $ref: '#/components/schemas/transaction' + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + get: + summary: Get Cross Margin Transfer History (USER_DATA) + description: |- + - Response in descending order + - Returns data for last 7 days by default + - Set `archived` to `true` to query data from 6 months ago + + Weight(IP): 1 + tags: + - Margin + parameters: + - $ref: '#/components/parameters/optionalAsset' + - name: type + in: query + description: Tranfer Type + schema: + type: string + enum: [ROLL_IN, ROLL_OUT] + - $ref: '#/components/parameters/startTime' + - $ref: '#/components/parameters/endTime' + - $ref: '#/components/parameters/current' + - $ref: '#/components/parameters/size' + - $ref: '#/components/parameters/archived' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Margin account transfer history, response in descending order + content: + application/json: + schema: + type: object + properties: + rows: + type: array + items: + type: object + properties: + amount: + type: string + asset: + type: string + status: + type: string + timestamp: + type: integer + format: int64 + txId: + type: integer + format: int64 + type: + type: string + required: + - amount + - asset + - status + - timestamp + - txId + - type + total: + type: integer + format: int32 + example: 3 + example: + rows: + - + amount: "0.10000000" + asset: "BNB" + status: "CONFIRMED" + timestamp: 1566898617 + txId: 5240372201 + type: "ROLL_IN" + total: 1 + required: + - rows + - total + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/margin/loan: + post: + summary: Margin Account Borrow (MARGIN) + description: |- + Apply for a loan. + + - If "isIsolated" = "TRUE", "symbol" must be sent + - "isIsolated" = "FALSE" for crossed margin loan + + Weight(UID): 3000 + tags: + - Margin + parameters: + - $ref: '#/components/parameters/asset' + - $ref: '#/components/parameters/isIsolatedMargin' + - $ref: '#/components/parameters/optionalSymbol' + - $ref: '#/components/parameters/amount' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Transaction id + content: + application/json: + schema: + $ref: '#/components/schemas/transaction' + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + get: + summary: Query Loan Record (USER_DATA) + description: |- + - `txId` or `startTime` must be sent. `txId` takes precedence. + - Response in descending order + - If `isolatedSymbol` is not sent, crossed margin data will be returned + - Set `archived` to `true` to query data from 6 months ago + + Weight(IP): 10 + tags: + - Margin + parameters: + - $ref: '#/components/parameters/asset' + - $ref: '#/components/parameters/isolatedSymbol' + - name: txId + in: query + description: the tranId in `POST /sapi/v1/margin/loan` + schema: + type: integer + format: int64 + example: 123456789 + - $ref: '#/components/parameters/startTime' + - $ref: '#/components/parameters/endTime' + - $ref: '#/components/parameters/current' + - $ref: '#/components/parameters/size' + - $ref: '#/components/parameters/archived' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Loan records + content: + application/json: + schema: + type: object + properties: + rows: + type: array + items: + type: object + properties: + isolatedSymbol: + type: string + txId: + type: integer + format: int64 + asset: + type: string + principal: + type: string + timestamp: + type: integer + format: int64 + status: + type: string + required: + - isolatedSymbol + - txId + - asset + - principal + - timestamp + - status + total: + type: integer + format: int32 + required: + - rows + - total + example: + rows: + - + isolatedSymbol: "BNBUSDT" + txId: 12807067523 + asset: "BNB" + principal: "0.84624403" + timestamp: 1555056425000 + status: "CONFIRMED" + total: 1 + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/margin/repay: + post: + summary: Margin Account Repay (MARGIN) + description: |- + Repay loan for margin account. + + - If "isIsolated" = "TRUE", "symbol" must be sent + - "isIsolated" = "FALSE" for crossed margin repay + + Weight(IP): 3000 + tags: + - Margin + parameters: + - $ref: '#/components/parameters/asset' + - $ref: '#/components/parameters/isIsolatedMargin' + - $ref: '#/components/parameters/optionalSymbol' + - $ref: '#/components/parameters/amount' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Transaction id + content: + application/json: + schema: + $ref: '#/components/schemas/transaction' + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + get: + summary: Query Repay Record (USER_DATA) + description: |- + - `txId` or `startTime` must be sent. `txId` takes precedence. + - Response in descending order + - If `isolatedSymbol` is not sent, crossed margin data will be returned + - Set `archived` to `true` to query data from 6 months ago + + Weight(IP): 10 + tags: + - Margin + parameters: + - $ref: '#/components/parameters/asset' + - $ref: '#/components/parameters/isolatedSymbol' + - name: txId + in: query + description: the tranId in `POST /sapi/v1/margin/repay` + schema: + type: integer + format: int64 + example: 2970933056 + - $ref: '#/components/parameters/startTime' + - $ref: '#/components/parameters/endTime' + - $ref: '#/components/parameters/current' + - $ref: '#/components/parameters/size' + - $ref: '#/components/parameters/archived' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Load records + content: + application/json: + schema: + type: object + properties: + rows: + type: array + items: + type: object + properties: + isolatedSymbol: + type: string + example: "BNBUSDT" + description: Isolated symbol, will not be returned for crossed margin + amount: + type: string + example: "14.00000000" + description: Total amount repaid + asset: + type: string + example: "BNB" + interest: + type: string + example: "0.01866667" + description: Interest repaid + principal: + type: string + example: "13.98133333" + description: Principal repaid + status: + type: string + example: "CONFIRMED" + description: One of PENDING (pending execution), CONFIRMED (successfully execution), FAILED (execution failed, nothing happened to your account) + timestamp: + type: integer + format: int64 + example: 1563438204000 + txId: + type: integer + format: int64 + example: 2970933056 + required: + - isolatedSymbol + - amount + - asset + - interest + - principal + - status + - timestamp + - txId + total: + type: integer + format: int32 + example: 1 + required: + - rows + - total + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/margin/asset: + get: + summary: Query Margin Asset (MARKET_DATA) + description: 'Weight(IP): 10' + tags: + - Margin + parameters: + - $ref: '#/components/parameters/asset' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Asset details + content: + application/json: + schema: + type: object + properties: + assetFullName: + type: string + example: "Binance Coin" + assetName: + type: string + example: "BNB" + isBorrowable: + type: boolean + example: false + isMortgageable: + type: boolean + userMinBorrow: + type: string + example: "0.00000000" + userMinRepay: + type: string + example: "0.00000000" + required: + - assetFullName + - assetName + - isBorrowable + - isMortgageable + - userMinBorrow + - userMinRepay + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/margin/pair: + get: + summary: Query Cross Margin Pair (MARKET_DATA) + description: 'Weight(IP): 10' + tags: + - Margin + parameters: + - $ref: '#/components/parameters/symbol' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Margin pair details + content: + application/json: + schema: + type: object + properties: + id: + type: integer + format: int64 + example: 323355778339572400 + symbol: + type: string + example: "BNBUSDT" + base: + type: string + example: "BTC" + quote: + type: string + example: "USDT" + isMarginTrade: + type: boolean + isBuyAllowed: + type: boolean + isSellAllowed: + type: boolean + required: + - id + - symbol + - base + - quote + - isMarginTrade + - isBuyAllowed + - isSellAllowed + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/margin/allAssets: + get: + summary: Get All Margin Assets (MARKET_DATA) + description: 'Weight(IP): 1' + tags: + - Margin + security: + - ApiKeyAuth: [] + responses: + '200': + description: Assets details + content: + application/json: + schema: + type: array + items: + type: object + properties: + assetFullName: + type: string + example: "Binance coin" + assetName: + type: string + example: "BNB" + isBorrowable: + type: boolean + isMortgageable: + type: boolean + userMinBorrow: + type: string + example: "0.00000000" + userMinRepay: + type: string + example: "0.00000000" + required: + - assetFullName + - assetName + - isBorrowable + - isMortgageable + - userMinBorrow + - userMinRepay + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/margin/allPairs: + get: + summary: Get All Cross Margin Pairs (MARKET_DATA) + description: 'Weight(IP): 1' + tags: + - Margin + security: + - ApiKeyAuth: [] + responses: + '200': + description: Margin pairs + content: + application/json: + schema: + type: array + items: + type: object + properties: + base: + type: string + example: "BNB" + id: + type: integer + format: int64 + example: 351637150141315861 + isBuyAllowed: + type: boolean + isMarginTrade: + type: boolean + isSellAllowed: + type: boolean + quote: + type: string + example: "BTC" + symbol: + type: string + example: "BNBBTC" + required: + - base + - id + - isBuyAllowed + - isMarginTrade + - isSellAllowed + - quote + - symbol + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/margin/priceIndex: + get: + summary: Query Margin PriceIndex (MARKET_DATA) + description: 'Weight(IP): 10' + tags: + - Margin + parameters: + - $ref: '#/components/parameters/symbol' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Price index + content: + application/json: + schema: + type: object + properties: + calcTime: + type: integer + format: int64 + example: 1562046418000 + price: + type: string + example: "0.00333930" + symbol: + type: string + example: "BNBBTC" + required: + - calcTime + - price + - symbol + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/margin/order: + get: + summary: Query Margin Account's Order (USER_DATA) + description: |- + - Either `orderId` or `origClientOrderId` must be sent. + - For some historical orders `cummulativeQuoteQty` will be < 0, meaning the data is not available at this time. + + Weight(IP): 10 + tags: + - Margin + parameters: + - $ref: '#/components/parameters/symbol' + - $ref: '#/components/parameters/isIsolatedMargin' + - $ref: '#/components/parameters/orderId' + - $ref: '#/components/parameters/origClientOrderId' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Interest History, response in descending order + content: + application/json: + schema: + $ref: "#/components/schemas/marginOrderDetail" + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + post: + summary: Margin Account New Order (TRADE) + description: |- + Post a new order for margin account. + + Weight(UID): 6 + tags: + - Margin + parameters: + - $ref: '#/components/parameters/symbol' + - $ref: '#/components/parameters/isIsolatedMargin' + - $ref: '#/components/parameters/side' + - $ref: '#/components/parameters/orderType' + - $ref: '#/components/parameters/quantity' + - $ref: '#/components/parameters/quoteOrderQty' + - $ref: '#/components/parameters/optionalPrice' + - $ref: '#/components/parameters/stopPrice' + - $ref: '#/components/parameters/newClientOrderId' + - $ref: '#/components/parameters/icebergQty' + - $ref: '#/components/parameters/ocoNewOrderRespType' + - $ref: '#/components/parameters/sideEffectType' + - $ref: '#/components/parameters/timeInForce' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Margin order info + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/marginOrderResponseAck' + - $ref: '#/components/schemas/marginOrderResponseResult' + - $ref: '#/components/schemas/marginOrderResponseFull' + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + delete: + summary: Margin Account Cancel Order (TRADE) + description: |- + Cancel an active order for margin account. + + Either `orderId` or `origClientOrderId` must be sent. + + Weight(IP): 10 + tags: + - Margin + parameters: + - $ref: '#/components/parameters/symbol' + - $ref: '#/components/parameters/isIsolatedMargin' + - $ref: '#/components/parameters/orderId' + - $ref: '#/components/parameters/origClientOrderId' + - $ref: '#/components/parameters/newClientOrderId' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Cancelled margin order details + content: + application/json: + schema: + $ref: '#/components/schemas/marginOrder' + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/margin/interestHistory: + get: + summary: Get Interest History (USER_DATA) + description: |- + - Response in descending order + - If `isolatedSymbol` is not sent, crossed margin data will be returned + - Set `archived` to `true` to query data from 6 months ago + - `type` in response has 4 enums: + - `PERIODIC` interest charged per hour + - `ON_BORROW` first interest charged on borrow + - `PERIODIC_CONVERTED` interest charged per hour converted into BNB + - `ON_BORROW_CONVERTED` first interest charged on borrow converted into BNB + + Weight(IP): 1 + tags: + - Margin + parameters: + - $ref: '#/components/parameters/optionalAsset' + - $ref: '#/components/parameters/isolatedSymbol' + - $ref: '#/components/parameters/startTime' + - $ref: '#/components/parameters/endTime' + - $ref: '#/components/parameters/current' + - $ref: '#/components/parameters/size' + - $ref: '#/components/parameters/archived' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Interest History, response in descending order + content: + application/json: + schema: + type: object + properties: + rows: + type: array + items: + type: object + properties: + isolatedSymbol: + type: string + example: "BNBUSDT" + asset: + type: string + example: "BNB" + interest: + type: string + example: "0.01866667" + interestAccuredTime: + type: integer + format: int64 + example: 1566813600 + interestRate: + type: string + example: "0.01600000" + principal: + type: string + example: "36.22000000" + type: + type: string + example: "ON_BORROW" + required: + - isolatedSymbol + - asset + - interest + - interestAccuredTime + - interestRate + - principal + - type + total: + type: integer + format: int32 + example: 1 + required: + - rows + - total + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/margin/forceLiquidationRec: + get: + summary: Get Force Liquidation Record (USER_DATA) + description: |- + - Response in descending order + + Weight(IP): 1 + tags: + - Margin + parameters: + - $ref: '#/components/parameters/startTime' + - $ref: '#/components/parameters/endTime' + - $ref: '#/components/parameters/isolatedSymbol' + - $ref: '#/components/parameters/current' + - $ref: '#/components/parameters/size' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Force Liquidation History, response in descending order + content: + application/json: + schema: + type: object + properties: + rows: + type: array + items: + type: object + properties: + avgPrice: + type: string + executedQty: + type: string + orderId: + type: integer + format: int64 + price: + type: string + qty: + type: string + side: + type: string + symbol: + type: string + timeInForce: + type: string + isIsolated: + type: boolean + updatedTime: + type: integer + format: int64 + required: + - avgPrice + - executedQty + - orderId + - price + - qty + - side + - symbol + - timeInForce + - isIsolated + - updatedTime + total: + type: integer + format: int32 + example: 1 + required: + - rows + - total + example: + rows: + - + avgPrice: "0.00388359" + executedQty: "31.39000000" + orderId: 180015097 + price: "0.00388110" + qty: "31.39000000" + side: "SELL" + symbol: "BNBBTC" + timeInForce: "GTC" + isIsolated: true + updatedTime: 1558941374745 + total: 1 + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/margin/account: + get: + summary: Query Cross Margin Account Details (USER_DATA) + description: 'Weight(IP): 10' + tags: + - Margin + parameters: + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Margin account details + content: + application/json: + schema: + type: object + properties: + borrowEnabled: + type: boolean + marginLevel: + type: string + example: "11.64405625" + totalAssetOfBtc: + type: string + example: "6.82728457" + totalLiabilityOfBtc: + type: string + example: "0.58633215" + totalNetAssetOfBtc: + type: string + example: "6.24095242" + tradeEnabled: + type: boolean + transferEnabled: + type: boolean + userAssets: + type: array + items: + type: object + properties: + asset: + type: string + example: "BTC" + borrowed: + type: string + example: "0.00000000" + free: + type: string + example: "0.00499500" + interest: + type: string + example: "0.00000000" + locked: + type: string + example: "0.00000000" + netAsset: + type: string + example: "0.00499500" + required: + - asset + - borrowed + - free + - interest + - locked + - netAsset + required: + - borrowEnabled + - marginLevel + - totalAssetOfBtc + - totalLiabilityOfBtc + - totalNetAssetOfBtc + - tradeEnabled + - transferEnabled + - userAssets + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/margin/openOrders: + get: + summary: Query Margin Account's Open Orders (USER_DATA) + description: |- + - If the `symbol` 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 ="TRUE", symbol must be sent. + + Weight(IP): 10 + tags: + - Margin + parameters: + - $ref: '#/components/parameters/optionalSymbol' + - $ref: '#/components/parameters/isIsolatedMargin' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Margin open orders list + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/marginOrderDetail' + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + delete: + summary: Margin Account Cancel all Open Orders on a Symbol (TRADE) + description: | + - Cancels all active orders on a symbol for margin account. + - This includes OCO orders. + + Weight(IP): 1 + tags: + - Margin + parameters: + - $ref: '#/components/parameters/symbol' + - $ref: "#/components/parameters/isIsolatedMargin" + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Cancelled margin orders + content: + application/json: + schema: + type: array + items: + anyOf: + - $ref: '#/components/schemas/canceledMarginOrderDetail' + - $ref: '#/components/schemas/marginOcoOrder' + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/margin/allOrders: + get: + summary: Query Margin Account's All Orders (USER_DATA) + description: |- + - If `orderId` is set, it will get orders >= that orderId. Otherwise most recent orders are returned. + - For some historical orders `cummulativeQuoteQty` will be < 0, meaning the data is not available at this time. + + Weight(IP): 200 + + Request Limit: 60 times/min per IP + tags: + - Margin + parameters: + - $ref: '#/components/parameters/symbol' + - $ref: '#/components/parameters/isIsolatedMargin' + - $ref: '#/components/parameters/orderId' + - $ref: '#/components/parameters/startTime' + - $ref: '#/components/parameters/endTime' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Margin order list + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/marginOrderDetail' + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/margin/order/oco: + post: + summary: Margin Account New OCO (TRADE) + description: |- + Send in a new OCO for a margin account + + - Price Restrictions: + - SELL: Limit Price > Last Price > Stop Price + - BUY: Limit Price < Last Price < 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 + tags: + - Margin + parameters: + - $ref: '#/components/parameters/symbol' + - $ref: '#/components/parameters/isIsolatedMargin' + - $ref: '#/components/parameters/listClientOrderId' + - $ref: '#/components/parameters/side' + - $ref: '#/components/parameters/quantity' + - $ref: '#/components/parameters/limitClientOrderId' + - $ref: '#/components/parameters/price' + - $ref: '#/components/parameters/limitIcebergQty' + - $ref: '#/components/parameters/stopClientOrderId' + - $ref: '#/components/parameters/ocoStopPrice' + - $ref: '#/components/parameters/stopLimitPrice' + - $ref: '#/components/parameters/stopIcebergQty' + - $ref: '#/components/parameters/stopLimitTimeInForce' + - $ref: '#/components/parameters/ocoNewOrderRespType' + - $ref: '#/components/parameters/sideEffectType' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: New Margin OCO details + content: + application/json: + schema: + type: object + properties: + orderListId: + type: integer + format: int64 + example: 0 + contingencyType: + type: string + example: "OCO" + listStatusType: + type: string + example: "EXEC_STARTED" + listOrderStatus: + type: string + example: "EXECUTING" + listClientOrderId: + type: string + example: "JYVpp3F0f5CAG15DhtrqLp" + transactionTime: + type: integer + format: int64 + example: 1563417480525 + symbol: + type: string + example: "LTCBTC" + marginBuyBorrowAmount: + type: string + example: "5" + description: will not return if no margin trade happens + marginBuyBorrowAsset: + type: string + example: "BTC" + description: will not return if no margin trade happens + isIsolated: + type: boolean + example: false + orders: + type: array + items: + type: object + properties: + symbol: + type: string + orderId: + type: integer + format: int64 + clientOrderId: + type: string + required: + - symbol + - orderId + - clientOrderId + example: + - symbol: "LTCBTC" + orderId: 2 + clientOrderId: "Kk7sqHb9J6mJWTMDVW7Vos" + - symbol: "LTCBTC" + orderId: 3 + clientOrderId: "xTXKaGYd4bluPVp78IVRvl" + orderReports: + type: array + items: + type: object + properties: + symbol: + type: string + orderId: + type: integer + format: int64 + orderListId: + type: integer + format: int64 + clientOrderId: + type: string + transactTime: + type: integer + format: int64 + price: + type: string + origQty: + type: string + executedQty: + type: string + cummulativeQuoteQty: + type: string + status: + type: string + timeInForce: + type: string + type: + type: string + side: + type: string + stopPrice: + type: string + required: + - symbol + - orderId + - orderListId + - clientOrderId + - transactTime + - price + - origQty + - executedQty + - cummulativeQuoteQty + - status + - timeInForce + - type + - side + - stopPrice + example: + - symbol: "LTCBTC" + orderId: 2 + orderListId: 0 + clientOrderId: "Kk7sqHb9J6mJWTMDVW7Vos" + transactTime: 1563417480525 + price: "0.000000" + origQty: "0.624363" + executedQty: "0.000000" + cummulativeQuoteQty: "0.000000" + status: "NEW" + timeInForce: "GTC" + type: "STOP_LOSS" + side: "BUY" + stopPrice: "0.960664" + - symbol: "LTCBTC" + orderId: 3 + orderListId: 0 + clientOrderId: "xTXKaGYd4bluPVp78IVRvl" + transactTime: 1563417480525 + price: "0.036435" + origQty: "0.624363" + executedQty: "0.000000" + cummulativeQuoteQty: "0.000000" + status: "NEW" + timeInForce: "GTC" + type: "LIMIT_MAKER" + side: "BUY" + required: + - orderListId + - contingencyType + - listStatusType + - listOrderStatus + - listClientOrderId + - transactionTime + - symbol + - marginBuyBorrowAmount + - marginBuyBorrowAsset + - isIsolated + - orders + - orderReports + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/margin/orderList: + get: + summary: Query Margin Account's OCO (USER_DATA) + description: |- + Retrieves a specific OCO based on provided optional parameters + + - Either `orderListId` or `origClientOrderId` must be provided + + Weight(IP): 10 + tags: + - Margin + parameters: + - $ref: '#/components/parameters/isIsolatedMargin' + - name: symbol + in: query + description: 'Mandatory for isolated margin, not supported for cross margin' + schema: + type: string + - $ref: '#/components/parameters/orderListId' + - $ref: '#/components/parameters/origClientOrderId' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Margin OCO details + content: + application/json: + schema: + type: object + properties: + orderListId: + type: integer + format: int64 + example: 27 + contingencyType: + type: string + example: "OCO" + listStatusType: + type: string + example: "EXEC_STARTED" + listOrderStatus: + type: string + example: "EXECUTING" + listClientOrderId: + type: string + example: "h2USkA5YQpaXHPIrkd96xE" + transactionTime: + type: integer + format: int64 + example: 1565245656253 + symbol: + type: string + example: "LTCBTC" + isIsolated: + type: boolean + example: false + orders: + type: array + items: + type: object + properties: + symbol: + type: string + orderId: + type: integer + format: int64 + clientOrderId: + type: string + example: + - symbol: "LTCBTC" + orderId: 4 + clientOrderId: "qD1gy3kc3Gx0rihm9Y3xwS" + - symbol: "LTCBTC" + orderId: 5 + clientOrderId: "ARzZ9I00CPM8i3NhmU9Ega" + required: + - symbol + - orderId + - clientOrderId + required: + - orderListId + - contingencyType + - listStatusType + - listOrderStatus + - listClientOrderId + - transactionTime + - symbol + - isIsolated + - orders + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + delete: + summary: Margin Account Cancel OCO (TRADE) + description: |- + Cancel an entire Order List for a margin account + + - Canceling an individual leg will cancel the entire OCO + - Either `orderListId` or `listClientOrderId` must be provided + + Weight(UID): 1 + tags: + - Margin + parameters: + - $ref: '#/components/parameters/symbol' + - $ref: '#/components/parameters/isIsolatedMargin' + - $ref: '#/components/parameters/orderListId' + - $ref: '#/components/parameters/listClientOrderId' + - $ref: '#/components/parameters/newClientOrderId' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Margin OCO details + content: + application/json: + schema: + $ref: '#/components/schemas/marginOcoOrder' + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/margin/allOrderList: + get: + summary: Query Margin Account's all OCO (USER_DATA) + description: |- + Retrieves all OCO for a specific margin account based on provided optional parameters + + Weight(IP): 200 + tags: + - Margin + parameters: + - $ref: '#/components/parameters/isIsolatedMargin' + - name: symbol + in: query + description: 'Mandatory for isolated margin, not supported for cross margin' + schema: + type: string + - name: fromId + in: query + description: 'If supplied, neither `startTime` or `endTime` can be provided' + schema: + type: string + - $ref: '#/components/parameters/startTime' + - $ref: '#/components/parameters/endTime' + - name: limit + in: query + description: 'Default Value: 500; Max Value: 1000' + schema: + type: integer + format: int32 + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: List of Margin OCO orders + content: + application/json: + schema: + type: array + items: + type: object + properties: + orderListId: + type: integer + format: int64 + example: 29 + contingencyType: + type: string + example: "OCO" + listStatusType: + type: string + example: "EXEC_STARTED" + listOrderStatus: + type: string + example: "EXECUTING" + listClientOrderId: + type: string + example: "amEEAXryFzFwYF1FeRpUoZ" + transactionTime: + type: integer + format: int64 + example: 1565245913483 + symbol: + type: string + example: "LTCBTC" + isIsolated: + type: boolean + orders: + type: array + items: + type: object + properties: + symbol: + type: string + orderId: + type: integer + format: int64 + clientOrderId: + type: string + required: + - symbol + - orderId + - clientOrderId + example: + - symbol: "LTCBTC" + orderId: 4 + clientOrderId: "oD7aesZqjEGlZrbtRpy5zB" + - symbol: "LTCBTC" + orderId: 5 + clientOrderId: "Jr1h6xirOxgeJOUuYQS7V3" + required: + - orderListId + - contingencyType + - listStatusType + - listOrderStatus + - listClientOrderId + - transactionTime + - symbol + - isIsolated + - orders + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/margin/openOrderList: + get: + summary: Query Margin Account's Open OCO (USER_DATA) + description: 'Weight(IP): 10' + tags: + - Margin + parameters: + - $ref: '#/components/parameters/isIsolatedMargin' + - name: symbol + in: query + description: 'Mandatory for isolated margin, not supported for cross margin' + schema: + type: string + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: List of Open Margin OCO orders + content: + application/json: + schema: + type: array + items: + type: object + properties: + orderListId: + type: integer + format: int64 + example: 31 + contingencyType: + type: string + example: "OCO" + listStatusType: + type: string + example: "EXEC_STARTED" + listOrderStatus: + type: string + example: "EXECUTING" + listClientOrderId: + type: string + example: "wuB13fmulKj3YjdqWEcsnp" + transactionTime: + type: integer + format: int64 + example: 1565246080644 + symbol: + type: string + example: "LTCBTC" + isIsolated: + type: boolean + example: false + orders: + type: array + items: + type: object + properties: + symbol: + type: string + orderId: + type: integer + format: int64 + clientOrderId: + type: string + required: + - symbol + - orderId + - clientOrderId + example: + - symbol: "LTCBTC" + orderId: 4 + clientOrderId: "r3EH2N76dHfLoSZWIUw1bT" + - symbol: "LTCBTC" + orderId: 5 + clientOrderId: "Cv1SnyPD3qhqpbjpYEHbd2" + required: + - orderListId + - contingencyType + - listStatusType + - listOrderStatus + - listClientOrderId + - transactionTime + - symbol + - isIsolated + - orders + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/margin/myTrades: + get: + summary: Query Margin Account's Trade List (USER_DATA) + description: |- + - If `fromId` is set, it will get orders >= that `fromId`. Otherwise most recent trades are returned. + + Weight(IP): 10 + + tags: + - Margin + parameters: + - $ref: '#/components/parameters/symbol' + - $ref: '#/components/parameters/isIsolatedMargin' + - $ref: '#/components/parameters/startTime' + - $ref: '#/components/parameters/endTime' + - $ref: '#/components/parameters/fromId' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: List of margin trades + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/marginTrade' + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/margin/maxBorrowable: + get: + summary: Query Max Borrow (USER_DATA) + description: |- + - If `isolatedSymbol` is not sent, crossed margin data will be sent. + - `borrowLimit` is also available from https://www.binance.com/en/margin-fee + + Weight(IP): 50 + tags: + - Margin + parameters: + - $ref: '#/components/parameters/asset' + - $ref: '#/components/parameters/isolatedSymbol' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Details on max borrow amount + content: + application/json: + schema: + type: object + properties: + amount: + type: string + example: "1.69248805" + description: account's currently max borrowable amount with sufficient system availability + borrowLimit: + type: string + example: "60" + description: max borrowable amount limited by the account level + required: + - amount + - borrowLimit + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/margin/maxTransferable: + get: + summary: Query Max Transfer-Out Amount (USER_DATA) + description: |- + - If `isolatedSymbol` is not sent, crossed margin data will be sent. + + Weight(IP): 50 + tags: + - Margin + parameters: + - $ref: '#/components/parameters/asset' + - $ref: '#/components/parameters/isolatedSymbol' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Details on max transferable amount + content: + application/json: + schema: + type: object + properties: + amount: + type: string + description: "Account's currently max borrowable amount with sufficient system availability" + borrowLimit: + type: string + description: "Max borrowable amount limited by the account level" + example: + amount: "1.69248805" + borrowLimit: "60" + required: + - amount + - borrowLimit + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/margin/isolated/transfer: + get: + summary: Get Isolated Margin Transfer History (USER_DATA) + description: 'Weight(IP): 1' + tags: + - Margin + parameters: + - $ref: '#/components/parameters/optionalAsset' + - $ref: '#/components/parameters/symbol' + - $ref: '#/components/parameters/transFrom' + - $ref: '#/components/parameters/transTo' + - $ref: '#/components/parameters/startTime' + - $ref: '#/components/parameters/endTime' + - $ref: '#/components/parameters/current' + - $ref: '#/components/parameters/size' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Isolated Margin Transfer History + content: + application/json: + schema: + $ref: '#/components/schemas/marginTransferDetails' + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + post: + summary: Isolated Margin Account Transfer (MARGIN) + description: 'Weight(UID): 600' + tags: + - Margin + parameters: + - $ref: '#/components/parameters/asset' + - $ref: '#/components/parameters/symbol' + - $ref: '#/components/parameters/transFrom' + - $ref: '#/components/parameters/transTo' + - $ref: '#/components/parameters/amount' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Transaction Id + content: + application/json: + schema: + type: object + example: + tranId: 100000001 + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/margin/isolated/account: + get: + summary: Query Isolated Margin Account Info (USER_DATA) + description: |- + - If "symbols" is not sent, all isolated assets will be returned. + - If "symbols" is sent, only the isolated assets of the sent symbols will be returned. + + Weight(IP): 10 + tags: + - Margin + parameters: + - $ref: '#/components/parameters/symbols' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Isolated Margin Account Info when "symbols" is not sent + content: + application/json: + schema: + $ref: '#/components/schemas/isolatedMarginAccountInfo' + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + delete: + summary: Disable Isolated Margin Account (TRADE) + description: |- + Disable isolated margin account for a specific symbol. Each trading pair can only be deactivated once every 24 hours . + + Weight(UID): 300 + tags: + - Margin + parameters: + - $ref: '#/components/parameters/symbol' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Isolated Margin Account status + content: + application/json: + schema: + type: object + properties: + success: + type: boolean + symbol: + type: string + example: "BTCUSDT" + required: + - success + - symbol + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + post: + summary: Enable Isolated Margin Account (TRADE) + description: |- + Enable isolated margin account for a specific symbol. + + Weight(UID): 300 + tags: + - Margin + parameters: + - $ref: '#/components/parameters/symbol' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Isolated Margin Account status + content: + application/json: + schema: + type: object + properties: + success: + type: boolean + symbol: + type: string + example: "BTCUSDT" + required: + - success + - symbol + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/margin/isolated/accountLimit: + get: + summary: Query Enabled Isolated Margin Account Limit (USER_DATA) + description: |- + Query enabled isolated margin account limit. + + Weight(IP): 1 + tags: + - Margin + parameters: + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Number of enabled Isolated Margin Account and its limit + content: + application/json: + schema: + type: object + properties: + enabledAccount: + type: integer + format: int64 + example: 5 + maxAccount: + type: integer + format: int64 + example: 20 + required: + - enabledAccount + - maxAccount + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/margin/isolated/pair: + get: + summary: Query Isolated Margin Symbol (USER_DATA) + description: 'Weight(IP): 10' + tags: + - Margin + parameters: + - $ref: '#/components/parameters/symbol' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Isolated Margin Symbol + content: + application/json: + schema: + type: object + properties: + symbol: + type: string + example: 'BTCUSDT' + base: + type: string + example: 'BTC' + quote: + type: string + example: 'USDT' + isMarginTrade: + type: boolean + isBuyAllowed: + type: boolean + isSellAllowed: + type: boolean + required: + - symbol + - base + - quote + - isMarginTrade + - isBuyAllowed + - isSellAllowed + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/margin/isolated/allPairs: + get: + summary: Get All Isolated Margin Symbol(USER_DATA) + description: 'Weight(IP): 10' + tags: + - Margin + parameters: + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: All Isolated Margin Symbols + content: + application/json: + schema: + type: array + items: + type: object + properties: + symbol: + type: string + example: 'BTCUSDT' + base: + type: string + example: 'BTC' + quote: + type: string + example: 'USDT' + isMarginTrade: + type: boolean + isBuyAllowed: + type: boolean + isSellAllowed: + type: boolean + required: + - symbol + - base + - quote + - isMarginTrade + - isBuyAllowed + - isSellAllowed + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/bnbBurn: + post: + summary: Toggle BNB Burn On Spot Trade And Margin Interest (USER_DATA) + description: |- + - "spotBNBBurn" and "interestBNBBurn" should be sent at least one. + + Weight(IP): 1 + tags: + - Margin + parameters: + - name: spotBNBBurn + in: query + description: Determines whether to use BNB to pay for trading fees on SPOT + schema: + type: string + enum: ['true','false'] + example: 'true' + - name: interestBNBBurn + in: query + description: Determines whether to use BNB to pay for margin loan's interest + schema: + type: string + enum: ['true','false'] + example: 'false' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Status on BNB to pay for trading fees + content: + application/json: + schema: + $ref: '#/components/schemas/bnbBurnStatus' + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + get: + summary: Get All Isolated Margin Symbol(USER_DATA) + description: 'Weight(IP): 1' + tags: + - Margin + parameters: + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Status on BNB to pay for trading fees + content: + application/json: + schema: + $ref: '#/components/schemas/bnbBurnStatus' + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/margin/interestRateHistory: + get: + summary: Margin Interest Rate History (USER_DATA) + description: 'Weight(IP): 1' + tags: + - Margin + parameters: + - $ref: '#/components/parameters/asset' + - name: vipLevel + in: query + description: Defaults to user's vip level + schema: + type: integer + format: int32 + example: 1 + - $ref: '#/components/parameters/startTime' + - $ref: '#/components/parameters/endTime' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Margin Interest Rate History + content: + application/json: + schema: + type: array + items: + type: object + properties: + asset: + type: string + example: 'BTC' + dailyInterestRate: + type: string + example: '0.00025000' + timestamp: + type: integer + format: int64 + example: 1611544731000 + vipLevel: + type: integer + format: int32 + example: 1 + required: + - asset + - dailyInterestRate + - timestamp + - vipLevel + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/system/status: + get: + summary: System Status (System) + description: |- + Fetch system status. + + Weight(IP): 1 + tags: + - Wallet + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + status: + type: integer + format: int32 + example: 0 + description: "0: normal, 1:system maintenance" + msg: + type: string + example: "normal" + description: '"normal", "system_maintenance"' + required: + - status + - msg + /sapi/v1/capital/config/getall: + get: + summary: All Coins' Information (USER_DATA) + description: |- + Get information of coins (available for deposit and withdraw) for user. + + Weight(IP): 10 + tags: + - Wallet + parameters: + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: All coins details information + content: + application/json: + schema: + type: array + items: + type: object + properties: + coin: + type: string + example: "BTC" + depositAllEnable: + type: boolean + free: + type: string + example: "0.00000000" + freeze: + type: string + example: "0.00000000" + ipoable: + type: string + example: "0.00000000" + ipoing: + type: string + example: "0.00000000" + isLegalMoney: + type: boolean + example: false + locked: + type: string + example: "0.00000000" + name: + type: string + example: "Bitcoin" + networkList: + type: array + items: + type: object + properties: + addressRegex: + type: string + example: "^(bnb1)[0-9a-z]{38}$" + coin: + type: string + example: "BTC" + depositDesc: + type: string + example: "Wallet Maintenance, Deposit Suspended" + description: 'shown only when "depositEnable" is false.' + depositEnable: + type: boolean + example: false + isDefault: + type: boolean + example: false + memoRegex: + type: string + example: "^[0-9A-Za-z\\-_]{1,120}$" + minConfirm: + type: integer + format: int64 + example: 1 + description: 'min number for balance confirmation.' + name: + type: string + example: "BEP2" + resetAddressStatus: + type: boolean + example: false + specialTips: + type: string + example: "Both a MEMO and an Address are required to successfully deposit your BEP2-BTCB tokens to Binance." + unLockConfirm: + type: integer + format: int64 + example: 0 + description: 'confirmation number for balance unlock.' + withdrawDesc: + type: string + example: "Wallet Maintenance, Withdrawal Suspended" + description: 'shown only when "withdrawEnable" is false' + withdrawEnable: + type: boolean + example: false + withdrawFee: + type: string + example: "0.00000220" + withdrawIntegerMultiple: + type: string + example: "0.00000001" + withdrawMax: + type: string + example: "9999999999.99999999" + withdrawMin: + type: string + example: "0.00000440" + sameAddress: + type: boolean + required: + - addressRegex + - coin + - depositDesc + - depositEnable + - isDefault + - memoRegex + - minConfirm + - name + - resetAddressStatus + - specialTips + - unLockConfirm + - withdrawDesc + - withdrawEnable + - withdrawFee + - withdrawIntegerMultiple + - withdrawMax + - withdrawMin + - sameAddress + storage: + type: string + example: "0.00000000" + trading: + type: boolean + withdrawAllEnable: + type: boolean + withdrawing: + type: string + example: "0.00000000" + required: + - coin + - depositAllEnable + - free + - freeze + - ipoable + - ipoing + - isLegalMoney + - locked + - name + - networkList + - storage + - trading + - withdrawAllEnable + - withdrawing + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/accountSnapshot: + get: + summary: Daily Account Snapshot (USER_DATA) + description: 'Weight(IP): 2400' + tags: + - Wallet + parameters: + - name: type + in: query + required: true + schema: + type: string + enum: [SPOT, MARGIN, FUTURES] + - $ref: '#/components/parameters/startTime' + - $ref: '#/components/parameters/endTime' + - name: limit + in: query + schema: + type: integer + format: int32 + default: 5 + minimum: 5 + maximum: 30 + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Account Snapshot + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/snapshotSpot' + - $ref: '#/components/schemas/snapshotMargin' + - $ref: '#/components/schemas/snapshotFutures' + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/account/disableFastWithdrawSwitch: + post: + summary: Disable Fast Withdraw Switch (USER_DATA) + description: |- + - This request will disable fastwithdraw switch under your account. + - You need to enable "trade" option for the api key which requests this endpoint. + + Weight(IP): 1 + tags: + - Wallet + parameters: + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/account/enableFastWithdrawSwitch: + post: + summary: Enable Fast Withdraw Switch (USER_DATA) + description: |- + - This request will enable fastwithdraw switch under your account. You need to enable "trade" option for the api key which requests this endpoint. + - When Fast Withdraw Switch is on, transferring funds to a Binance account will be done instantly. There is no on-chain transaction, no transaction ID and no withdrawal fee. + + Weight(IP): 1 + tags: + - Wallet + parameters: + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/capital/withdraw/apply: + post: + summary: Withdraw (USER_DATA) + description: |- + Submit a withdraw request. + + - If `network` not send, return with default network of the coin. + - You can get `network` and `isDefault` in `networkList` of a coin in the response of `Get /sapi/v1/capital/config/getall (HMAC SHA256)`. + + Weight(IP): 1 + tags: + - Wallet + parameters: + - $ref: '#/components/parameters/coin' + - name: withdrawOrderId + in: query + description: Client id for withdraw + schema: + type: string + - name: network + in: query + description: Get the value from `GET /sapi/v1/capital/config/getall` + schema: + type: string + - name: address + in: query + required: true + schema: + type: string + - name: addressTag + in: query + description: Secondary address identifier for coins like XRP,XMR etc. + schema: + type: string + - $ref: '#/components/parameters/amount' + - name: transactionFeeFlag + in: query + description: |- + When making internal transfer + - `true` -> returning the fee to the destination account; + - `false` -> returning the fee back to the departure account. + schema: + type: boolean + default: false + - name: name + in: query + schema: + type: string + - name: walletType + in: query + description: The wallet type for withdraw,0-Spot wallet, 1- Funding wallet. Default is Spot wallet + schema: + type: integer + format: int32 + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Transafer Id + content: + application/json: + schema: + type: object + properties: + id: + type: string + example: "7213fea8e94b4a5593d507237e5a555b" + required: + - id + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/capital/deposit/hisrec: + get: + summary: Deposit History(supporting network) (USER_DATA) + description: |- + Fetch deposit history. + + - Please notice the default `startTime` and `endTime` to make sure that time interval is within 0-90 days. + - If both `startTime` and `endTime` are sent, time between `startTime` and `endTime` must be less than 90 days. + + Weight(IP): 1 + tags: + - Wallet + parameters: + - $ref: '#/components/parameters/coin' + - name: status + in: query + description: |- + 0 -> pending\ + 6 -> credited but cannot withdraw\ + 1 -> success + schema: + type: integer + format: int32 + enum: [0, 6, 1] + - $ref: '#/components/parameters/startTime' + - $ref: '#/components/parameters/endTime' + - $ref: '#/components/parameters/offset' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: List of deposits + content: + application/json: + schema: + type: array + items: + type: object + properties: + amount: + type: string + example: "0.00999800" + coin: + type: string + example: "PAXG" + network: + type: string + example: "ETH" + status: + type: integer + format: int32 + example: 1 + address: + type: string + example: "0x788cabe9236ce061e5a892e1a59395a81fc8d62c" + addressTag: + type: string + example: "" + txId: + type: string + example: "0xaad4654a3234aa6118af9b4b335f5ae81c360b2394721c019b5d1e75328b09f3" + insertTime: + type: integer + format: int64 + example: 1599621997000 + transferType: + type: integer + format: int32 + example: 0 + unlockConfirm: + type: string + example: "12/12" + description: confirm times for unlocking + confirmTimes: + type: string + example: "12/12" + required: + - amount + - coin + - network + - status + - address + - addressTag + - txId + - insertTime + - transferType + - unlockConfirm + - confirmTimes + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/capital/withdraw/history: + get: + summary: Withdraw History (supporting network) (USER_DATA) + description: |- + Fetch withdraw history. + + - `network` may not be in the response for old withdraw. + - Please notice the default `startTime` and `endTime` to make sure that time interval is within 0-90 days. + - If both `startTime` and `endTime` are sent, time between `startTime` and `endTime` must be less than 90 days + + Weight(IP): 1 + tags: + - Wallet + parameters: + - $ref: '#/components/parameters/coin' + - name: withdrawOrderId + in: query + schema: + type: string + - name: status + in: query + description: |- + 0:Email Sent + 1:Cancelled + 2:Awaiting Approval + 3:Rejected + 4:Processing + 5:Failure + 6:Completed + schema: + type: integer + format: int32 + enum: [0,1,2,3,4,5,6] + - $ref: '#/components/parameters/startTime' + - $ref: '#/components/parameters/endTime' + - $ref: '#/components/parameters/offset' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: List of withdraw history + content: + application/json: + schema: + type: array + items: + type: object + properties: + address: + type: string + example: "0x94df8b352de7f46f64b01d3666bf6e936e44ce60" + amount: + type: string + example: "8.91000000" + applyTime: + type: string + example: "2019-10-12 11:12:02" + coin: + type: string + example: "USDT" + id: + type: string + example: "b6ae22b3aa844210a7041aee7589627c" + withdrawOrderId: + type: string + example: "WITHDRAWtest123" + description: will not be returned if there's no withdrawOrderId for this withdraw. + network: + type: string + example: "ETH" + transferType: + type: integer + format: int32 + example: 0 + description: 1 for internal transfer, 0 for external transfer + status: + type: integer + format: int32 + example: 6 + transactionFee: + type: string + example: "0.004" + confirmNo: + type: integer + format: int32 + example: 3 + txId: + type: string + example: "0xb5ef8c13b968a406cc62a93a8bd80f9e9a906ef1b3fcf20a2e48573c17659268" + required: + - address + - amount + - applyTime + - coin + - id + - withdrawOrderId + - network + - transferType + - status + - transactionFee + - confirmNo + - txId + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/capital/deposit/address: + get: + summary: Deposit Address (supporting network) (USER_DATA) + description: |- + Fetch deposit address with network. + + - If network is not send, return with default network of the coin. + - You can get network and isDefault in networkList in the response of Get /sapi/v1/capital/config/getall (HMAC SHA256). + + Weight(IP): 10 + tags: + - Wallet + parameters: + - $ref: '#/components/parameters/coin' + - name: network + in: query + schema: + type: string + example: "ETH" + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Deposit address info + content: + application/json: + schema: + type: object + properties: + address: + type: string + example: "1HPn8Rx2y6nNSfagQBKy27GB99Vbzg89wv" + coin: + type: string + example: "BTC" + tag: + type: string + example: "" + url: + type: string + example: "https://btc.com/1HPn8Rx2y6nNSfagQBKy27GB99Vbzg89wv" + required: + - address + - coin + - tag + - url + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/account/status: + get: + summary: Account Status (USER_DATA) + description: |- + Fetch account status detail. + + Weight(IP): 1 + tags: + - Wallet + parameters: + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + data: + type: string + example: "Normal" + required: + - data + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/account/apiTradingStatus: + get: + summary: Account API Trading Status (USER_DATA) + description: |- + Fetch account API trading status with details. + + Weight(IP): 1 + tags: + - Wallet + parameters: + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Account API trading status + content: + application/json: + schema: + type: object + properties: + data: + type: object + properties: + isLocked: + type: boolean + example: false + description: API trading function is locked or not + plannedRecoverTime: + type: integer + format: int64 + example: 0 + description: If API trading function is locked, this is the planned recover time + triggerCondition: + type: object + properties: + GCR: + type: integer + format: int64 + example: 150 + description: Number of GTC orders + IFER: + type: integer + format: int64 + example: 150 + description: Number of FOK/IOC orders + UFR: + type: integer + format: int64 + example: 300 + description: Number of orders + required: + - GCR + - IFER + - UFR + indicators: + description: The indicators updated every 30 seconds + type: object + properties: + BTCUSDT: + type: array + items: + type: object + properties: + i: + type: string + example: "UFR" + description: Unfilled Ratio (UFR) + c: + type: integer + format: int64 + example: 20 + description: Count of all orders + v: + type: number + format: float + example: 0.05 + description: Current UFR value + t: + type: number + format: float + example: 0.99 + description: Trigger UFR value + required: + - i + - c + - v + - t + required: + - BTCUSDT + updateTime: + type: integer + format: int64 + example: 1547630471725 + required: + - isLocked + - plannedRecoverTime + - triggerCondition + - indicators + - updateTime + required: + - data + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/asset/dribblet: + get: + summary: DustLog(USER_DATA) + description: 'Weight(IP): 1' + tags: + - Wallet + parameters: + - $ref: '#/components/parameters/startTime' + - $ref: '#/components/parameters/endTime' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Dust log records + content: + application/json: + schema: + type: object + properties: + total: + description: Total counts of exchange + type: integer + format: int64 + example: 8 + userAssetDribblets: + type: array + items: + type: object + properties: + operateTime: + type: integer + format: int64 + example: 1615985535000 + totalTransferedAmount: + type: string + example: "0.00132256" + description: Total transfered BNB amount for this exchange. + totalServiceChargeAmount: + type: string + example: "0.00002699" + description: Total service charge amount for this exchange. + transId: + type: integer + format: int64 + example: 45178372831 + userAssetDribbletDetails: + type: array + items: + type: object + properties: + transId: + type: integer + format: int64 + example: 4359321 + serviceChargeAmount: + type: string + example: "0.000009" + amount: + type: string + example: "0.0009" + operateTime: + type: integer + format: int64 + example: 1615985535000 + transferedAmount: + type: string + example: "0.000441" + fromAsset: + type: string + example: "USDT" + required: + - transId + - serviceChargeAmount + - amount + - operateTime + - transferedAmount + - fromAsset + required: + - operateTime + - totalTransferedAmount + - totalServiceChargeAmount + - transId + - userAssetDribbletDetails + required: + - total + - userAssetDribblets + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/asset/dust: + post: + summary: Dust Transfer (USER_DATA) + description: |- + Convert dust assets to BNB. + + Weight(UID): 10 + tags: + - Wallet + parameters: + - name: asset + in: query + required: true + description: The asset being converted. For example, asset=BTC&asset=USDT + schema: + type: string + example: asset=BTC&asset=USDT + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Dust log records + content: + application/json: + schema: + type: object + properties: + totalServiceCharge: + type: string + example: "0.02102542" + totalTransfered: + type: string + example: "1.05127099" + transferResult: + type: array + items: + type: object + properties: + amount: + type: string + example: "0.03000000" + fromAsset: + type: string + example: "ETH" + operateTime: + type: integer + format: int64 + example: 1563368549307 + serviceChargeAmount: + type: string + example: "0.00500000" + tranId: + type: integer + format: int64 + example: 2970932918 + transferedAmount: + type: string + example: "0.25000000" + required: + - amount + - fromAsset + - operateTime + - serviceChargeAmount + - tranId + - transferedAmount + required: + - totalServiceCharge + - totalTransfered + - transferResult + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/asset/assetDividend: + get: + summary: Asset Dividend Record (USER_DATA) + description: |- + Query asset Dividend Record + + Weight(IP): 10 + tags: + - Wallet + parameters: + - $ref: '#/components/parameters/optionalAsset' + - $ref: '#/components/parameters/startTime' + - $ref: '#/components/parameters/endTime' + - name: limit + in: query + required: true + schema: + type: string + default: 20 + maximum: 50 + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Records of asset devidend + content: + application/json: + schema: + type: object + properties: + rows: + type: array + items: + type: object + properties: + id: + type: integer + format: int64 + example: 242006910 + amount: + type: string + example: "10.00000000" + asset: + type: string + example: "BHFT" + divTime: + type: integer + format: int64 + example: 1563189166000 + enInfo: + type: string + example: "BHFT distribution" + tranId: + type: integer + format: int64 + example: 2968885920 + required: + - id + - amount + - asset + - divTime + - enInfo + - tranId + total: + type: integer + format: int32 + example: 1 + required: + - rows + - total + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/asset/assetDetail: + get: + summary: Asset Detail (USER_DATA) + description: |- + Fetch details of assets supported on Binance. + + - Please get network and other deposit or withdraw details from `GET /sapi/v1/capital/config/getall`. + + Weight(IP): 1 + tags: + - Wallet + parameters: + - $ref: '#/components/parameters/optionalAsset' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Asset detail + content: + application/json: + schema: + type: object + properties: + CTR: + type: object + properties: + minWithdrawAmount: + type: string + example: "70.00000000" + depositStatus: + type: boolean + example: false + description: deposit status (false if ALL of networks' are false) + withdrawFee: + type: integer + format: int64 + example: 35 + withdrawStatus: + type: boolean + description: withdrawStatus status (false if ALL of networks' are false) + depositTip: + type: string + example: "Delisted, Deposit Suspended" + required: + - minWithdrawAmount + - depositStatus + - withdrawFee + - withdrawStatus + - depositTip + required: + - CTR + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/asset/tradeFee: + get: + summary: Trade Fee (USER_DATA) + description: |- + Fetch trade fee + + Weight(IP): 1 + tags: + - Wallet + parameters: + - $ref: '#/components/parameters/optionalSymbol' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Trade fee info per symbol + content: + application/json: + schema: + type: array + items: + type: object + properties: + symbol: + type: string + example: "ADABNB" + makerCommission: + type: string + example: "0.001" + takerCommission: + type: string + example: "0.001" + required: + - symbol + - makerCommission + - takerCommission + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/asset/transfer: + get: + summary: Query User Universal Transfer History (USER_DATA) + description: |- + - `fromSymbol` must be sent when type are ISOLATEDMARGIN_MARGIN and ISOLATEDMARGIN_ISOLATEDMARGIN + - `toSymbol` must be sent when type are MARGIN_ISOLATEDMARGIN and ISOLATEDMARGIN_ISOLATEDMARGIN + - Support query within the last 6 months only + - If `startTime` and `endTime` not sent, return records of the last 7 days by default + + Weight(IP): 1 + tags: + - Wallet + parameters: + - $ref: '#/components/parameters/univTransferType' + - $ref: '#/components/parameters/startTime' + - $ref: '#/components/parameters/endTime' + - $ref: '#/components/parameters/current' + - $ref: '#/components/parameters/size' + - $ref: '#/components/parameters/fromSymbol' + - $ref: '#/components/parameters/toSymbol' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Universal transfer history + content: + application/json: + schema: + type: object + properties: + total: + type: integer + format: int32 + example: 1 + rows: + type: array + items: + type: object + properties: + asset: + type: string + example: "USDT" + amount: + type: string + example: "1" + type: + type: string + example: "MAIN_UMFUTUR" + status: + type: string + example: "CONFIRMED" + tranId: + type: integer + format: int64 + example: 11415955596 + timestamp: + type: integer + format: int64 + example: 1544433328000 + required: + - asset + - amount + - type + - status + - tranId + - timestamp + required: + - total + - rows + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + post: + summary: User Universal Transfer (USER_DATA) + description: |- + You need to enable `Permits Universal Transfer` option for the api key which requests this endpoint. + + - `fromSymbol` must be sent when type are ISOLATEDMARGIN_MARGIN and ISOLATEDMARGIN_ISOLATEDMARGIN + - `toSymbol` must be sent when type are MARGIN_ISOLATEDMARGIN and ISOLATEDMARGIN_ISOLATEDMARGIN + + ENUM of transfer types: + - MAIN_UMFUTURE Spot account transfer to USDⓈ-M Futures account + - MAIN_CMFUTURE Spot account transfer to COIN-M Futures account + - MAIN_MARGIN Spot account transfer to Margin(cross)account + - MAIN_MINING Spot account transfer to Mining account + - UMFUTURE_MAIN USDⓈ-M Futures account transfer to Spot account + - UMFUTURE_MARGIN USDⓈ-M Futures account transfer to Margin(cross)account + - CMFUTURE_MAIN COIN-M Futures account transfer to Spot account + - CMFUTURE_MARGIN COIN-M Futures account transfer to Margin(cross) account + - MARGIN_MAIN Margin(cross)account transfer to Spot account + - MARGIN_UMFUTURE Margin(cross)account transfer to USDⓈ-M Futures + - MARGIN_CMFUTURE Margin(cross)account transfer to COIN-M Futures + - MARGIN_MINING Margin(cross)account transfer to Mining account + - MINING_MAIN Mining account transfer to Spot account + - MINING_UMFUTURE Mining account transfer to USDⓈ-M Futures account + - MINING_MARGIN Mining account transfer to Margin(cross) account + - ISOLATEDMARGIN_MARGIN Isolated margin account transfer to Margin(cross) account + - MARGIN_ISOLATEDMARGIN Margin(cross) account transfer to Isolated margin account + - ISOLATEDMARGIN_ISOLATEDMARGIN Isolated margin account transfer to Isolated margin account + - MAIN_FUNDING Spot account transfer to Funding account + - FUNDING_MAIN Funding account transfer to Spot account + - FUNDING_UMFUTURE Funding account transfer to UMFUTURE account + - UMFUTURE_FUNDING UMFUTURE account transfer to Funding account + - MARGIN_FUNDING MARGIN account transfer to Funding account + - FUNDING_MARGIN Funding account transfer to Margin account + - FUNDING_CMFUTURE Funding account transfer to CMFUTURE account + - CMFUTURE_FUNDING CMFUTURE account transfer to Funding account + + Weight(IP): 1 + tags: + - Wallet + parameters: + - $ref: '#/components/parameters/univTransferType' + - $ref: '#/components/parameters/asset' + - $ref: '#/components/parameters/amount' + - $ref: '#/components/parameters/fromSymbol' + - $ref: '#/components/parameters/toSymbol' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Transfer id + content: + application/json: + schema: + type: object + properties: + tranId: + type: integer + format: int64 + example: 13526853623 + required: + - tranId + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/asset/get-funding-asset: + post: + summary: Funding Wallet (USER_DATA) + description: |- + - Currently supports querying the following business assets:Binance Pay, Binance Card, Binance Gift Card, Stock Token + + Weight(IP): 1 + tags: + - Wallet + parameters: + - $ref: '#/components/parameters/optionalAsset' + - name: needBtcValuation + in: query + schema: + type: string + enum: ['true','false'] + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Funding asset detail + content: + application/json: + schema: + type: array + items: + type: object + properties: + asset: + type: string + example: "USDT" + free: + type: string + example: "1" + locked: + type: string + example: "0" + freeze: + type: string + example: "0" + withdrawing: + type: string + example: "0" + btcValuation: + type: string + example: "0.00000091" + required: + - asset + - free + - locked + - freeze + - withdrawing + - btcValuation + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/account/apiRestrictions: + get: + summary: Get API Key Permission (USER_DATA) + description: 'Weight(IP): 1' + tags: + - Wallet + parameters: + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: API Key permissions + content: + application/json: + schema: + type: object + properties: + ipRestrict: + type: boolean + example: false + createTime: + type: integer + format: int64 + example: 1623840271000 + enableWithdrawals: + type: boolean + example: false + description: This option allows you to withdraw via API. You must apply the IP Access Restriction filter in order to enable withdrawals + enableInternalTransfer: + type: boolean + description: This option authorizes this key to transfer funds between your master account and your sub account instantly + permitsUniversalTransfer: + type: boolean + description: Authorizes this key to be used for a dedicated universal transfer API to transfer multiple supported currencies. Each business's own transfer API rights are not affected by this authorization + enableVanillaOptions: + type: boolean + example: false + description: Authorizes this key to Vanilla options trading + enableReading: + type: boolean + enableFutures: + type: boolean + example: false + description: API Key created before your futures account opened does not support futures API service + enableMargin: + type: boolean + example: false + description: This option can be adjusted after the Cross Margin account transfer is completed + enableSpotAndMarginTrading: + type: boolean + example: false + tradingAuthorityExpirationTime: + type: integer + format: int64 + example: 1628985600000 + description: Expiration time for spot and margin trading permission + required: + - ipRestrict + - createTime + - enableWithdrawals + - enableInternalTransfer + - permitsUniversalTransfer + - enableVanillaOptions + - enableReading + - enableFutures + - enableMargin + - enableSpotAndMarginTrading + - tradingAuthorityExpirationTime + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/sub-account/virtualSubAccount: + post: + summary: Create a Virtual Sub-account(For Master Account) + description: |- + - This request will generate a virtual sub account under your master account. + - You need to enable "trade" option for the api key which requests this endpoint. + + Weight(IP): 1 + tags: + - Sub-Account + parameters: + - name: subAccountString + in: query + description: Please input a string. We will create a virtual email using that string for you to register + required: true + schema: + type: string + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Return the created virtual email + content: + application/json: + schema: + type: object + properties: + email: + type: string + example: "addsdd_virtual@aasaixwqnoemail.com" + required: + - email + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/sub-account/list: + get: + summary: Query Sub-account List (For Master Account) + description: 'Weight(IP): 1' + tags: + - Sub-Account + parameters: + - $ref: '#/components/parameters/optionalSubAccountEmail' + - name: isFreeze + in: query + schema: + type: string + enum: ['true', 'false'] + - $ref: '#/components/parameters/page' + - name: limit + in: query + description: Default 1; max 200 + schema: + type: integer + format: int32 + example: 1 + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: List of sub-accounts + content: + application/json: + schema: + type: object + properties: + subAccounts: + type: array + items: + type: object + properties: + email: + type: string + example: "testsub@gmail.com" + isFreeze: + type: boolean + example: false + createTime: + type: integer + format: int64 + example: 1544433328000 + required: + - email + - isFreeze + - createTime + required: + - subAccounts + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/sub-account/sub/transfer/history: + get: + summary: Sub-account Spot Asset Transfer History (For Master Account) + description: |- + - fromEmail and toEmail cannot be sent at the same time. + - Return fromEmail equal master account email by default. + + Weight(IP): 1 + tags: + - Sub-Account + parameters: + - $ref: '#/components/parameters/optionalSubAccountFromEmail' + - $ref: '#/components/parameters/optionalSubAccountToEmail' + - $ref: '#/components/parameters/startTime' + - $ref: '#/components/parameters/endTime' + - $ref: '#/components/parameters/page' + - name: limit + in: query + description: Default 1 + schema: + type: integer + format: int32 + example: 1 + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Sub-account Spot Asset Transfer History + content: + application/json: + schema: + type: array + items: + type: object + properties: + from: + type: string + example: aaa@test.com + to: + type: string + example: bbb@test.com + asset: + type: string + example: BTC + qty: + type: string + example: 10 + status: + type: string + example: SUCCESS + tranId: + type: integer + format: int64 + example: 6489943656 + time: + type: integer + format: int64 + example: 1544433328000 + required: + - from + - to + - asset + - qty + - status + - tranId + - time + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/sub-account/futures/internalTransfer: + get: + summary: Sub-account Futures Asset Transfer History (For Master Account) + description: 'Weight(IP): 1' + tags: + - Sub-Account + parameters: + - $ref: '#/components/parameters/subAccountEmail' + - name: futuresType + in: query + description: '1:USDT-margined Futures, 2: Coin-margined Futures' + required: true + schema: + type: integer + format: int32 + example: 2 + - $ref: '#/components/parameters/startTime' + - $ref: '#/components/parameters/endTime' + - $ref: '#/components/parameters/page' + - name: limit + in: query + description: 'Default value: 50, Max value: 500' + schema: + type: integer + format: int32 + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Sub-account Futures Asset Transfer History + content: + application/json: + schema: + type: object + properties: + success: + type: boolean + futuresType: + type: integer + format: int32 + example: 2 + transfers: + type: array + items: + type: object + properties: + from: + type: string + example: "aaa@test.com" + to: + type: string + example: "bbb@test.com" + asset: + type: string + example: "BTC" + qty: + type: string + example: "1" + tranId: + type: integer + format: int64 + example: 11897001102 + time: + type: integer + format: int64 + example: 1544433328000 + required: + - from + - to + - asset + - qty + - tranId + - time + required: + - success + - futuresType + - transfers + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + post: + summary: Sub-account Futures Asset Transfer (For Master Account) + description: |- + - Master account can transfer max 2000 times a minute + + Weight(IP): 1 + tags: + - Sub-Account + parameters: + - $ref: '#/components/parameters/subAccountFromEmail' + - $ref: '#/components/parameters/subAccountToEmail' + - name: futuresType + in: query + required: true + description: '1:USDT-margined Futures,2: Coin-margined Futures' + schema: + type: integer + format: int32 + example: 2 + - $ref: '#/components/parameters/asset' + - $ref: '#/components/parameters/amount' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Futures Asset Transfer Info + content: + application/json: + schema: + type: object + properties: + success: + type: boolean + txnId: + type: string + example: "2934662589" + required: + - success + - txnId + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v3/sub-account/assets: + get: + summary: Sub-account Assets (For Master Account) + description: |- + Fetch sub-account assets + + Weight(IP): 1 + tags: + - Sub-Account + parameters: + - $ref: '#/components/parameters/subAccountEmail' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: List of assets balances + content: + application/json: + schema: + type: object + properties: + balances: + type: array + items: + type: object + properties: + asset: + type: string + example: "ADA" + free: + type: integer + format: int64 + example: 10000 + locked: + type: integer + format: int64 + example: 0 + required: + - asset + - free + - locked + required: + - balances + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/sub-account/spotSummary: + get: + summary: Sub-account Spot Assets Summary (For Master Account) + description: |- + Get BTC valued asset summary of subaccounts. + + Weight(IP): 1 + tags: + - Sub-Account + parameters: + - $ref: '#/components/parameters/subAccountEmail' + - $ref: '#/components/parameters/page' + - name: size + in: query + description: Default:10 Max:20 + schema: + type: integer + format: int32 + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Summary of Sub-account Spot Assets + content: + application/json: + schema: + type: object + properties: + totalCount: + type: integer + format: int64 + example: 1 + masterAccountTotalAsset: + type: string + example: "0.23231201" + spotSubUserAssetBtcVoList: + type: array + items: + type: object + properties: + email: + type: string + example: "sub123@test.com" + totalAsset: + type: string + example: "9999.00000000" + required: + - email + - totalAsset + required: + - totalCount + - masterAccountTotalAsset + - spotSubUserAssetBtcVoList + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/capital/deposit/subAddress: + get: + summary: Sub-account Spot Assets Summary (For Master Account) + description: |- + Fetch sub-account deposit address + + Weight(IP): 1 + tags: + - Sub-Account + parameters: + - $ref: '#/components/parameters/subAccountEmail' + - $ref: '#/components/parameters/coin' + - name: network + in: query + schema: + type: string + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Deposit address info + content: + application/json: + schema: + type: object + properties: + address: + type: string + example: "TDunhSa7jkTNuKrusUTU1MUHtqXoBPKETV" + coin: + type: string + example: "USDT" + tag: + type: string + example: "" + url: + type: string + example: "https://tronscan.org/#/address/TDunhSa7jkTNuKrusUTU1MUHtqXoBPKETV" + required: + - address + - coin + - tag + - url + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/capital/deposit/subHisrec: + get: + summary: Sub-account Deposit History (For Master Account) + description: |- + Fetch sub-account deposit history + + Weight(IP): 1 + tags: + - Sub-Account + parameters: + - $ref: '#/components/parameters/subAccountEmail' + - $ref: '#/components/parameters/optionalCoin' + - name: status + in: query + description: '0(0:pending,6: credited but cannot withdraw, 1:success)' + schema: + type: integer + format: int32 + - $ref: '#/components/parameters/startTime' + - $ref: '#/components/parameters/endTime' + - name: limit + in: query + schema: + type: integer + format: int64 + - $ref: '#/components/parameters/offset' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Sub-account deposit history + content: + application/json: + schema: + type: array + items: + type: object + properties: + amount: + type: string + example: "0.00999800" + coin: + type: string + example: "PAXG" + network: + type: string + example: "ETH" + status: + type: integer + format: int32 + example: 1 + address: + type: string + example: "0x788cabe9236ce061e5a892e1a59395a81fc8d62c" + addressTag: + type: string + example: "" + txId: + type: string + example: "0xaad4654a3234aa6118af9b4b335f5ae81c360b2394721c019b5d1e75328b09f3" + insertTime: + type: integer + format: int64 + example: 1599621997000 + transferType: + type: integer + format: int32 + example: 0 + confirmTimes: + type: string + example: "12/12" + required: + - amount + - coin + - network + - status + - address + - addressTag + - txId + - insertTime + - transferType + - confirmTimes + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/sub-account/status: + get: + summary: Sub-account's Status on Margin/Futures (For Master Account) + description: |- + - If no `email` sent, all sub-accounts' information will be returned. + + Weight(IP): 10 + tags: + - Sub-Account + parameters: + - $ref: '#/components/parameters/optionalSubAccountEmail' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Status on Margin/Futures + content: + application/json: + schema: + type: array + items: + type: object + properties: + email: + type: string + example: "123@test.com" + isSubUserEnabled: + type: boolean + isUserActive: + type: boolean + insertTime: + type: integer + format: int64 + example: 1570791523523 + description: sub account create time + isMarginEnabled: + type: boolean + isFutureEnabled: + type: boolean + mobile: + type: integer + format: int64 + example: 1570791523523 + description: user mobile number + required: + - email + - isSubUserEnabled + - isUserActive + - insertTime + - isMarginEnabled + - isFutureEnabled + - mobile + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/sub-account/margin/enable: + post: + summary: Enable Margin for Sub-account (For Master Account) + description: 'Weight(IP): 1' + tags: + - Sub-Account + parameters: + - $ref: '#/components/parameters/subAccountEmail' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Margin status + content: + application/json: + schema: + type: object + properties: + email: + type: string + example: "123@test.com" + isMarginEnabled: + type: boolean + required: + - email + - isMarginEnabled + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/sub-account/margin/account: + get: + summary: Detail on Sub-account's Margin Account (For Master Account) + description: 'Weight(IP): 10' + tags: + - Sub-Account + parameters: + - $ref: '#/components/parameters/subAccountEmail' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Margin sub-account details + content: + application/json: + schema: + type: object + properties: + email: + type: string + example: "123@test.com" + marginLevel: + type: string + example: "11.64405625" + totalAssetOfBtc: + type: string + example: "6.82728457" + totalLiabilityOfBtc: + type: string + example: "0.58633215" + totalNetAssetOfBtc: + type: string + example: "6.24095242" + marginTradeCoeffVo: + type: object + properties: + forceLiquidationBar: + type: string + example: "1.10000000" + description: Liquidation margin ratio + marginCallBar: + type: string + example: "1.50000000" + description: Margin call margin ratio + normalBar: + type: string + example: "2.00000000" + description: Initial margin ratio + required: + - forceLiquidationBar + - marginCallBar + - normalBar + marginUserAssetVoList: + type: array + items: + type: object + properties: + asset: + type: string + example: "BTC" + borrowed: + type: string + example: "0.00000000" + free: + type: string + example: "0.00499500" + interest: + type: string + example: "0.00000000" + locked: + type: string + example: "0.00000000" + netAsset: + type: string + example: "0.00499500" + required: + - asset + - borrowed + - free + - interest + - locked + - netAsset + required: + - email + - marginLevel + - totalAssetOfBtc + - totalLiabilityOfBtc + - totalNetAssetOfBtc + - marginTradeCoeffVo + - marginUserAssetVoList + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/sub-account/margin/accountSummary: + get: + summary: Summary of Sub-account's Margin Account (For Master Account) + description: 'Weight(IP): 10' + tags: + - Sub-Account + parameters: + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Margin sub-account details + content: + application/json: + schema: + type: object + properties: + totalAssetOfBtc: + type: string + example: "4.33333333" + totalLiabilityOfBtc: + type: string + example: "2.11111112" + totalNetAssetOfBtc: + type: string + example: "2.22222221" + subAccountList: + type: array + items: + type: object + properties: + email: + type: string + example: "123@test.com" + totalAssetOfBtc: + type: string + example: "2.11111111" + totalLiabilityOfBtc: + type: string + example: "1.11111111" + totalNetAssetOfBtc: + type: string + example: "1.00000000" + required: + - email + - totalAssetOfBtc + - totalLiabilityOfBtc + - totalNetAssetOfBtc + required: + - totalAssetOfBtc + - totalLiabilityOfBtc + - totalNetAssetOfBtc + - subAccountList + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/sub-account/futures/enable: + post: + summary: Enable Futures for Sub-account (For Master Account) + description: 'Weight(IP): 1' + tags: + - Sub-Account + parameters: + - $ref: '#/components/parameters/subAccountEmail' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Futures status + content: + application/json: + schema: + type: object + properties: + email: + type: string + example: "123@test.com" + isFuturesEnabled: + type: boolean + required: + - email + - isFuturesEnabled + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/sub-account/futures/account: + get: + summary: Detail on Sub-account's Futures Account (For Master Account) + description: 'Weight(IP): 10' + tags: + - Sub-Account + parameters: + - $ref: '#/components/parameters/subAccountEmail' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Futures account details + content: + application/json: + schema: + type: object + properties: + email: + type: string + example: "abc@test.com" + asset: + type: string + example: "USDT" + assets: + type: array + items: + type: object + properties: + asset: + type: string + example: "USDT" + initialMargin: + type: string + example: "0.00000000" + maintenanceMargin: + type: string + example: "0.00000000" + marginBalance: + type: string + example: "0.88308000" + maxWithdrawAmount: + type: string + example: "0.88308000" + openOrderInitialMargin: + type: string + example: "0.00000000" + positionInitialMargin: + type: string + example: "0.00000000" + unrealizedProfit: + type: string + example: "0.00000000" + walletBalance: + type: string + example: "0.88308000" + required: + - asset + - initialMargin + - maintenanceMargin + - marginBalance + - maxWithdrawAmount + - openOrderInitialMargin + - positionInitialMargin + - unrealizedProfit + - walletBalance + canDeposit: + type: boolean + canTrade: + type: boolean + canWithdraw: + type: boolean + feeTier: + type: integer + format: int64 + example: 2 + maxWithdrawAmount: + type: string + example: "0.88308000" + totalInitialMargin: + type: string + example: "0.00000000" + totalMaintenanceMargin: + type: string + example: "0.00000000" + totalMarginBalance: + type: string + example: "0.88308000" + totalOpenOrderInitialMargin: + type: string + example: "0.00000000" + totalPositionInitialMargin: + type: string + example: "0.00000000" + totalUnrealizedProfit: + type: string + example: "0.00000000" + totalWalletBalance: + type: string + example: "0.88308000" + updateTime: + type: integer + format: int64 + example: 1576756674610 + required: + - email + - asset + - assets + - canDeposit + - canTrade + - canWithdraw + - feeTier + - maxWithdrawAmount + - totalInitialMargin + - totalMaintenanceMargin + - totalMarginBalance + - totalOpenOrderInitialMargin + - totalPositionInitialMargin + - totalUnrealizedProfit + - totalWalletBalance + - updateTime + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/sub-account/futures/accountSummary: + get: + summary: Summary of Sub-account's Futures Account (For Master Account) + description: 'Weight(IP): 1' + tags: + - Sub-Account + parameters: + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Futures account summary + content: + application/json: + schema: + type: object + properties: + totalInitialMargin: + type: string + example: "9.83137400" + totalMaintenanceMargin: + type: string + example: "0.41568700" + totalMarginBalance: + type: string + example: "23.03235621" + totalOpenOrderInitialMargin: + type: string + example: "9.00000000" + totalPositionInitialMargin: + type: string + example: "0.83137400" + totalUnrealizedProfit: + type: string + example: "0.03219710" + totalWalletBalance: + type: string + example: "22.15879444" + asset: + type: string + example: "USD" + subAccountList: + type: array + items: + type: object + properties: + email: + type: string + example: "123@test.com" + totalInitialMargin: + type: string + example: "9.00000000" + totalMaintenanceMargin: + type: string + example: "0.00000000" + totalMarginBalance: + type: string + example: "22.12659734" + totalOpenOrderInitialMargin: + type: string + example: "9.00000000" + totalPositionInitialMargin: + type: string + example: "0.00000000" + totalUnrealizedProfit: + type: string + example: "0.00000000" + totalWalletBalance: + type: string + example: "22.12659734" + asset: + type: string + example: "USD" + required: + - email + - totalInitialMargin + - totalMaintenanceMargin + - totalMarginBalance + - totalOpenOrderInitialMargin + - totalPositionInitialMargin + - totalUnrealizedProfit + - totalWalletBalance + - asset + required: + - totalInitialMargin + - totalMaintenanceMargin + - totalMarginBalance + - totalOpenOrderInitialMargin + - totalPositionInitialMargin + - totalUnrealizedProfit + - totalWalletBalance + - asset + - subAccountList + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/sub-account/futures/positionRisk: + get: + summary: Futures Position-Risk of Sub-account (For Master Account) + description: 'Weight(IP): 10' + tags: + - Sub-Account + parameters: + - $ref: '#/components/parameters/subAccountEmail' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Futures account summary + content: + application/json: + schema: + type: array + items: + type: object + properties: + entryPrice: + type: string + example: "9975.12000" + leverage: + type: string + example: "50" + description: current initial leverage + maxNotional: + type: string + example: "1000000" + description: notional value limit of current initial leverage + liquidationPrice: + type: string + example: "7963.54" + markPrice: + type: string + example: "9973.50770517" + positionAmount: + type: string + example: "0.010" + symbol: + type: string + example: "BTCUSDT" + unrealizedProfit: + type: string + example: "-0.01612295" + required: + - entryPrice + - leverage + - maxNotional + - liquidationPrice + - markPrice + - positionAmount + - symbol + - unrealizedProfit + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/sub-account/futures/transfer: + post: + summary: Transfer for Sub-account (For Master Account) + description: 'Weight(IP): 1' + tags: + - Sub-Account + parameters: + - $ref: '#/components/parameters/subAccountEmail' + - $ref: '#/components/parameters/asset' + - $ref: '#/components/parameters/amount' + - name: type + in: query + description: |- + 1: transfer from subaccount's spot account to its USDT-margined futures account + + 2: transfer from subaccount's USDT-margined futures account to its spot account + + 3: transfer from subaccount's spot account to its COIN-margined futures account + + 4:transfer from subaccount's COIN-margined futures account to its spot account + required: true + schema: + type: integer + format: int32 + enum: [1,2,3,4] + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Transfer id + content: + application/json: + schema: + type: object + properties: + txnId: + type: string + example: "2966662589" + required: + - txnId + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/sub-account/margin/transfer: + post: + summary: Margin Transfer for Sub-account (For Master Account) + description: 'Weight(IP): 1' + tags: + - Sub-Account + parameters: + - $ref: '#/components/parameters/subAccountEmail' + - $ref: '#/components/parameters/asset' + - $ref: '#/components/parameters/amount' + - name: type + in: query + description: |- + 1: transfer from subaccount's spot account to margin account + + 2: transfer from subaccount's margin account to its spot account + required: true + schema: + type: integer + format: int32 + enum: [1,2] + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Transfer id + content: + application/json: + schema: + type: object + properties: + txnId: + type: string + example: "2966662589" + required: + - txnId + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/sub-account/transfer/subToSub: + post: + summary: Transfer to Sub-account of Same Master (For Sub-account) + description: 'Weight(IP): 1' + tags: + - Sub-Account + parameters: + - $ref: '#/components/parameters/subAccountToEmail' + - $ref: '#/components/parameters/asset' + - $ref: '#/components/parameters/amount' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Transfer id + content: + application/json: + schema: + type: object + properties: + txnId: + type: string + example: "2966662589" + required: + - txnId + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/sub-account/transfer/subToMaster: + post: + summary: Transfer to Master (For Sub-account) + description: 'Weight(IP): 1' + tags: + - Sub-Account + parameters: + - $ref: '#/components/parameters/asset' + - $ref: '#/components/parameters/amount' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Transfer id + content: + application/json: + schema: + type: object + properties: + txnId: + type: string + example: "2966662589" + required: + - txnId + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/sub-account/transfer/subUserHistory: + get: + summary: Sub-account Transfer History (For Sub-account) + description: |- + - If `type` is not sent, the records of type 2: transfer out will be returned by default. + - If `startTime` and `endTime` are not sent, the recent 30-day data will be returned. + + Weight(IP): 1 + tags: + - Sub-Account + parameters: + - $ref: '#/components/parameters/optionalAsset' + - name: type + in: query + description: |- + 1: transfer in + + 2: transfer out + schema: + type: integer + format: int32 + enum: [1,2] + - $ref: '#/components/parameters/startTime' + - $ref: '#/components/parameters/endTime' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Transfer id + content: + application/json: + schema: + type: array + items: + type: object + properties: + counterParty: + type: string + example: "master" + email: + type: string + example: "master@test.com" + type: + type: integer + format: int32 + example: 1 + description: 1 for transfer in, 2 for transfer out + asset: + type: string + example: "BTC" + qty: + type: string + example: "1" + fromAccountType: + type: string + example: "SPOT" + toAccountType: + type: string + example: "SPOT" + status: + type: string + example: "SUCCESS" + tranId: + type: integer + format: int64 + example: 11798835829 + time: + type: integer + format: int64 + example: 1544433325000 + required: + - counterParty + - email + - type + - asset + - qty + - fromAccountType + - toAccountType + - status + - tranId + - time + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/sub-account/universalTransfer: + get: + summary: Universal Transfer History (For Master Account) + description: |- + - fromEmail and toEmail cannot be sent at the same time. + - Return fromEmail equal master account email by default. + - Only get the latest history of past 30 days. + + Weight(IP): 1 + tags: + - Sub-Account + parameters: + - $ref: '#/components/parameters/optionalSubAccountFromEmail' + - $ref: '#/components/parameters/optionalSubAccountToEmail' + - $ref: '#/components/parameters/startTime' + - $ref: '#/components/parameters/endTime' + - $ref: '#/components/parameters/page' + - name: limit + in: query + description: Default 500, Max 500 + schema: + type: string + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Transfer History + content: + application/json: + schema: + type: array + items: + type: object + properties: + tranId: + type: integer + format: int64 + example: 11945860693 + fromEmail: + type: string + example: "master@test.com" + toEmail: + type: string + example: "subaccount1@test.com" + asset: + type: string + example: "BTC" + amount: + type: string + example: "0.1" + fromAccountType: + type: string + example: "SPOT" + toAccountType: + type: string + example: "COIN_FUTURE" + status: + type: string + example: "SUCCESS" + createTimeStamp: + type: integer + format: int64 + example: 1544433325000 + required: + - tranId + - fromEmail + - toEmail + - asset + - amount + - fromAccountType + - toAccountType + - status + - createTimeStamp + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + post: + summary: Universal Transfer (For Master Account) + description: |- + - You need to enable "internal transfer" option for the api key which requests this endpoint. + - Transfer from master account by default if fromEmail is not sent. + - Transfer to master account by default if toEmail is not sent. + - Transfer between futures accounts is not supported. + + Weight(IP): 1 + tags: + - Sub-Account + parameters: + - $ref: '#/components/parameters/optionalSubAccountFromEmail' + - $ref: '#/components/parameters/optionalSubAccountToEmail' + - name: fromAccountType + in: query + required: true + schema: + type: string + enum: ["SPOT","USDT_FUTURE","COIN_FUTURE"] + - name: toAccountType + in: query + required: true + schema: + type: string + enum: ["SPOT","USDT_FUTURE","COIN_FUTURE"] + - $ref: '#/components/parameters/asset' + - $ref: '#/components/parameters/amount' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Transfer id + content: + application/json: + schema: + type: object + properties: + tranId: + type: integer + format: int64 + example: 11945860693 + required: + - tranId + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v2/sub-account/futures/account: + get: + summary: Detail on Sub-account's Futures Account V2 (For Master Account) + description: 'Weight(IP): 1' + tags: + - Sub-Account + parameters: + - $ref: '#/components/parameters/subAccountEmail' + - name: futuresType + in: query + description: |- + 1:USDT Margined Futures + + 2:COIN Margined Futures + required: true + schema: + type: integer + format: int32 + enum: [1,2] + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: USDT or COIN Margined Futures Details + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/subAccountUSDTFuturesDetails' + - $ref: '#/components/schemas/subAccountCOINFuturesDetails' + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v2/sub-account/futures/accountSummary: + get: + summary: Summary of Sub-account's Futures Account V2 (For Master Account) + description: 'Weight(IP): 10' + tags: + - Sub-Account + parameters: + - name: futuresType + in: query + description: |- + 1:USDT Margined Futures + + 2:COIN Margined Futures + required: true + schema: + type: integer + format: int32 + enum: [1,2] + - $ref: '#/components/parameters/page' + - name: limit + in: query + description: Default 10, Max 20 + schema: + type: string + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: USDT or COIN Margined Futures Summary + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/subAccountUSDTFuturesSummary' + - $ref: '#/components/schemas/subAccountCOINFuturesSummary' + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v2/sub-account/futures/positionRisk: + get: + summary: Futures Position-Risk of Sub-account V2 (For Master Account) + description: 'Weight(IP): 1' + tags: + - Sub-Account + parameters: + - $ref: '#/components/parameters/subAccountEmail' + - name: futuresType + in: query + description: |- + 1:USDT Margined Futures + + 2:COIN Margined Futures + required: true + schema: + type: integer + format: int32 + enum: [1,2] + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: USDT or COIN Margined Futures Position Risk + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/subAccountUSDTFuturesPositionRisk' + - $ref: '#/components/schemas/subAccountCOINFuturesPositionRisk' + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/sub-account/blvt/enable: + post: + summary: Enable Leverage Token for Sub-account (For Master Account) + description: 'Weight(IP): 1' + tags: + - Sub-Account + parameters: + - $ref: '#/components/parameters/subAccountEmail' + - name: enableBlvt + in: query + description: Only true for now + required: true + schema: + type: boolean + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: BLVT status + content: + application/json: + schema: + type: object + properties: + email: + type: string + example: "123@test.com" + enableBlvt: + type: boolean + required: + - email + - enableBlvt + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/managed-subaccount/deposit: + post: + summary: Deposit assets into the managed sub-account(For Investor Master Account) + description: 'Weight(IP): 1' + tags: + - Sub-Account + parameters: + - $ref: '#/components/parameters/subAccountToEmail' + - $ref: '#/components/parameters/asset' + - $ref: '#/components/parameters/amount' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Transfer id + content: + application/json: + schema: + type: object + properties: + tranId: + type: integer + format: int64 + example: 66157362489 + required: + - tranId + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/managed-subaccount/asset: + get: + summary: Managed sub-account asset details(For Investor Master Account) + description: 'Weight(IP): 1' + tags: + - Sub-Account + parameters: + - $ref: '#/components/parameters/subAccountEmail' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: List of asset details + content: + application/json: + schema: + type: array + items: + type: object + properties: + coin: + type: string + example: "INJ" + name: + type: string + example: "Injective Protocol" + totalBalance: + type: string + example: "0" + availableBalance: + type: string + example: "0" + inOrder: + type: string + example: "0" + btcValue: + type: string + example: "0" + required: + - coin + - name + - totalBalance + - availableBalance + - inOrder + - btcValue + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/managed-subaccount/withdraw: + post: + summary: Withdrawl assets from the managed sub-account(For Investor Master Account) + description: 'Weight(IP): 1' + tags: + - Sub-Account + parameters: + - $ref: '#/components/parameters/subAccountFromEmail' + - $ref: '#/components/parameters/asset' + - $ref: '#/components/parameters/amount' + - name: transferDate + in: query + description: Withdrawals is automatically occur on the transfer date(UTC0). If a date is not selected, the withdrawal occurs right now + schema: + type: integer + format: int64 + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Transfer id + content: + application/json: + schema: + type: object + properties: + tranId: + type: integer + format: int64 + example: 66157362489 + required: + - tranId + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /api/v3/userDataStream: + post: + summary: Create a ListenKey (USER_STREAM) + description: |- + Start a new user data stream. + The stream will close after 60 minutes unless a keepalive is sent. If the account has an active `listenKey`, that `listenKey` will be returned and its validity will be extended for 60 minutes. + + Weight: 1 + tags: + - Stream + security: + - ApiKeyAuth: [] + responses: + '200': + description: Listen key + content: + application/json: + schema: + type: object + properties: + listenKey: + type: string + example: "pqia91ma19a5s61cv6a81va65sdf19v8a65a1a5s61cv6a81va65sdf19v8a65a1" + required: + - listenKey + put: + summary: Ping/Keep-alive a ListenKey (USER_STREAM) + description: |- + Keepalive a user data stream to prevent a time out. User data streams will close after 60 minutes. It's recommended to send a ping about every 30 minutes. + + Weight: 1 + tags: + - Stream + parameters: + - $ref: '#/components/parameters/listenKey' + security: + - ApiKeyAuth: [] + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + delete: + summary: Close a ListenKey (USER_STREAM) + description: |- + Close out a user data stream. + + Weight: 1 + tags: + - Stream + parameters: + - $ref: '#/components/parameters/listenKey' + security: + - ApiKeyAuth: [] + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/userDataStream: + post: + summary: Create a ListenKey (USER_STREAM) + description: |- + Start a new user data stream. + The stream will close after 60 minutes unless a keepalive is sent. If the account has an active `listenKey`, that `listenKey` will be returned and its validity will be extended for 60 minutes. + + Weight: 1 + tags: + - Margin Stream + security: + - ApiKeyAuth: [] + responses: + '200': + description: Margin listen key + content: + application/json: + schema: + type: object + properties: + listenKey: + type: string + example: "pqia91ma19a5s61cv6a81va65sdf19v8a65a1a5s61cv6a81va65sdf19v8a65a1" + required: + - listenKey + put: + summary: Ping/Keep-alive a ListenKey (USER_STREAM) + description: |- + Keepalive a user data stream to prevent a time out. User data streams will close after 60 minutes. It's recommended to send a ping about every 30 minutes. + + Weight: 1 + tags: + - Margin Stream + parameters: + - $ref: '#/components/parameters/listenKey' + security: + - ApiKeyAuth: [] + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + delete: + summary: Close a ListenKey (USER_STREAM) + description: |- + Close out a user data stream. + + Weight: 1 + tags: + - Margin Stream + parameters: + - $ref: '#/components/parameters/listenKey' + security: + - ApiKeyAuth: [] + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/userDataStream/isolated: + post: + summary: Generate a Listen Key (USER_STREAM) + description: |- + Start a new user data stream. + The stream will close after 60 minutes unless a keepalive is sent. If the account has an active `listenKey`, that `listenKey` will be returned and its validity will be extended for 60 minutes. + + Weight: 1 + tags: + - Isolated Margin Stream + security: + - ApiKeyAuth: [] + responses: + '200': + description: Isolated margin listen key + content: + application/json: + schema: + type: object + properties: + listenKey: + type: string + example: "T3ee22BIYuWqmvne0HNq2A2WsFlEtLhvWCtItw6ffhhdmjifQ2tRbuKkTHhr" + required: + - listenKey + put: + summary: Ping/Keep-alive a Listen Key (USER_STREAM) + description: |- + Keepalive a user data stream to prevent a time out. User data streams will close after 60 minutes. It's recommended to send a ping about every 30 minutes. + + Weight: 1 + tags: + - Isolated Margin Stream + parameters: + - $ref: '#/components/parameters/listenKey' + security: + - ApiKeyAuth: [] + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + delete: + summary: Close a ListenKey (USER_STREAM) + description: |- + Close out a user data stream. + + Weight: 1 + tags: + - Isolated Margin Stream + parameters: + - $ref: '#/components/parameters/listenKey' + security: + - ApiKeyAuth: [] + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/fiat/orders: + get: + summary: Fiat Deposit/Withdraw History (USER_DATA) + description: |- + - If beginTime and endTime are not sent, the recent 30-day data will be returned. + + Weight(IP): 1 + tags: + - Fiat + parameters: + - $ref: '#/components/parameters/transactionType' + - $ref: '#/components/parameters/beginTime' + - $ref: '#/components/parameters/endTime' + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/rows' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: History of deposit/withdraw orders + content: + application/json: + schema: + type: object + properties: + code: + type: string + example: "000000" + message: + type: string + example: "success" + data: + type: array + items: + type: object + properties: + orderNo: + type: string + example: "7d76d611-0568-4f43-afb6-24cac7767365" + fiatCurrency: + type: string + example: "BRL" + indicatedAmount: + type: string + example: "10.00" + amount: + type: string + example: "10.00" + totalFee: + type: string + example: "0.00" + method: + type: string + example: "BankAccount" + status: + type: string + example: "Expired" + description: "Processing, Failed, Successful, Finished, Refunding, Refunded, Refund Failed, Order Partial credit Stopped" + createTime: + type: integer + format: int64 + example: 1626144956000 + updateTime: + type: integer + format: int64 + example: 1626400907000 + required: + - orderNo + - fiatCurrency + - indicatedAmount + - amount + - totalFee + - method + - status + - createTime + - updateTime + total: + type: integer + format: int32 + example: 1 + success: + type: boolean + required: + - code + - message + - data + - total + - success + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/fiat/payments: + get: + summary: Fiat Payments History (USER_DATA) + description: |- + - If beginTime and endTime are not sent, the recent 30-day data will be returned. + + Weight(IP): 1 + tags: + - Fiat + parameters: + - $ref: '#/components/parameters/transactionType' + - $ref: '#/components/parameters/beginTime' + - $ref: '#/components/parameters/endTime' + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/rows' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: History of fiat payments + content: + application/json: + schema: + type: object + properties: + code: + type: string + example: "000000" + message: + type: string + example: "success" + data: + type: array + items: + type: object + properties: + orderNo: + type: string + example: "353fca443f06466db0c4dc89f94f027a" + sourceAmount: + type: string + example: "20.00" + description: Fiat trade amount + fiatCurrency: + type: string + example: "EUR" + description: Fiat token + obtainAmount: + type: string + example: "4.462" + description: Crypto trade amount + cryptoCurrency: + type: string + example: "LUNA" + description: Crypto token + totalFee: + type: string + example: "0.2" + description: Trade fee + price: + type: string + example: "4.437472" + status: + type: string + example: "Failed" + description: Processing, Completed, Failed, Refunded + createTime: + type: integer + format: int64 + example: 1624529919000 + updateTime: + type: integer + format: int64 + example: 1624529919000 + required: + - orderNo + - sourceAmount + - fiatCurrency + - obtainAmount + - cryptoCurrency + - totalFee + - price + - status + - createTime + - updateTime + total: + type: integer + format: int32 + example: 1 + success: + type: boolean + required: + - code + - message + - data + - total + - success + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/lending/daily/product/list: + get: + summary: Get Flexible Product List (USER_DATA) + description: 'Weight(IP): 1' + tags: + - Savings + parameters: + - $ref: '#/components/parameters/flexibleProductStatus' + - $ref: '#/components/parameters/featured' + - $ref: '#/components/parameters/current' + - $ref: '#/components/parameters/size' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: List of flexible products + content: + application/json: + schema: + type: array + items: + type: object + properties: + asset: + type: string + example: BTC + avgAnnualInterestRate: + type: string + example: "0.00250025" + canPurchase: + type: boolean + canRedeem: + type: boolean + dailyInterestPerThousand: + type: string + example: "0.00685000" + featured: + type: boolean + minPurchaseAmount: + type: string + example: "0.01000000" + productId: + type: string + example: BTC001 + purchasedAmount: + type: string + example: "16.32467016" + status: + type: string + example: PURCHASING + upLimit: + type: string + example: "200.00000000" + upLimitPerUser: + type: string + example: "5.00000000" + required: + - asset + - avgAnnualInterestRate + - canPurchase + - canRedeem + - dailyInterestPerThousand + - featured + - minPurchaseAmount + - productId + - purchasedAmount + - status + - upLimit + - upLimitPerUser + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/lending/daily/userLeftQuota: + get: + summary: Get Left Daily Purchase Quota of Flexible Product (USER_DATA) + description: 'Weight(IP): 1' + tags: + - Savings + parameters: + - $ref: '#/components/parameters/flexibleProductId' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Daily purchase quote of flexible product left + content: + application/json: + schema: + type: object + properties: + asset: + type: string + example: "BUSD" + leftQuota: + type: string + example: "50000.00000000" + required: + - asset + - leftQuota + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/lending/daily/purchase: + post: + summary: Purchase Flexible Product (USER_DATA) + description: 'Weight(IP): 1' + tags: + - Savings + parameters: + - $ref: '#/components/parameters/flexibleProductId' + - $ref: '#/components/parameters/amount' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Generated Purchase Id + content: + application/json: + schema: + type: object + properties: + purchaseId: + type: integer + format: int64 + example: 40607 + required: + - purchaseId + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/lending/daily/userRedemptionQuota: + get: + summary: Get Left Daily Redemption Quota of Flexible Product (USER_DATA) + description: 'Weight(IP): 1' + tags: + - Savings + parameters: + - $ref: '#/components/parameters/flexibleProductId' + - $ref: '#/components/parameters/flexibleProductType' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Daily redemption quota of flexible product left + content: + application/json: + schema: + type: object + properties: + asset: + type: string + example: USDT + dailyQuota: + type: string + example: "10000000.00000000" + leftQuota: + type: string + example: "0.00000000" + minRedemptionAmount: + type: string + example: "0.10000000" + required: + - asset + - dailyQuota + - leftQuota + - minRedemptionAmount + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/lending/daily/redeem: + post: + summary: Redeem Flexible Product (USER_DATA) + description: 'Weight(IP): 1' + tags: + - Savings + parameters: + - $ref: '#/components/parameters/flexibleProductId' + - $ref: '#/components/parameters/amount' + - $ref: '#/components/parameters/flexibleProductType' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/lending/daily/token/position: + get: + summary: Get Flexible Product Position (USER_DATA) + description: 'Weight(IP): 1' + tags: + - Savings + parameters: + - $ref: '#/components/parameters/asset' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: List of flexible product positions + content: + application/json: + schema: + type: array + items: + type: object + properties: + annualInterestRate: + type: string + example: "0.02600000" + asset: + type: string + example: "USDT" + avgAnnualInterestRate: + type: string + example: "0.02599895" + canRedeem: + type: boolean + dailyInterestRate: + type: string + example: "0.00007123" + freeAmount: + type: string + example: "75.46000000" + freezeAmount: + type: string + example: "0.00000000" + lockedAmount: + type: string + example: "0.00000000" + productId: + type: string + example: "USDT001" + productName: + type: string + example: "USDT" + redeemingAmount: + type: string + example: "0.00000000" + todayPurchasedAmount: + type: string + example: "0.00000000" + totalAmount: + type: string + example: "75.46000000" + totalInterest: + type: string + example: "0.22759183" + required: + - annualInterestRate + - asset + - avgAnnualInterestRate + - canRedeem + - dailyInterestRate + - freeAmount + - freezeAmount + - lockedAmount + - productId + - productName + - redeemingAmount + - todayPurchasedAmount + - totalAmount + - totalInterest + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/lending/project/list: + get: + summary: Get Fixed/Activity Project List(USER_DATA) + description: 'Weight(IP): 1' + tags: + - Savings + parameters: + - $ref: '#/components/parameters/optionalAsset' + - $ref: '#/components/parameters/fixedAndActivityProductType' + - $ref: '#/components/parameters/fixedAndActivityProductStatus' + - $ref: '#/components/parameters/isSortAsc' + - $ref: '#/components/parameters/sortBy' + - $ref: '#/components/parameters/current' + - $ref: '#/components/parameters/size' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: List of fixed projects + content: + application/json: + schema: + type: array + items: + type: object + properties: + asset: + type: string + example: "USDT" + displayPriority: + type: integer + format: int64 + example: 1 + duration: + type: integer + format: int64 + example: 90 + interestPerLot: + type: string + example: "1.35810000" + interestRate: + type: string + example: "0.05510000" + lotSize: + type: string + example: "100.00000000" + lotsLowLimit: + type: integer + format: int64 + example: 1 + lotsPurchased: + type: integer + format: int64 + example: 74155 + lotsUpLimit: + type: integer + format: int64 + example: 80000 + maxLotsPerUser: + type: integer + format: int64 + example: 2000 + needKyc: + type: boolean + projectId: + type: string + example: "CUSDT90DAYSS001" + projectName: + type: string + example: "USDT" + status: + type: string + example: "PURCHASING" + type: + type: string + example: "CUSTOMIZED_FIXED" + withAreaLimitation: + type: boolean + required: + - asset + - displayPriority + - duration + - interestPerLot + - interestRate + - lotSize + - lotsLowLimit + - lotsPurchased + - lotsUpLimit + - maxLotsPerUser + - needKyc + - projectId + - projectName + - status + - type + - withAreaLimitation + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/lending/customizedFixed/purchase: + post: + summary: Purchase Fixed/Activity Project (USER_DATA) + description: 'Weight(IP): 1' + tags: + - Savings + parameters: + - $ref: '#/components/parameters/projectId' + - $ref: '#/components/parameters/lot' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Generated Purchase Id + content: + application/json: + schema: + type: object + properties: + purchaseId: + type: string + example: "18356" + required: + - purchaseId + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/lending/project/position/list: + get: + summary: Get Fixed/Activity Project Position (USER_DATA) + description: 'Weight(IP): 1' + tags: + - Savings + parameters: + - $ref: '#/components/parameters/asset' + - $ref: '#/components/parameters/fixedAndActivityProjectId' + - $ref: '#/components/parameters/fixedAndActivityProductStatus' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: List of fixed project positions + content: + application/json: + schema: + type: array + items: + type: object + properties: + asset: + type: string + example: "USDT" + canTransfer: + type: boolean + createTimestamp: + type: integer + format: int64 + example: 1587010770000 + duration: + type: integer + format: int64 + example: 14 + endTime: + type: integer + format: int64 + example: 1588291200000 + interest: + type: string + example: "0.19950000" + interestRate: + type: string + example: "0.05201250" + lot: + type: integer + format: int64 + example: 1 + positionId: + type: integer + format: int64 + example: 51724 + principal: + type: string + example: "100.00000000" + projectId: + type: string + example: "CUSDT14DAYSS001" + projectName: + type: string + example: "USDT" + purchaseTime: + type: integer + format: int64 + example: 1587010771000 + redeemDate: + type: string + format: date + example: "2020-05-01" + startTime: + type: integer + format: int64 + example: 1587081600000 + status: + type: string + example: "HOLDING" + type: + type: string + example: "CUSTOMIZED_FIXED" + required: + - asset + - canTransfer + - createTimestamp + - duration + - endTime + - interest + - interestRate + - lot + - positionId + - principal + - projectId + - projectName + - purchaseTime + - redeemDate + - startTime + - status + - type + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/lending/union/account: + get: + summary: Lending Account (USER_DATA) + description: 'Weight(IP): 1' + tags: + - Savings + parameters: + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Lending account + content: + application/json: + schema: + type: object + properties: + positionAmountVos: + type: array + items: + type: object + properties: + amount: + type: string + example: "75.46000000" + amountInBTC: + type: string + example: "0.01044819" + amountInUSDT: + type: string + example: "75.46000000" + asset: + type: string + example: "USDT" + required: + - amount + - amountInBTC + - amountInUSDT + - asset + totalAmountInBTC: + type: string + example: "0.01067982" + totalAmountInUSDT: + type: string + example: "77.13289230" + totalFixedAmountInBTC: + type: string + example: "0.00000000" + totalFixedAmountInUSDT: + type: string + example: "0.00000000" + totalFlexibleInBTC: + type: string + example: "0.01067982" + totalFlexibleInUSDT: + type: string + example: "77.13289230" + required: + - positionAmountVos + - totalAmountInBTC + - totalAmountInUSDT + - totalFixedAmountInBTC + - totalFixedAmountInUSDT + - totalFlexibleInBTC + - totalFlexibleInUSDT + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/lending/union/purchaseRecord: + get: + summary: Get Purchase Record (USER_DATA) + description: |- + - 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' data will be returned. + + Weigh(IP): 1 + tags: + - Savings + parameters: + - $ref: '#/components/parameters/lendingType' + - $ref: '#/components/parameters/optionalAsset' + - $ref: '#/components/parameters/startTime' + - $ref: '#/components/parameters/endTime' + - $ref: '#/components/parameters/current' + - $ref: '#/components/parameters/size' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: List of flexible or Fixed/Activity products + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/savingsFlexiblePurchaseRecord' + - $ref: '#/components/schemas/savingsFixedActivityPurchaseRecord' + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/lending/union/redemptionRecord: + get: + summary: Get Redemption Record (USER_DATA) + description: |- + - 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' data will be returned. + + Weight(IP): 1 + tags: + - Savings + parameters: + - $ref: '#/components/parameters/lendingType' + - $ref: '#/components/parameters/optionalAsset' + - $ref: '#/components/parameters/startTime' + - $ref: '#/components/parameters/endTime' + - $ref: '#/components/parameters/current' + - $ref: '#/components/parameters/size' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: History of Flexible or Fixed/Activity Redemptions + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/savingsFlexibleRedemptionRecord' + - $ref: '#/components/schemas/savingsFixedActivityRedemptionRecord' + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/lending/union/interestHistory: + get: + summary: Get Interest History (USER_DATA) + description: |- + - 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' data will be returned. + + Weight(IP): 1 + tags: + - Savings + parameters: + - $ref: '#/components/parameters/lendingType' + - $ref: '#/components/parameters/optionalAsset' + - $ref: '#/components/parameters/startTime' + - $ref: '#/components/parameters/endTime' + - $ref: '#/components/parameters/current' + - $ref: '#/components/parameters/size' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: History of interest + content: + application/json: + schema: + type: array + items: + type: object + properties: + asset: + type: string + example: "BUSD" + interest: + type: string + example: "0.00006408" + lendingType: + type: string + example: "DAILY" + productName: + type: string + example: "BUSD" + time: + type: integer + format: int64 + example: 1577233578000 + required: + - asset + - interest + - lendingType + - productName + - time + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/lending/positionChanged: + post: + summary: Change Fixed/Activity Position to Daily Position (USER_DATA) + description: |- + - PositionId is mandatory parameter for fixed position. + + Weight(IP): 1 + tags: + - Savings + parameters: + - $ref: '#/components/parameters/projectId' + - $ref: '#/components/parameters/lot' + - $ref: '#/components/parameters/optionalPositionId' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Purchase information + content: + application/json: + schema: + type: object + properties: + dailyPurchaseId: + type: integer + format: int64 + example: 862290 + success: + type: boolean + time: + type: integer + format: int64 + example: 1577233578000 + required: + - dailyPurchaseId + - success + - time + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/mining/pub/algoList: + get: + summary: Acquiring Algorithm (MARKET_DATA) + description: 'Weight(IP): 1' + tags: + - Mining + parameters: + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Algorithm information + content: + application/json: + schema: + type: object + properties: + code: + type: integer + format: int64 + example: 0 + msg: + type: string + example: "" + data: + type: array + items: + type: object + properties: + algoName: + type: string + example: "sha256" + algoId: + type: integer + format: int64 + example: 1 + poolIndex: + type: integer + format: int64 + example: 0 + unit: + type: string + example: "h/s" + required: + - algoName + - algoId + - poolIndex + - unit + required: + - code + - msg + - data + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/mining/pub/coinList: + get: + summary: Acquiring CoinName (MARKET_DATA) + description: 'Weight(IP): 1' + tags: + - Mining + parameters: + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Coin information + content: + application/json: + schema: + type: object + properties: + code: + type: integer + format: int64 + example: 0 + msg: + type: string + example: "" + data: + type: array + items: + type: object + properties: + coinName: + type: string + example: "BTC" + coinId: + type: integer + format: int64 + example: 1 + poolIndex: + type: integer + format: int64 + example: 0 + algoId: + type: integer + format: int64 + example: 1 + algoName: + type: string + example: "sha256" + required: + - coinName + - coinId + - poolIndex + - algoId + - algoName + required: + - code + - msg + - data + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/mining/worker/detail: + get: + summary: Request for Detail Miner List (USER_DATA) + description: 'Weight(IP): 5' + tags: + - Mining + parameters: + - $ref: '#/components/parameters/algo' + - $ref: '#/components/parameters/userName' + - $ref: '#/components/parameters/workerName' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: List of workers' hashrates' + content: + application/json: + schema: + type: object + properties: + code: + type: integer + format: int64 + example: 0 + msg: + type: string + example: "" + data: + type: array + items: + type: object + properties: + workerName: + type: string + example: "bhdc1.16A10404B" + description: Mining Account name + type: + type: string + example: "H_hashrate" + description: Type of hourly hashrate + hashrateDatas: + type: array + items: + type: object + properties: + time: + type: integer + format: int64 + example: 1587902400000 + hashrate: + type: string + example: "0" + reject: + type: integer + format: int64 + example: 0 + description: Rejection Rate + required: + - time + - hashrate + - reject + required: + - workerName + - type + - hashrateDatas + required: + - code + - msg + - data + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/mining/worker/list: + get: + summary: Request for Miner List (USER_DATA) + description: 'Weight(IP): 5' + tags: + - Mining + parameters: + - $ref: '#/components/parameters/algo' + - $ref: '#/components/parameters/userName' + - $ref: '#/components/parameters/pageIndex' + - $ref: '#/components/parameters/sort' + - $ref: '#/components/parameters/sortColumn' + - $ref: '#/components/parameters/workerStatus' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: List of workers + content: + application/json: + schema: + type: object + properties: + code: + type: integer + format: int64 + example: 0 + msg: + type: string + example: "" + data: + type: object + properties: + workerDatas: + type: array + items: + type: object + properties: + workerId: + type: string + example: "1420554439452400131" + workerName: + type: string + example: "2X73" + status: + type: integer + format: int64 + example: 3 + description: "Status:1 valid, 2 invalid, 3 no longer valid" + hashRate: + type: integer + format: int64 + example: 0 + description: Real-time rate + dayHashRate: + type: integer + format: int64 + example: 0 + description: 24H Hashrate + rejectRate: + type: integer + format: int64 + example: 0 + description: Real-time Rejection Rate + lastShareTime: + type: integer + format: int64 + example: 1587712919000 + description: Last submission time + required: + - workerId + - workerName + - status + - hashRate + - dayHashRate + - rejectRate + - lastShareTime + totalNum: + type: integer + format: int64 + example: 18530 + pageSize: + type: integer + format: int64 + example: 20 + required: + - workerDatas + - totalNum + - pageSize + required: + - code + - msg + - data + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/mining/payment/list: + get: + summary: Earnings List (USER_DATA) + description: 'Weight(IP): 5' + tags: + - Mining + parameters: + - $ref: '#/components/parameters/algo' + - $ref: '#/components/parameters/userName' + - $ref: '#/components/parameters/optionalCoin' + - $ref: '#/components/parameters/startDate' + - $ref: '#/components/parameters/endDate' + - $ref: '#/components/parameters/pageIndex' + - $ref: '#/components/parameters/pageSize' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: List of earnings + content: + application/json: + schema: + type: object + properties: + code: + type: integer + format: int64 + example: 0 + msg: + type: string + example: "" + data: + type: object + properties: + accountProfits: + type: array + items: + type: object + properties: + time: + type: integer + format: int64 + example: 1586188800000 + description: Mining date + type: + type: integer + format: int64 + example: 31 + description: "0:Mining Wallet,5:Mining Address,7:Pool Savings,8:Transferred,31:Income Transfer ,32:Hashrate Resale-Mining Wallet 33:Hashrate Resale-Pool Savings" + hashTransfer: + type: integer + format: "nullable" + example: null + description: Transferred Hashrate + transferAmount: + type: number + format: "nullable" + example: null + description: Transferred Income + dayHashRate: + type: integer + format: int64 + example: 129129903378244 + description: Daily Hashrate + profitAmount: + type: number + format: double + example: 8.6083060304 + description: Earnings Amount + coinName: + type: string + example: "BTC" + description: Coin Type + status: + type: integer + format: int32 + example: 2 + description: "Status:0:Unpaid, 1:Paying 2:Paid" + required: + - time + - type + - hashTransfer + - transferAmount + - dayHashRate + - profitAmount + - coinName + - status + totalNum: + type: integer + format: int64 + example: 3 + description: Total Rows + pageSize: + type: integer + format: int64 + example: 20 + description: Rows per page + required: + - accountProfits + - totalNum + - pageSize + required: + - code + - msg + - data + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/mining/payment/other: + get: + summary: Extra Bonus List (USER_DATA) + description: 'Weight(IP): 5' + tags: + - Mining + parameters: + - $ref: '#/components/parameters/algo' + - $ref: '#/components/parameters/userName' + - $ref: '#/components/parameters/optionalCoin' + - $ref: '#/components/parameters/startDate' + - $ref: '#/components/parameters/endDate' + - $ref: '#/components/parameters/pageIndex' + - $ref: '#/components/parameters/pageSize' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: List of extra bonuses + content: + application/json: + schema: + type: object + properties: + code: + type: integer + format: int64 + example: 0 + msg: + type: string + example: "" + data: + type: object + properties: + otherProfits: + type: array + items: + type: object + properties: + time: + type: integer + format: int64 + example: 1607443200000 + description: Mining date + coinName: + type: string + example: "BTC" + description: Coin Name + type: + type: integer + format: int32 + example: 4 + description: '1: Merged Mining, 2: Activity Bonus, 3:Rebate 4:Smart Pool 6:Income Transfer 7:Pool Savings' + profitAmount: + type: number + format: double + example: 0.0011859 + status: + type: integer + format: int32 + example: 2 + description: '0:Unpaid, 1:Paying 2:Paid' + required: + - time + - coinName + - type + - profitAmount + - status + totalNum: + type: integer + format: int64 + example: 3 + description: Total Rows + pageSize: + type: integer + format: int64 + example: 20 + description: Rows per page + required: + - otherProfits + - totalNum + - pageSize + required: + - code + - msg + - data + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/mining/hash-transfer/config/details/list: + get: + summary: Hashrate Resale List (USER_DATA) + description: 'Weight(IP): 5' + tags: + - Mining + parameters: + - $ref: '#/components/parameters/pageIndex' + - $ref: '#/components/parameters/pageSize' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: List of hashrate resales + content: + application/json: + schema: + type: object + properties: + code: + type: integer + format: int64 + example: 0 + msg: + type: string + example: "" + data: + type: object + properties: + configDetails: + type: array + items: + type: object + properties: + configId: + type: integer + format: int64 + example: 168 + description: Mining ID + poolUsername: + type: string + example: "123" + description: Transfer out of subaccount + toPoolUsername: + type: string + example: "user1" + description: Transfer into subaccount + algoName: + type: string + example: "Ethash" + description: Transfer algorithm + hashRate: + type: integer + format: int64 + example: 5000000 + description: Transferred Hashrate quantity + startDay: + type: integer + format: int64 + example: 20201210 + description: Start date + endDay: + type: integer + format: int64 + example: 20210405 + description: End date + status: + type: integer + format: int32 + example: 1 + description: "0 Processing, 1:Cancelled, 2:Terminated " + required: + - configId + - poolUsername + - toPoolUsername + - algoName + - hashRate + - startDay + - endDay + - status + totalNum: + type: integer + format: int64 + example: 21 + pageSize: + type: integer + format: int64 + example: 200 + required: + - configDetails + - totalNum + - pageSize + required: + - code + - msg + - data + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/mining/hash-transfer/profit/details: + get: + summary: Hashrate Resale Details (USER_DATA) + description: 'Weight(IP): 5' + tags: + - Mining + parameters: + - $ref: '#/components/parameters/configId' + - $ref: '#/components/parameters/userName' + - $ref: '#/components/parameters/pageIndex' + - $ref: '#/components/parameters/pageSize' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: List of hashrate resale details + content: + application/json: + schema: + type: object + properties: + code: + type: integer + format: int64 + example: 0 + msg: + type: string + example: "" + data: + type: object + properties: + profitTransferDetails: + type: array + items: + type: object + properties: + poolUsername: + type: string + example: "test4001" + description: Transfer out of sub-account + toPoolUsername: + type: string + example: "pop" + description: Transfer into subaccount + algoName: + type: string + example: "sha256" + description: Transfer algorithm + hashRate: + type: integer + format: int64 + example: 200000000000 + description: Transferred Hashrate quantity + day: + type: integer + format: int64 + example: 20201213 + description: Transfer date + amount: + type: number + format: double + example: 0.2256872 + description: Transfer income + coinName: + type: string + example: "BTC" + required: + - poolUsername + - toPoolUsername + - algoName + - hashRate + - day + - amount + - coinName + totalNum: + type: integer + format: int64 + example: 8 + pageSize: + type: integer + format: int64 + example: 200 + required: + - profitTransferDetails + - totalNum + - pageSize + required: + - code + - msg + - data + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/mining/hash-transfer/config: + post: + summary: Hashrate Resale Request (USER_DATA) + description: 'Weight(IP): 5' + tags: + - Mining + parameters: + - $ref: '#/components/parameters/userName' + - $ref: '#/components/parameters/algo' + - $ref: '#/components/parameters/startDate' + - $ref: '#/components/parameters/endDate' + - $ref: '#/components/parameters/toPoolUser' + - $ref: '#/components/parameters/hashRate' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Mining Account Id + content: + application/json: + schema: + type: object + properties: + code: + type: integer + format: int64 + example: 0 + msg: + type: string + example: "" + data: + type: integer + format: int64 + example: 171 + description: Mining Account + required: + - code + - msg + - data + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/mining/hash-transfer/config/cancel: + post: + summary: Cancel Hashrate Resale configuration (USER_DATA) + description: 'Weight(IP): 5' + tags: + - Mining + parameters: + - $ref: '#/components/parameters/configId' + - $ref: '#/components/parameters/userName' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Success flag + content: + application/json: + schema: + type: object + properties: + code: + type: integer + format: int64 + example: 0 + msg: + type: string + example: "" + data: + type: boolean + required: + - code + - msg + - data + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/mining/statistics/user/status: + get: + summary: Statistic List (USER_DATA) + description: 'Weight(IP): 5' + tags: + - Mining + parameters: + - $ref: '#/components/parameters/algo' + - $ref: '#/components/parameters/userName' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Mining account statistics + content: + application/json: + schema: + type: object + properties: + code: + type: integer + format: int64 + example: 0 + msg: + type: string + example: "" + data: + type: object + properties: + fifteenMinHashRate: + type: string + example: "457835490067496409.00000000" + dayHashRate: + type: string + example: "214289268068874127.65000000" + validNum: + type: integer + format: int64 + example: 0 + invalidNum: + type: integer + format: int64 + example: 17562 + profitToday: + type: object + properties: + BTC: + type: string + example: "0.00314332" + BSV: + type: string + example: "56.17055953" + BCH: + type: string + example: "106.61586001" + required: + - BTC + - BSV + - BCH + profitYesterday: + type: object + properties: + BTC: + type: string + example: "0.00314332" + BSV: + type: string + example: "56.17055953" + BCH: + type: string + example: "106.61586001" + required: + - BTC + - BSV + - BCH + userName: + type: string + example: "test" + unit: + type: string + example: "h/s" + algo: + type: string + example: "sha256" + required: + - fifteenMinHashRate + - dayHashRate + - validNum + - invalidNum + - profitToday + - profitYesterday + - userName + - unit + - algo + required: + - code + - msg + - data + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/mining/statistics/user/list: + get: + summary: Account List (USER_DATA) + description: 'Weight(IP): 5' + tags: + - Mining + parameters: + - $ref: '#/components/parameters/algo' + - $ref: '#/components/parameters/userName' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: List of mining accounts + content: + application/json: + schema: + type: object + properties: + code: + type: integer + format: int64 + example: 0 + msg: + type: string + example: "" + data: + type: array + items: + type: object + properties: + type: + type: string + example: "H_hashrate" + userName: + type: string + example: "test" + list: + type: array + items: + type: object + properties: + time: + type: integer + format: int64 + example: 1585267200000 + hashrate: + type: string + example: "0.00000000" + reject: + type: string + example: "0.00000000" + required: + - time + - hashrate + - reject + required: + - type + - userName + - list + required: + - code + - msg + - data + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/blvt/tokenInfo: + get: + summary: BLVT Info (MARKET_DATA) + description: 'Weight(IP): 1' + tags: + - BLVT + parameters: + - $ref: '#/components/parameters/optionalBlvtTokenName' + security: + - ApiKeyAuth: [] + responses: + '200': + description: List of token information + content: + application/json: + schema: + type: array + items: + type: object + properties: + tokenName: + type: string + example: "BTCDOWN" + description: + type: string + example: "3X Short Bitcoin Token" + underlying: + type: string + example: "BTC" + tokenIssued: + type: string + example: "717953.95" + basket: + type: string + example: "-821.474 BTCUSDT Futures" + currentBaskets: + type: array + items: + type: object + properties: + symbol: + type: string + example: "BTCUSDT" + amount: + type: string + example: "-1183.984" + notionalValue: + type: string + example: "-22871089.96704" + required: + - symbol + - amount + - notionalValue + nav: + type: string + example: "4.79" + realLeverage: + type: string + example: "-2.316" + fundingRate: + type: string + example: "0.001020" + dailyManagementFee: + type: string + example: "0.0001" + purchaseFeePct: + type: string + example: "0.0010" + dailyPurchaseLimit: + type: string + example: "100000.00" + redeemFeePct: + type: string + example: "0.0010" + dailyRedeemLimit: + type: string + example: "1000000.00" + timestamp: + type: integer + format: int64 + example: 1583127900000 + required: + - tokenName + - description + - underlying + - tokenIssued + - basket + - currentBaskets + - nav + - realLeverage + - fundingRate + - dailyManagementFee + - purchaseFeePct + - dailyPurchaseLimit + - redeemFeePct + - dailyRedeemLimit + - timestamp + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/blvt/subscribe: + post: + summary: Subscribe BLVT (USER_DATA) + description: 'Weight(IP): 1' + tags: + - BLVT + parameters: + - $ref: '#/components/parameters/blvtTokenName' + - name: cost + in: query + description: Spot balance + required: true + schema: + type: number + format: double + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Subscription Info + content: + application/json: + schema: + type: object + properties: + id: + type: number + format: double + example: 123 + status: + type: string + example: "S" + description: 'S, P, and F for "success", "pending", and "failure"' + tokenName: + type: string + example: "LINKUP" + amount: + type: string + example: "0.9559090500" + description: subscribed token amount + cost: + type: string + example: "9.99999995" + description: subscription cost in usdt + timestamp: + type: integer + format: int64 + example: 1600249972899 + required: + - id + - status + - tokenName + - amount + - cost + - timestamp + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/blvt/subscribe/record: + get: + summary: Query Subscription Record (USER_DATA) + description: |- + - Only the data of the latest 90 days is available + + Weight(IP): 1 + tags: + - BLVT + parameters: + - $ref: '#/components/parameters/optionalBlvtTokenName' + - name: id + in: query + schema: + type: integer + format: int64 + - $ref: '#/components/parameters/startTime' + - $ref: '#/components/parameters/endTime' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: List of subscription record + content: + application/json: + schema: + type: object + properties: + id: + type: number + format: double + example: 1 + tokenName: + type: string + example: "LINKUP" + amount: + type: string + example: "0.54216292" + description: Subscription amount + nav: + type: string + example: "18.42621386" + description: NAV price of subscription + fee: + type: string + example: "0.00999000" + description: Subscription fee in usdt + totalCharge: + type: string + example: "9.99999991" + description: Subscription cost in usdt + timestamp: + type: integer + format: int64 + example: 1599127217916 + required: + - id + - tokenName + - amount + - nav + - fee + - totalCharge + - timestamp + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/blvt/redeem: + post: + summary: Redeem BLVT (USER_DATA) + description: 'Weight(IP): 1' + tags: + - BLVT + parameters: + - $ref: '#/components/parameters/blvtTokenName' + - $ref: '#/components/parameters/amount' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Redemption record + content: + application/json: + schema: + type: object + properties: + id: + type: number + format: double + example: 123 + status: + type: string + example: "S" + description: 'S, P, and F for "success", "pending", and "failure"' + tokenName: + type: string + example: "LINKUP" + redeemAmount: + type: string + example: "0.95590905" + description: Redemption token amount + amount: + type: string + example: "10.05022099" + description: Redemption value in usdt + timestamp: + type: integer + format: int64 + example: 1600250279614 + required: + - id + - status + - tokenName + - redeemAmount + - amount + - timestamp + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/blvt/redeem/record: + get: + summary: Redemption Record (USER_DATA) + description: |- + - Only the data of the latest 90 days is available + + Weight(IP): 1 + tags: + - BLVT + parameters: + - $ref: '#/components/parameters/optionalBlvtTokenName' + - name: id + in: query + schema: + type: integer + format: int64 + - $ref: '#/components/parameters/startTime' + - $ref: '#/components/parameters/endTime' + - name: limit + in: query + schema: + type: integer + format: int32 + description: 'default 1000, max 1000' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: List of redemption record + content: + application/json: + schema: + type: array + items: + type: object + properties: + id: + type: number + format: double + example: 1 + tokenName: + type: string + example: "LINKUP" + amount: + type: string + example: "0.54216292" + description: Redemption amount + nav: + type: string + example: "18.36345064" + description: NAV of redemption + fee: + type: string + example: "0.00995598" + description: Reemption fee + netProceed: + type: string + example: "9.94602604" + description: Net redemption value in usdt + timestamp: + type: integer + format: int64 + example: 1599128003050 + required: + - id + - tokenName + - amount + - nav + - fee + - netProceed + - timestamp + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/blvt/userLimit: + get: + summary: BLVT User Limit Info (USER_DATA) + description: 'Weight(IP): 1' + tags: + - BLVT + parameters: + - $ref: '#/components/parameters/optionalBlvtTokenName' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: List of token limits + content: + application/json: + schema: + type: array + items: + type: object + properties: + tokenName: + type: string + example: "LINKUP" + userDailyTotalPurchaseLimit: + type: string + example: "1000" + description: USDT + userDailyTotalRedeemLimit: + type: string + example: "1000" + description: USDT + required: + - tokenName + - userDailyTotalPurchaseLimit + - userDailyTotalRedeemLimit + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/bswap/pools: + get: + summary: List All Swap Pools (MARKET_DATA) + description: |- + Get metadata about all swap pools. + + Weight(IP): 1 + tags: + - BSwap + security: + - ApiKeyAuth: [] + responses: + '200': + description: List of Swap Pools + content: + application/json: + schema: + type: array + items: + type: object + properties: + poolId: + type: integer + format: int64 + example: 2 + poolName: + type: string + example: "BUSD/USDT" + assets: + type: array + items: + type: string + minItems: 2 + maxItems: 2 + example: + - BUSD + - USDT + required: + - poolId + - poolName + - assets + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/bswap/liquidity: + get: + summary: Liquidity information of a pool (USER_DATA) + description: |- + Get liquidity information and user share of a pool. + + Weight(IP):\ + `1` for one pool;\ + `10` when the poolId parameter is omitted; + tags: + - BSwap + parameters: + - $ref: '#/components/parameters/optionalPoolId' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Pool Liquidation information + content: + application/json: + schema: + type: array + items: + type: object + properties: + poolId: + type: integer + format: int64 + example: 2 + poolNmae: + type: string + example: "BUSD/USDT" + updateTime: + type: integer + format: int64 + example: 1565769342148 + liquidity: + type: object + properties: + BUSD: + type: number + format: double + example: 100000315.79 + USDT: + type: number + format: double + example: 99999245.54 + required: + - BUSD + - USDT + share: + type: object + properties: + shareAmount: + type: number + format: double + example: 12415 + sharePercentage: + type: number + format: double + example: 0.00006207 + asset: + type: object + properties: + BUSD: + type: number + format: double + example: 6207.02 + USDT: + type: number + format: double + example: 6206.95 + required: + - BUSD + - USDT + required: + - shareAmount + - sharePercentage + - asset + required: + - poolId + - poolNmae + - updateTime + - liquidity + - share + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/bswap/liquidityAdd: + post: + summary: Add Liquidity (TRADE) + description: |- + Add liquidity to a pool. + + Weight(UID): 1000 (Additional: 3 times one second) + tags: + - BSwap + parameters: + - $ref: '#/components/parameters/poolId' + - $ref: '#/components/parameters/asset' + - $ref: '#/components/parameters/quantity' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Operation Id + content: + application/json: + schema: + type: object + properties: + operationId: + type: integer + format: int64 + example: 12341 + required: + - operationId + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/bswap/liquidityRemove: + post: + summary: Remove Liquidity (TRADE) + description: |- + Remove liquidity from a pool, `type` include `SINGLE` and `COMBINATION`, asset is mandatory for single asset removal + + Weight(UID): 1000 (Additional: 3 times one second) + tags: + - BSwap + parameters: + - $ref: '#/components/parameters/poolId' + - name: type + in: query + description: Can be `SINGLE` for single asset removal, `COMBINATION` for combination of all coins removal + required: true + schema: + type: string + enum: [SINGLE, COMBINATION] + example: 'SINGLE' + - name: asset + in: query + description: Mandatory for single asset removal + schema: + type: string + example: BNB + - name: shareAmount + in: query + required: true + schema: + type: number + format: double + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Operation Id + content: + application/json: + schema: + type: object + properties: + operationId: + type: integer + format: int64 + example: 12341 + required: + - operationId + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/bswap/liquidityOps: + get: + summary: Liquidity Operation Record (USER_DATA) + description: |- + Get liquidity operation (add/remove) records. + + Weight(UID): 3000 + tags: + - BSwap + parameters: + - name: operationId + in: query + schema: + type: integer + format: int64 + - $ref: '#/components/parameters/optionalPoolId' + - name: operation + in: query + schema: + type: string + enum: [ADD, REMOVE] + - $ref: '#/components/parameters/startTime' + - $ref: '#/components/parameters/endTime' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Liquidity Operation Record + content: + application/json: + schema: + type: array + items: + type: object + properties: + operationId: + type: integer + format: int64 + example: 12341 + poolId: + type: integer + format: int64 + example: 2 + poolName: + type: string + example: "BUSD/USDT" + operation: + type: string + example: "ADD" + description: '"ADD" or "REMOVE"' + status: + type: integer + format: int32 + example: 1 + description: "0: pending, 1: success, 2: failed" + updateTime: + type: integer + format: int64 + example: 1565769342148 + shareAmount: + type: string + example: "10.1" + required: + - operationId + - poolId + - poolName + - operation + - status + - updateTime + - shareAmount + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/bswap/quote: + get: + summary: Request Quote (USER_DATA) + description: |- + 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. + + Weight(UID): 150 + tags: + - BSwap + parameters: + - $ref: '#/components/parameters/quoteAsset' + - $ref: '#/components/parameters/baseAsset' + - $ref: '#/components/parameters/quoteQty' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Quote Info + content: + application/json: + schema: + type: object + properties: + quoteAsset: + type: string + example: "USDT" + baseAsset: + type: string + example: "BUSD" + quoteQty: + type: number + format: double + example: 300000 + baseQty: + type: number + format: double + example: 299975 + price: + type: number + format: double + example: 1.00008334 + slippage: + type: number + format: double + example: 0.00007245 + fee: + type: number + format: double + example: 120 + required: + - quoteAsset + - baseAsset + - quoteQty + - baseQty + - price + - slippage + - fee + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/bswap/swap: + post: + summary: Swap (TRADE) + description: |- + Swap `quoteAsset` for `baseAsset`. + + Weight(UID): 1000 (Additional: 3 times one second) + tags: + - BSwap + parameters: + - $ref: '#/components/parameters/quoteAsset' + - $ref: '#/components/parameters/baseAsset' + - $ref: '#/components/parameters/quoteQty' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Swap Id + content: + application/json: + schema: + type: object + properties: + swapId: + type: integer + format: int64 + example: 2314 + required: + - swapId + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + get: + summary: Swap History (USER_DATA) + description: |- + Get swap history. + + Weight(UID): 3000 + tags: + - BSwap + parameters: + - name: swapId + in: query + schema: + type: integer + format: int64 + - $ref: '#/components/parameters/startTime' + - $ref: '#/components/parameters/endTime' + - name: status + in: query + description: '0: pending for swap, 1: success, 2: failed' + schema: + type: integer + format: int32 + enum: [0,1,2] + - name: quoteAsset + in: query + schema: + type: string + example: 'USDT' + - name: baseAsset + in: query + schema: + type: string + example: 'BUSD' + - name: limit + in: query + schema: + type: integer + format: int32 + description: 'default 3, max 100' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Swap History + content: + application/json: + schema: + type: array + items: + type: object + properties: + swapId: + type: integer + format: int64 + example: 2314 + swapTime: + type: integer + format: int64 + example: 1565770342148 + status: + type: integer + format: int32 + example: 0 + description: "0: pending, 1: success, 2: failed" + quoteAsset: + type: string + example: "USDT" + baseAsset: + type: string + example: "BUSD" + quoteQty: + type: number + format: double + example: 300000 + baseQty: + type: number + format: double + example: 299975 + price: + type: number + format: double + example: 1.00008334 + fee: + type: number + format: double + example: 120 + required: + - swapId + - swapTime + - status + - quoteAsset + - baseAsset + - quoteQty + - baseQty + - price + - fee + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/bswap/poolConfigure: + get: + summary: Pool Configure (USER_DATA) + description: 'Weight(IP): 150' + tags: + - BSwap + parameters: + - name: poolId + in: query + schema: + type: integer + format: int64 + example: 2 + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Pool Information + content: + application/json: + schema: + type: array + items: + type: object + properties: + poolId: + type: integer + format: int64 + example: 2 + poolNmae: + type: string + example: "BUSD/USDT" + updateTime: + type: integer + format: int64 + example: 1565769342148 + liquidity: + type: object + properties: + constantA: + type: integer + format: int64 + example: 2000 + description: '"NA" if pool is an innovation pool' + minRedeemShare: + type: number + format: double + example: 0.1 + slippageTolerance: + type: number + example: 0.2 + format: double + description: The swap proceeds only when the slippage is within the set range + required: + - constantA + - minRedeemShare + - slippageTolerance + assetConfigure: + type: object + properties: + BUSD: + type: object + properties: + minAdd: + type: integer + format: int64 + example: 10 + maxAdd: + type: integer + format: int64 + example: 20 + minSwap: + type: integer + format: int64 + example: 10 + maxSwap: + type: integer + format: int64 + example: 30 + required: + - minAdd + - maxAdd + - minSwap + - maxSwap + USDT: + type: object + properties: + minAdd: + type: integer + format: int64 + example: 10 + maxAdd: + type: integer + format: int64 + example: 20 + minSwap: + type: integer + format: int64 + example: 10 + maxSwap: + type: integer + format: int64 + example: 30 + required: + - minAdd + - maxAdd + - minSwap + - maxSwap + required: + - BUSD + - USDT + required: + - poolId + - poolNmae + - updateTime + - liquidity + - assetConfigure + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/bswap/addLiquidityPreview: + get: + summary: Add Liquidity Preview (USER_DATA) + description: |- + Calculate expected share amount for adding liquidity in single or dual token. + + Weight(IP): 150 + tags: + - BSwap + parameters: + - name: poolId + in: query + required: true + schema: + type: integer + format: int64 + example: 2 + - name: type + in: query + description: '"SINGLE" for adding a single token;"COMBINATION" for adding dual tokens' + required: true + schema: + type: string + enum: [SINGLE, COMBINATION] + example: 'SINGLE' + - $ref: '#/components/parameters/quoteAsset' + - $ref: '#/components/parameters/quoteQty' + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Add Liquidity Preview + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/bswapAddLiquidityPreviewCombination' + - $ref: '#/components/schemas/bswapAddLiquidityPreviewSingle' + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/bswap/removeLiquidityPreview: + get: + summary: Remove Liquidity Preview (USER_DATA) + description: |- + Calculate the expected asset amount of single token redemption or dual token redemption. + + Weight(IP): 150 + tags: + - BSwap + parameters: + - name: poolId + in: query + required: true + schema: + type: integer + format: int64 + example: 2 + - name: type + in: query + description: 'Type is "SINGLE", remove and obtain a single token;Type is "COMBINATION", remove and obtain dual token.' + required: true + schema: + type: string + enum: [SINGLE, COMBINATION] + example: 'SINGLE' + - $ref: '#/components/parameters/quoteAsset' + - name: shareAmount + in: query + required: true + schema: + type: number + format: double + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Remove Liquidity Preview + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/bswapRmvLiquidityPreviewCombination' + - $ref: '#/components/schemas/bswapRmvLiquidityPreviewSingle' + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + /sapi/v1/c2c/orderMatch/listUserOrderHistory: + get: + summary: Get C2C Trade History (USER_DATA) + description: |- + - If startTimestamp and endTimestamp are not sent, the recent 30-day data will be returned. + - The max interval between startTimestamp and endTimestamp is 30 days. + + Weight(IP): 1 + tags: + - C2C + parameters: + - name: tradeType + in: query + schema: + type: string + enum: [BUY, SELL] + - name: startTimestamp + in: query + description: UTC timestamp in ms + schema: + type: integer + format: int64 + - name: endTimestamp + in: query + description: UTC timestamp in ms + schema: + type: integer + format: int64 + - $ref: '#/components/parameters/page' + - name: rows + in: query + description: default 100, max 100 + schema: + type: integer + format: int32 + - $ref: '#/components/parameters/recvWindow' + - $ref: '#/components/parameters/timestamp' + - $ref: '#/components/parameters/signature' + security: + - ApiKeyAuth: [] + responses: + '200': + description: Trades history + content: + application/json: + schema: + type: object + properties: + code: + type: string + example: "000000" + message: + type: string + example: "success" + data: + type: array + items: + type: object + properties: + orderNumber: + type: string + example: "20219644646554779648" + advNo: + type: string + example: "11218246497340923904" + tradeType: + type: string + example: "SELL" + asset: + type: string + example: "BUSD" + fiat: + type: string + example: "CNY" + fiatSymbol: + type: string + example: "¥" + amount: + type: string + example: "5000.00000000" + description: Quantity (in Crypto) + totalPrice: + type: string + example: "33400.00000000" + unitPrice: + type: string + example: "6.68" + description: Unit Price (in Fiat) + orderStatus: + type: string + example: "COMPLETED" + description: PENDING, TRADING, BUYER_PAYED, DISTRIBUTING, COMPLETED, IN_APPEAL, CANCELLED, CANCELLED_BY_SYSTEM + createTime: + type: integer + format: int64 + example: 1619361369000 + commission: + type: string + example: "0" + description: Transaction Fee (in Crypto) + counterPartNickName: + type: string + example: "ab***" + advertisementRole: + type: string + example: "TAKER" + required: + - orderNumber + - advNo + - tradeType + - asset + - fiat + - fiatSymbol + - amount + - totalPrice + - unitPrice + - orderStatus + - createTime + - commission + - counterPartNickName + - advertisementRole + total: + type: integer + format: int32 + example: 1 + success: + type: boolean + required: + - code + - message + - data + - total + - success + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + '401': + description: Unauthorized Request + content: + application/json: + schema: + $ref: '#/components/schemas/error' + +components: + parameters: + asset: + name: asset + in: query + required: true + schema: + type: string + example: 'BTC' + amount: + name: amount + in: query + required: true + schema: + type: number + format: double + example: '1.01' + current: + name: current + in: query + description: Current querying page. Start from 1. Default:1 + schema: + type: integer + format: int32 + example: 1 + optionalCoin: + name: coin + in: query + description: Coin name + schema: + type: string + example: 'BNB' + coin: + name: coin + in: query + required: true + description: Coin name + schema: + type: string + example: 'BNB' + side: + name: side + in: query + required: true + description: SELL or BUY + schema: + type: string + enum: ['SELL', 'BUY'] + example: 'SELL' + size: + name: size + in: query + description: Default:10 Max:100 + schema: + type: integer + format: int32 + example: 100 + symbol: + name: symbol + in: query + required: true + description: Trading symbol, e.g. BNBUSDT + schema: + type: string + example: 'BNBUSDT' + optionalSymbol: + name: symbol + in: query + description: Trading symbol, e.g. BNBUSDT + schema: + type: string + example: 'BNBUSDT' + optionalAsset: + name: asset + in: query + schema: + type: string + example: 'BNB' + limit: + name: limit + in: query + description: Default 500; max 1000. + schema: + type: integer + format: int32 + example: 500 + listenKey: + name: listenKey + in: query + description: User websocket listen key + schema: + type: string + example: 'pqia91ma19a5s61cv6a81va65sdf19v8a65a1a5s61cv6a81va65sdf19v8a65a1' + fromId: + name: fromId + in: query + description: Trade id to fetch from. Default gets most recent trades. + schema: + type: integer + format: int64 + offset: + name: offset + in: query + schema: + type: integer + format: int32 + orderId: + name: orderId + in: query + description: Order id + schema: + type: integer + format: int64 + orderListId: + name: orderListId + in: query + description: Order list id + schema: + type: integer + format: int64 + origClientOrderId: + name: origClientOrderId + in: query + description: Order id from client + schema: + type: string + listClientOrderId: + name: listClientOrderId + in: query + description: A unique Id for the entire orderList + schema: + type: string + newClientOrderId: + name: newClientOrderId + in: query + description: Used to uniquely identify this cancel. Automatically generated by default + schema: + type: string + newOrderRespType: + name: newOrderRespType + in: query + description: Set the response JSON. MARKET and LIMIT order types default to FULL, all other orders default to ACK. + schema: + type: string + enum: [ACK,RESULT,FULL] + ocoNewOrderRespType: + name: newOrderRespType + in: query + description: Set the response JSON. + schema: + type: string + enum: [ACK,RESULT,FULL] + startTime: + name: startTime + in: query + description: UTC timestamp in ms + schema: + type: integer + format: int64 + endTime: + name: endTime + in: query + description: UTC timestamp in ms + schema: + type: integer + format: int64 + price: + name: price + in: query + required: true + description: Order price + schema: + type: number + format: double + optionalPrice: + name: price + in: query + description: Order price + schema: + type: number + format: double + quantity: + name: quantity + in: query + required: true + schema: + type: number + format: double + optionalQuantity: + name: quantity + in: query + description: Order quantity + schema: + type: number + format: double + recvWindow: + name: recvWindow + in: query + description: The value cannot be greater than 60000 + schema: + type: integer + format: int64 + example: 5000 + timestamp: + name: timestamp + in: query + required: true + description: UTC timestamp in ms + schema: + type: integer + format: int64 + timeInForce: + name: timeInForce + in: query + description: Order time in force + schema: + type: string + enum: [GTC,IOC,FOK] + type: + name: type + in: query + required: true + schema: + type: integer + format: int64 + orderType: + name: type + in: query + required: true + description: Order type + schema: + type: string + enum: [LIMIT,MARKET,STOP_LOSS,STOP_LOSS_LIMIT,TAKE_PROFIT,TAKE_PROFIT_LIMIT,LIMIT_MAKER] + univTransferType: + name: type + in: query + required: true + description: Universal transfer type + schema: + type: string + enum: ['MAIN_C2C','MAIN_UMFUTURE','MAIN_CMFUTURE','MAIN_MARGIN','MAIN_MINING','C2C_MAIN','C2C_UMFUTURE','C2C_MINING','C2C_MARGIN','UMFUTURE_MAIN','UMFUTURE_C2C','UMFUTURE_MARGIN','CMFUTURE_MAIN','CMFUTURE_MARGIN','MARGIN_MAIN','MARGIN_UMFUTURE','MARGIN_CMFUTURE','MARGIN_MINING','MARGIN_C2C','MINING_MAIN','MINING_UMFUTURE','MINING_C2C','MINING_MARGIN','MAIN_PAY','PAY_MAIN', 'ISOLATEDMARGIN_MARGIN', 'MARGIN_ISOLATEDMARGIN', 'ISOLATEDMARGIN_ISOLATEDMARGIN'] + example: 'MAIN_C2C' + signature: + name: signature + in: query + required: true + description: Signature + schema: + type: string + stopPrice: + name: stopPrice + in: query + description: Used with STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, and TAKE_PROFIT_LIMIT orders. + schema: + type: number + format: double + example: 20.01 + isIsolatedMargin: + name: isIsolated + in: query + description: For isolated margin or not, 'TRUE', 'FALSE', default 'FALSE' + schema: + type: string + enum: ['TRUE','FALSE'] + transFrom: + name: transFrom + in: query + schema: + type: string + enum: ['SPOT', 'ISOLATED_MARGIN'] + example: 'SPOT' + transTo: + name: transTo + in: query + schema: + type: string + enum: ['SPOT', 'ISOLATED_MARGIN'] + example: 'ISOLATED_MARGIN' + symbols: + name: symbols + in: query + description: Max 5 symbols can be sent; separated by ',' + schema: + type: string + example: 'BTCUSDT,BNBUSDT,ADAUSDT' + arraySymbols: + name: arraySymbols + in: query + schema: + type: string + example: '["BTCUSDT","BNBBTC"]' + transactionType: + name: transactionType + in: query + required: true + description: 0-deposit, 1-withdraw + schema: + type: string + enum: ['0', '1'] + example: '0' + beginTime: + name: beginTime + in: query + schema: + type: integer + format: int64 + example: 1626144956000 + page: + name: page + in: query + description: Default 1 + schema: + type: integer + format: int32 + example: 1 + rows: + name: rows + in: query + description: Default 100, max 500 + schema: + type: integer + format: int32 + example: 300 + quoteOrderQty: + name: quoteOrderQty + in: query + description: Quote quantity + schema: + type: number + format: double + icebergQty: + name: icebergQty + in: query + description: Used with LIMIT, STOP_LOSS_LIMIT, and TAKE_PROFIT_LIMIT to create an iceberg order. + schema: + type: number + format: double + flexibleProductStatus: + name: status + in: query + required: true + description: "\"ALL\", \"SUBSCRIBABLE\", \"UNSUBSCRIBABLE\"; Default: 'ALL'" + schema: + type: string + enum: ['ALL','SUBSCRIBABLE','UNSUBSCRIBABLE'] + fixedAndActivityProductStatus: + name: status + in: query + required: true + description: "\"ALL\", \"SUBSCRIBABLE\", \"UNSUBSCRIBABLE\"; Default: 'ALL'" + schema: + type: string + enum: ['ALL','SUBSCRIBABLE','UNSUBSCRIBABLE'] + featured: + name: featured + in: query + description: '"ALL", "TRUE"; Default: "ALL"' + schema: + type: string + enum: ['ALL','TRUE'] + flexibleProductId: + name: productId + in: query + required: true + schema: + type: string + fixedAndActivityProjectId: + name: projectId + in: query + required: true + schema: + type: string + flexibleProductType: + name: type + in: query + required: true + description: '"FAST", "NORMAL"' + schema: + type: string + enum: ['FAST','NORMAL'] + fixedAndActivityProductType: + name: type + in: query + required: true + description: '"ACTIVITY", "CUSTOMIZED_FIXED"' + schema: + type: string + enum: ['ACTIVITY','CUSTOMIZED_FIXED'] + sortBy: + name: sortBy + in: query + required: true + description: '"START_TIME", "LOT_SIZE", "INTEREST_RATE", "DURATION"; default "START_TIME' + schema: + type: string + enum: ['START_TIME','LOT_SIZ','LOT_SIZE','INTEREST_RATE','DURATION'] + isSortAsc: + name: isSortAsc + in: query + required: true + description: default "true" + schema: + type: boolean + projectId: + name: projectId + in: query + required: true + schema: + type: string + lot: + name: lot + in: query + required: true + schema: + type: string + lendingType: + name: lendingType + in: query + required: true + description: '"DAILY" for flexible, "ACTIVITY" for activity, "CUSTOMIZED_FIXED" for fixed' + schema: + type: string + enum: ['DAILY','ACTIVITY','CUSTOMIZED_FIXED'] + optionalPositionId: + name: positionId + in: query + schema: + type: string + positionId: + name: positionId + in: query + required: true + schema: + type: string + positionStatus: + name: status + in: query + required: true + description: '"HOLDING", "REDEEMED"' + schema: + type: string + enum: ['HOLDING','REDEEMED'] + userName: + name: userName + in: query + required: true + description: Mining Account + schema: + type: string + algo: + name: algo + in: query + required: true + description: Algorithm(sha256) + schema: + type: string + pageIndex: + name: pageIndex + in: query + description: Page number, default is first page, start form 1 + schema: + type: integer + format: int32 + sort: + name: sort + in: query + description: sort sequence(default=0)0 positive sequence, 1 negative sequence + schema: + type: integer + format: int32 + sortColumn: + name: sortColumn + in: query + description: 'Sort by( default 1): 1: miner name, 2: real-time computing power, 3: daily average computing power, 4: real-time rejection rate, 5: last submission time' + schema: + type: integer + format: int32 + workerStatus: + name: workerStatus + in: query + description: miners status(default=0)0 all, 1 valid, 2 invalid, 3 failure + schema: + type: integer + format: int32 + startDate: + name: startDate + in: query + description: Search date, millisecond timestamp, while empty query all + schema: + type: string + endDate: + name: endDate + in: query + description: Search date, millisecond timestamp, while empty query all + schema: + type: string + pageSize: + name: pageSize + in: query + description: Number of pages, minimum 10, maximum 200 + schema: + type: string + configId: + name: configId + in: query + required: true + description: Mining ID + schema: + type: string + toPoolUser: + name: toPoolUser + in: query + required: true + description: Mining Account + schema: + type: string + hashRate: + name: hashRate + in: query + required: true + description: Resale hashrate h/s must be transferred (BTC is greater than 500000000000 ETH is greater than 500000) + schema: + type: string + workerName: + name: workerName + in: query + required: true + description: Miner’s name + schema: + type: string + blvtTokenName: + name: tokenName + in: query + required: true + description: BTCDOWN, BTCUP + schema: + type: string + optionalBlvtTokenName: + name: tokenName + in: query + description: BTCDOWN, BTCUP + schema: + type: string + poolId: + name: poolId + in: query + required: true + schema: + type: integer + format: int64 + optionalPoolId: + name: poolId + in: query + schema: + type: integer + format: int64 + quoteAsset: + name: quoteAsset + in: query + required: true + schema: + type: string + example: 'USDT' + baseAsset: + name: baseAsset + in: query + required: true + schema: + type: string + example: 'BUSD' + quoteQty: + name: quoteQty + in: query + required: true + schema: + type: number + format: double + subAccountEmail: + name: email + in: query + required: true + schema: + type: string + description: Sub-account email + optionalSubAccountEmail: + name: email + in: query + schema: + type: string + description: Sub-account email + optionalSubAccountFromEmail: + name: fromEmail + in: query + schema: + type: string + description: Sub-account email + optionalSubAccountToEmail: + name: toEmail + in: query + schema: + type: string + description: Sub-account email + subAccountFromEmail: + name: fromEmail + in: query + required: true + schema: + type: string + description: Sender email + subAccountToEmail: + name: toEmail + in: query + required: true + schema: + type: string + description: Recipient email + fromSymbol: + name: fromSymbol + in: query + description: Must be sent when type are ISOLATEDMARGIN_MARGIN and ISOLATEDMARGIN_ISOLATEDMARGIN + schema: + type: string + example: 'BNBUSDT' + toSymbol: + name: toSymbol + in: query + description: Must be sent when type are MARGIN_ISOLATEDMARGIN and ISOLATEDMARGIN_ISOLATEDMARGIN + schema: + type: string + example: 'BNBUSDT' + isolatedSymbol: + name: isolatedSymbol + in: query + description: Isolated symbol + schema: + type: string + archived: + name: archived + in: query + description: 'Default: false. Set to true for archived data from 6 months ago' + schema: + type: string + sideEffectType: + name: sideEffectType + in: query + description: Default NO_SIDE_EFFECT + schema: + type: string + enum: [NO_SIDE_EFFECT, MARGIN_BUY, AUTO_REPAY] + limitClientOrderId: + name: limitClientOrderId + in: query + description: 'A unique Id for the limit order' + schema: + type: string + limitIcebergQty: + name: limitIcebergQty + in: query + schema: + type: number + format: double + stopClientOrderId: + name: stopClientOrderId + in: query + description: 'A unique Id for the stop loss/stop loss limit leg' + schema: + type: string + ocoStopPrice: + name: stopPrice + in: query + required: true + schema: + type: number + format: double + stopLimitPrice: + name: stopLimitPrice + in: query + description: 'If provided, stopLimitTimeInForce is required.' + schema: + type: number + format: double + stopIcebergQty: + name: stopIcebergQty + in: query + schema: + type: number + format: double + stopLimitTimeInForce: + name: stopLimitTimeInForce + in: query + schema: + type: string + enum: [GTC,FOK,IOC] + schemas: + account: + type: object + properties: + makerCommission: + type: integer + format: int64 + example: 15 + takerCommission: + type: integer + format: int64 + example: 15 + buyerCommission: + type: integer + format: int64 + example: 0 + sellerCommission: + type: integer + format: int64 + example: 0 + canTrade: + type: boolean + canWithdraw: + type: boolean + canDeposit: + type: boolean + updateTime: + type: integer + format: int64 + example: 123456789 + accountType: + type: string + example: "SPOT" + balances: + type: array + items: + type: object + properties: + asset: + type: string + example: "BTC" + free: + type: string + example: "4723846.89208129" + locked: + type: string + example: "0.00000000" + required: + - asset + - free + - locked + required: + - makerCommission + - takerCommission + - buyerCommission + - sellerCommission + - canTrade + - canWithdraw + - canDeposit + - updateTime + - accountType + - balances + order: + type: object + properties: + symbol: + type: string + example: "BNBBTC" + origClientOrderId: + type: string + example: "msXkySR3u5uYwpvRMFsi3u" + orderId: + type: integer + format: int64 + example: 28 + orderListId: + type: integer + format: int64 + description: Unless OCO, value will be -1 + example: -1 + clientOrderId: + type: string + example: "6gCrw2kRUAF9CvJDGP16IP" + price: + type: string + example: "1.00000000" + origQty: + type: string + example: "10.00000000" + executedQty: + type: string + example: "10.00000000" + cummulativeQuoteQty: + type: string + example: "10.00000000" + status: + type: string + example: "FILLED" + timeInForce: + type: string + example: "GTC" + type: + type: string + example: "LIMIT" + side: + type: string + example: "SELL" + required: + - symbol + - origClientOrderId + - orderId + - orderListId + - clientOrderId + - price + - origQty + - executedQty + - cummulativeQuoteQty + - status + - timeInForce + - type + - side + ocoOrder: + type: object + properties: + orderListId: + type: integer + format: int64 + example: 1929 + contingencyType: + type: string + example: "OCO" + listStatusType: + type: string + example: "ALL_DONE" + listOrderStatus: + type: string + example: "ALL_DONE" + listClientOrderId: + type: string + example: "C3wyj4WVEktd7u9aVBRXcN" + transactionTime: + type: integer + format: int64 + example: 1574040868128 + symbol: + type: string + example: "BNBBTC" + orders: + type: array + items: + type: object + properties: + symbol: + type: string + orderId: + type: integer + format: int64 + clientOrderId: + type: string + required: + - symbol + - orderId + - clientOrderId + example: + - symbol: "BNBBTC" + orderId: 2 + clientOrderId: "pO9ufTiFGg3nw2fOdgeOXa" + - symbol: "BNBBTC" + orderId: 3 + clientOrderId: "TXOvglzXuaubXAaENpaRCB" + orderReports: + type: array + items: + type: object + properties: + symbol: + type: string + origClientOrderId: + type: string + orderId: + type: integer + format: int64 + orderListId: + type: integer + format: int64 + clientOrderId: + type: string + price: + type: string + origQty: + type: string + executedQty: + type: string + cummulativeQuoteQty: + type: string + status: + type: string + timeInForce: + type: string + type: + type: string + side: + type: string + stopPrice: + type: string + required: + - symbol + - origClientOrderId + - orderId + - orderListId + - clientOrderId + - price + - origQty + - executedQty + - cummulativeQuoteQty + - status + - timeInForce + - type + - side + - stopPrice + example: + - symbol: "BNBBTC" + origClientOrderId: "pO9ufTiFGg3nw2fOdgeOXa" + orderId: 2 + orderListId: 0 + clientOrderId: "unfWT8ig8i0uj6lPuYLez6" + price: "1.00000000" + origQty: "10.00000000" + executedQty: "0.00000000" + cummulativeQuoteQty: "0.00000000" + status: "CANCELED" + timeInForce: "GTC" + type: "STOP_LOSS_LIMIT" + side: "SELL" + stopPrice: "1.00000000" + - symbol: "BNBBTC" + origClientOrderId: "TXOvglzXuaubXAaENpaRCB" + orderId: 3 + orderListId: 0 + clientOrderId: "unfWT8ig8i0uj6lPuYLez6" + price: "3.00000000" + origQty: "10.00000000" + executedQty: "0.00000000" + cummulativeQuoteQty: "0.00000000" + status: "CANCELED" + timeInForce: "GTC" + type: "LIMIT_MAKER" + side: "SELL" + required: + - orderListId + - contingencyType + - listStatusType + - listOrderStatus + - listClientOrderId + - transactionTime + - symbol + - orders + - orderReports + marginOcoOrder: + type: object + properties: + orderListId: + type: integer + format: int64 + example: 0 + contingencyType: + type: string + example: "OCO" + listStatusType: + type: string + example: "ALL_DONE" + listOrderStatus: + type: string + example: "ALL_DONE" + listClientOrderId: + type: string + example: "C3wyj4WVEktd7u9aVBRXcN" + transactionTime: + type: integer + format: int64 + example: 1574040868128 + symbol: + type: string + example: "BNBUSDT" + isIsolated: + type: boolean + example: false + orders: + type: array + items: + type: object + properties: + symbol: + type: string + orderId: + type: integer + format: int64 + clientOrderId: + type: string + required: + - symbol + - orderId + - clientOrderId + example: + - symbol: "BNBUSDT" + orderId: 2 + clientOrderId: "pO9ufTiFGg3nw2fOdgeOXa" + - symbol: "BNBUSDT" + orderId: 3 + clientOrderId: "TXOvglzXuaubXAaENpaRCB" + orderReports: + type: array + items: + type: object + properties: + symbol: + type: string + origClientOrderId: + type: string + orderId: + type: integer + format: int64 + orderListId: + type: integer + format: int64 + clientOrderId: + type: string + price: + type: string + origQty: + type: string + executedQty: + type: string + cummulativeQuoteQty: + type: string + status: + type: string + timeInForce: + type: string + type: + type: string + side: + type: string + stopPrice: + type: string + required: + - symbol + - origClientOrderId + - orderId + - orderListId + - clientOrderId + - price + - origQty + - executedQty + - cummulativeQuoteQty + - status + - timeInForce + - type + - side + - stopPrice + example: + - symbol: "BNBUSDT" + origClientOrderId: "pO9ufTiFGg3nw2fOdgeOXa" + orderId: 2 + orderListId: 0 + clientOrderId: "unfWT8ig8i0uj6lPuYLez6" + price: "1.00000000" + origQty: "10.00000000" + executedQty: "0.00000000" + cummulativeQuoteQty: "0.00000000" + status: "CANCELED" + timeInForce: "GTC" + type: "STOP_LOSS_LIMIT" + side: "SELL" + stopPrice: "1.00000000" + - symbol: "BNBUSDT" + origClientOrderId: "TXOvglzXuaubXAaENpaRCB" + orderId: 3 + orderListId: 0 + clientOrderId: "unfWT8ig8i0uj6lPuYLez6" + price: "3.00000000" + origQty: "10.00000000" + executedQty: "0.00000000" + cummulativeQuoteQty: "0.00000000" + status: "CANCELED" + timeInForce: "GTC" + type: "LIMIT_MAKER" + side: "SELL" + required: + - orderListId + - contingencyType + - listStatusType + - listOrderStatus + - listClientOrderId + - transactionTime + - symbol + - isIsolated + - orders + - orderReports + orderDetails: + type: object + properties: + symbol: + type: string + example: "LTCBTC" + orderId: + type: integer + format: int64 + example: 1 + orderListId: + type: integer + format: int64 + description: Unless OCO, value will be -1 + example: -1 + clientOrderId: + type: string + example: "myOrder1" + price: + type: string + example: "0.1" + origQty: + type: string + example: "1.0" + executedQty: + type: string + example: "0.0" + cummulativeQuoteQty: + type: string + example: "0.0" + status: + type: string + example: "NEW" + timeInForce: + type: string + example: "GTC" + type: + type: string + example: "LIMIT" + side: + type: string + example: "BUY" + stopPrice: + type: string + example: "0.0" + icebergQty: + type: string + example: "0.0" + time: + type: integer + format: int64 + example: 1499827319559 + updateTime: + type: integer + format: int64 + example: 1499827319559 + isWorking: + type: boolean + origQuoteOrderQty: + type: string + example: "0.00000000" + required: + - symbol + - orderId + - orderListId + - clientOrderId + - price + - origQty + - executedQty + - cummulativeQuoteQty + - status + - timeInForce + - type + - side + - stopPrice + - icebergQty + - time + - updateTime + - isWorking + - origQuoteOrderQty + orderResponseAck: + type: object + properties: + symbol: + type: string + example: "BTCUSDT" + orderId: + type: integer + format: int64 + example: 28 + orderListId: + type: integer + format: int64 + example: -1 + clientOrderId: + type: string + example: "6gCrw2kRUAF9CvJDGP16IP" + transactTime: + type: integer + format: int64 + example: 1507725176595 + required: + - symbol + - orderId + - orderListId + - clientOrderId + - transactTime + orderResponseResult: + type: object + properties: + symbol: + type: string + example: "BTCUSDT" + orderId: + type: integer + format: int64 + example: 28 + orderListId: + type: integer + format: int64 + example: -1 + clientOrderId: + type: string + example: "6gCrw2kRUAF9CvJDGP16IP" + transactTime: + type: integer + format: int64 + example: 1507725176595 + price: + type: string + example: "0.00000000" + origQty: + type: string + example: "10.00000000" + executedQty: + type: string + example: "10.00000000" + cummulativeQuoteQty: + type: string + example: "10.00000000" + status: + type: string + example: "FILLED" + timeInForce: + type: string + example: "GTC" + type: + type: string + example: "MARKET" + side: + type: string + example: "SELL" + required: + - symbol + - orderId + - orderListId + - clientOrderId + - transactTime + - price + - origQty + - executedQty + - cummulativeQuoteQty + - status + - timeInForce + - type + - side + orderResponseFull: + type: object + properties: + symbol: + type: string + example: "BTCUSDT" + orderId: + type: integer + format: int64 + example: 28 + orderListId: + type: integer + format: int64 + example: -1 + clientOrderId: + type: string + example: "6gCrw2kRUAF9CvJDGP16IP" + transactTime: + type: integer + format: int64 + example: 1507725176595 + price: + type: string + example: "0.00000000" + origQty: + type: string + example: "10.00000000" + executedQty: + type: string + example: "10.00000000" + cummulativeQuoteQty: + type: string + example: "10.00000000" + status: + type: string + example: "FILLED" + timeInForce: + type: string + example: "GTC" + type: + type: string + example: "MARKET" + side: + type: string + example: "SELL" + fills: + type: array + items: + type: object + properties: + price: + type: string + example: "4000.00000000" + qty: + type: string + example: "1.00000000" + commission: + type: string + example: "4.00000000" + commissionAsset: + type: string + example: "USDT" + required: + - price + - qty + - commission + - commissionAsset + required: + - symbol + - orderId + - orderListId + - clientOrderId + - transactTime + - price + - origQty + - executedQty + - cummulativeQuoteQty + - status + - timeInForce + - type + - side + - fills + marginOrder: + type: object + properties: + symbol: + type: string + example: "LTCBTC" + orderId: + type: integer + format: int64 + example: 28 + origClientOrderId: + type: string + example: "msXkySR3u5uYwpvRMFsi3u" + clientOrderId: + type: string + example: "6gCrw2kRUAF9CvJDGP16IP" + price: + type: string + example: "1.00000000" + origQty: + type: string + example: "10.00000000" + executedQty: + type: string + example: "8.00000000" + cummulativeQuoteQty: + type: string + example: "8.00000000" + status: + type: string + example: "CANCELED" + timeInForce: + type: string + example: "GTC" + type: + type: string + example: "LIMIT" + side: + type: string + example: "SELL" + required: + - symbol + - orderId + - origClientOrderId + - clientOrderId + - price + - origQty + - executedQty + - cummulativeQuoteQty + - status + - timeInForce + - type + - side + marginOrderDetail: + type: object + properties: + clientOrderId: + type: string + example: "ZwfQzuDIGpceVhKW5DvCmO" + cummulativeQuoteQty: + type: string + example: "0.00000000" + executedQty: + type: string + example: "0.00000000" + icebergQty: + type: string + example: "0.00000000" + isWorking: + type: boolean + orderId: + type: integer + format: int64 + example: 213205622 + origQty: + type: string + example: "0.30000000" + price: + type: string + example: "0.00493630" + side: + type: string + example: "SELL" + status: + type: string + example: "NEW" + stopPrice: + type: string + example: "0.00000000" + symbol: + type: string + example: "BNBBTC" + isIsolated: + type: boolean + time: + type: integer + format: int64 + example: 1562133008725 + timeInForce: + type: string + example: "GTC" + type: + type: string + example: "LIMIT" + updateTime: + type: integer + format: int64 + example: 1562133008725 + required: + - clientOrderId + - cummulativeQuoteQty + - executedQty + - icebergQty + - isWorking + - orderId + - origQty + - price + - side + - status + - stopPrice + - symbol + - isIsolated + - time + - timeInForce + - type + - updateTime + canceledMarginOrderDetail: + type: object + properties: + symbol: + type: string + example: "BNBUSDT" + isIsolated: + type: boolean + origClientOrderId: + type: string + example: "E6APeyTJvkMvLMYMqu1KQ4" + orderId: + type: integer + format: int64 + example: 11 + orderListId: + type: integer + format: int64 + example: -1 + clientOrderId: + type: string + example: "pXLV6Hz6mprAcVYpVMTGgx" + price: + type: string + example: "0.089853" + origQty: + type: string + example: "0.178622" + executedQty: + type: string + example: "0.000000" + cummulativeQuoteQty: + type: string + example: "0.000000" + status: + type: string + example: "CANCELED" + timeInForce: + type: string + example: "GTC" + type: + type: string + example: "LIMIT" + side: + type: string + example: "BUY" + required: + - symbol + - isIsolated + - origClientOrderId + - orderId + - orderListId + - clientOrderId + - price + - origQty + - executedQty + - cummulativeQuoteQty + - status + - timeInForce + - type + - side + marginOrderResponseAck: + type: object + properties: + symbol: + type: string + example: "BTCUSDT" + orderId: + type: integer + format: int64 + example: 28 + clientOrderId: + type: string + example: "6gCrw2kRUAF9CvJDGP16IP" + isIsolated: + type: boolean + transactTime: + type: integer + format: int64 + example: 1507725176595 + required: + - symbol + - orderId + - clientOrderId + - isIsolated + - transactTime + marginOrderResponseResult: + type: object + properties: + symbol: + type: string + example: "BTCUSDT" + orderId: + type: integer + format: int64 + example: 28 + clientOrderId: + type: string + example: "6gCrw2kRUAF9CvJDGP16IP" + transactTime: + type: integer + format: int64 + example: 1507725176595 + price: + type: string + example: "1.00000000" + origQty: + type: string + example: "10.00000000" + executedQty: + type: string + example: "10.00000000" + cummulativeQuoteQty: + type: string + example: "10.00000000" + status: + type: string + example: "FILLED" + timeInForce: + type: string + example: "GTC" + type: + type: string + example: "MARKET" + isIsolated: + type: boolean + side: + type: string + example: "SELL" + required: + - symbol + - orderId + - clientOrderId + - transactTime + - price + - origQty + - executedQty + - cummulativeQuoteQty + - status + - timeInForce + - type + - isIsolated + - side + marginOrderResponseFull: + type: object + properties: + symbol: + type: string + example: "BTCUSDT" + orderId: + type: integer + format: int64 + example: 28 + clientOrderId: + type: string + example: "6gCrw2kRUAF9CvJDGP16IP" + transactTime: + type: integer + format: int64 + example: 1507725176595 + price: + type: string + example: "1.00000000" + origQty: + type: string + example: "10.00000000" + executedQty: + type: string + example: "10.00000000" + cummulativeQuoteQty: + type: string + example: "10.00000000" + status: + type: string + example: "FILLED" + timeInForce: + type: string + example: "GTC" + type: + type: string + example: "MARKET" + side: + type: string + example: "SELL" + marginBuyBorrowAmount: + type: number + format: double + example: 5 + description: will not return if no margin trade happens + marginBuyBorrowAsset: + type: string + example: "BTC" + description: will not return if no margin trade happens + isIsolated: + type: boolean + fills: + type: array + items: + type: object + properties: + price: + type: string + example: "4000.00000000" + qty: + type: string + example: "1.00000000" + commission: + type: string + example: "4.00000000" + commissionAsset: + type: string + example: "USDT" + required: + - price + - qty + - commission + - commissionAsset + required: + - symbol + - orderId + - clientOrderId + - transactTime + - price + - origQty + - executedQty + - cummulativeQuoteQty + - status + - timeInForce + - type + - side + - marginBuyBorrowAmount + - marginBuyBorrowAsset + - isIsolated + - fills + marginTrade: + type: object + properties: + commission: + type: string + example: "0.00006000" + commissionAsset: + type: string + example: "BTC" + id: + type: integer + format: int64 + example: 28 + isBestMatch: + type: boolean + isBuyer: + type: boolean + isMaker: + type: boolean + orderId: + type: integer + format: int64 + example: 28 + price: + type: string + example: "0.02000000" + qty: + type: string + example: "1.02000000" + symbol: + type: string + example: "BNBBTC" + isIsolated: + type: boolean + example: false + time: + type: integer + format: int64 + example: 1507725176595 + required: + - commission + - commissionAsset + - id + - isBestMatch + - isBuyer + - isMaker + - orderId + - price + - qty + - symbol + - isIsolated + - time + marginTransferDetails: + type: object + properties: + rows: + type: array + items: + type: object + properties: + amount: + type: string + example: "0.10000000" + asset: + type: string + example: "BNB" + status: + type: string + example: "CONFIRMED" + timestamp: + type: integer + format: int64 + example: 1566898617000 + txId: + type: integer + format: int64 + example: 5240372201 + transFrom: + type: string + example: "SPOT" + transTo: + type: string + example: "ISOLATED_MARGIN" + required: + - amount + - asset + - status + - timestamp + - txId + - transFrom + - transTo + total: + type: integer + format: int32 + example: 1 + required: + - rows + - total + isolatedMarginAccountInfo: + type: object + properties: + assets: + type: array + items: + type: object + properties: + baseAsset: + type: object + properties: + asset: + type: string + example: "BTC" + borrowEnabled: + type: boolean + borrowed: + type: string + example: "0.00000000" + free: + type: string + example: "0.00000000" + interest: + type: string + example: "0.00000000" + locked: + type: string + example: "0.00000000" + netAsset: + type: string + example: "0.00000000" + netAssetOfBtc: + type: string + example: "0.00000000" + repayEnabled: + type: boolean + totalAsset: + type: string + example: "0.00000000" + required: + - asset + - borrowEnabled + - borrowed + - free + - interest + - locked + - netAsset + - netAssetOfBtc + - repayEnabled + - totalAsset + quoteAsset: + type: object + properties: + asset: + type: string + example: "USDT" + borrowEnabled: + type: boolean + borrowed: + type: string + example: "0.00000000" + free: + type: string + example: "0.00000000" + interest: + type: string + example: "0.00000000" + locked: + type: string + example: "0.00000000" + netAsset: + type: string + example: "0.00000000" + netAssetOfBtc: + type: string + example: "0.00000000" + repayEnabled: + type: boolean + totalAsset: + type: string + example: "0.00000000" + required: + - asset + - borrowEnabled + - borrowed + - free + - interest + - locked + - netAsset + - netAssetOfBtc + - repayEnabled + - totalAsset + symbol: + type: string + example: "BTCUSDT" + isolatedCreated: + type: boolean + enabled: + type: boolean + description: true-enabled, false-disabled + marginLevel: + type: string + example: "0.00000000" + marginLevelStatus: + type: string + example: "EXCESSIVE" + description: '"EXCESSIVE", "NORMAL", "MARGIN_CALL", "PRE_LIQUIDATION", "FORCE_LIQUIDATION"' + marginRatio: + type: string + example: "0.00000000" + indexPrice: + type: string + example: "10000.00000000" + liquidatePrice: + type: string + example: "1000.00000000" + liquidateRate: + type: string + example: "1.00000000" + tradeEnabled: + type: boolean + required: + - baseAsset + - quoteAsset + - symbol + - isolatedCreated + - enabled + - marginLevel + - marginLevelStatus + - marginRatio + - indexPrice + - liquidatePrice + - liquidateRate + - tradeEnabled + totalAssetOfBtc: + type: string + example: "0.00000000" + totalLiabilityOfBtc: + type: string + example: "0.00000000" + totalNetAssetOfBtc: + type: string + example: "0.00000000" + required: + - assets + - totalAssetOfBtc + - totalLiabilityOfBtc + - totalNetAssetOfBtc + bookTickerList: + type: array + items: + $ref: '#/components/schemas/bookTicker' + bookTicker: + type: object + properties: + symbol: + type: string + example: "BNBBTC" + bidPrice: + type: string + example: "16.36240000" + bidQty: + type: string + example: "256.78000000" + askPrice: + type: string + example: "16.36450000" + askQty: + type: string + example: "12.56000000" + required: + - symbol + - bidPrice + - bidQty + - askPrice + - askQty + priceTickerList: + type: array + items: + $ref: '#/components/schemas/priceTicker' + priceTicker: + type: object + properties: + symbol: + type: string + example: "BNBBTC" + price: + type: string + example: "0.17160000" + required: + - symbol + - price + tickerList: + type: array + items: + $ref: '#/components/schemas/ticker' + ticker: + type: object + properties: + symbol: + type: string + example: "BNBBTC" + priceChange: + type: string + example: "0.17160000" + priceChangePercent: + type: string + example: "1.060" + prevClosePrice: + type: string + example: "16.35920000" + lastPrice: + type: string + example: "27.84000000" + bidPrice: + type: string + example: "16.34488284" + bidQty: + type: string + example: "16.34488284" + askPrice: + type: string + example: "16.35920000" + askQty: + type: string + example: "25.06000000" + openPrice: + type: string + example: "16.18760000" + highPrice: + type: string + example: "16.55000000" + lowPrice: + type: string + example: "16.16940000" + volume: + type: string + example: "1678279.95000000" + quoteVolume: + type: string + example: "27431289.14792300" + openTime: + type: integer + format: int64 + example: 1592808788637 + closeTime: + type: integer + format: int64 + example: 1592895188637 + firstId: + type: integer + format: int64 + example: 62683296 + lastId: + type: integer + format: int64 + example: 62739253 + count: + type: integer + format: int64 + example: 55958 + required: + - symbol + - priceChange + - priceChangePercent + - prevClosePrice + - lastPrice + - bidPrice + - bidQty + - askPrice + - askQty + - openPrice + - highPrice + - lowPrice + - volume + - quoteVolume + - openTime + - closeTime + - firstId + - lastId + - count + myTrade: + type: object + properties: + symbol: + type: string + example: "BNBBTC" + id: + type: integer + format: int64 + description: Trade id + example: 28457 + orderId: + type: integer + format: int64 + example: 100234 + orderListId: + type: integer + format: int64 + example: -1 + price: + type: string + description: Price + example: "4.00000100" + qty: + type: string + description: Amount of base asset + example: "12.00000000" + quoteQty: + type: string + description: Amount of quote asset + example: "48.000012" + commission: + type: string + example: "10.10000000" + commissionAsset: + type: string + example: "BNB" + time: + type: integer + format: int64 + description: Trade timestamp + example: 1499865549590 + isBuyer: + type: boolean + example: false + isMaker: + type: boolean + example: false + isBestMatch: + type: boolean + required: + - symbol + - id + - orderId + - orderListId + - price + - qty + - quoteQty + - commission + - commissionAsset + - time + - isBuyer + - isMaker + - isBestMatch + transaction: + type: object + properties: + tranId: + type: integer + format: int64 + description: transaction id + example: 345196462 + required: + - tranId + trade: + type: object + properties: + id: + type: integer + format: int64 + description: trade id + example: 345196462 + price: + type: string + description: price + example: "9638.99000000" + qty: + type: string + description: amount of base asset + example: "0.02077200" + quoteQty: + type: string + description: amount of quote asset + example: "0.02077200" + time: + type: integer + format: int64 + description: Trade executed timestamp, as same as `T` in the stream + example: 1592887772684 + isBuyerMaker: + type: boolean + isBestMatch: + type: boolean + required: + - id + - price + - qty + - quoteQty + - time + - isBuyerMaker + - isBestMatch + aggTrade: + type: object + properties: + a: + type: integer + format: int64 + description: Aggregate tradeId + example: 26129 + p: + type: string + description: Price + example: "0.01633102" + q: + type: string + description: Quantity + example: "4.70443515" + f: + type: integer + format: int64 + description: First tradeId + example: 27781 + l: + type: integer + format: int64 + description: Last tradeId + example: 27781 + T: + type: boolean + description: Timestamp + example: 1498793709153 + m: + type: boolean + description: Was the buyer the maker? + M: + type: boolean + description: Was the trade the best price match? + required: + - a + - p + - q + - f + - l + - T + - m + - M + bnbBurnStatus: + type: object + properties: + spotBNBBurn: + type: boolean + interestBNBBurn: + type: boolean + example: false + required: + - spotBNBBurn + - interestBNBBurn + snapshotSpot: + type: object + properties: + code: + type: integer + format: int64 + example: 200 + msg: + type: string + example: "" + snapshotVos: + type: array + items: + type: object + properties: + data: + type: object + properties: + balances: + type: array + items: + type: object + properties: + asset: + type: string + example: "BTC" + free: + type: string + example: "0.2" + locked: + type: string + example: "0.001" + required: + - asset + - free + - locked + totalAssetOfBtc: + type: string + example: "0.09905021" + required: + - balances + - totalAssetOfBtc + type: + type: string + example: "spot" + updateTime: + type: integer + format: int64 + example: 1576281599000 + required: + - data + - type + - updateTime + required: + - code + - msg + - snapshotVos + snapshotMargin: + type: object + properties: + code: + type: integer + format: int64 + example: 200 + msg: + type: string + example: "" + snapshotVos: + type: array + items: + type: object + properties: + data: + type: object + properties: + marginLevel: + type: string + example: "2748.02909813" + totalAssetOfBtc: + type: string + example: "0.00274803" + totalLiabilityOfBtc: + type: string + example: "0.00000100" + totalNetAssetOfBtc: + type: string + example: "0.00274750" + userAssets: + type: array + items: + type: object + properties: + asset: + type: string + example: "XRP" + borrowed: + type: string + example: "0.00000000" + free: + type: string + example: "1.00000000" + interest: + type: string + example: "0.00000000" + locked: + type: string + example: "0.00000000" + netAsset: + type: string + example: "1.00000000" + required: + - asset + - borrowed + - free + - interest + - locked + - netAsset + required: + - marginLevel + - totalAssetOfBtc + - totalLiabilityOfBtc + - totalNetAssetOfBtc + - userAssets + type: + type: string + example: "margin" + updateTime: + type: integer + format: int64 + example: 1576281599000 + required: + - data + - type + - updateTime + required: + - code + - msg + - snapshotVos + snapshotFutures: + type: object + properties: + code: + type: integer + format: int64 + example: 200 + msg: + type: string + example: "" + snapshotVos: + type: array + items: + type: object + properties: + data: + type: object + properties: + assets: + type: array + items: + type: object + properties: + asset: + type: string + example: "USDT" + marginBalance: + type: string + example: "118.99782335" + walletBalance: + type: string + example: "120.23811389" + required: + - asset + - marginBalance + - walletBalance + position: + type: array + items: + type: object + properties: + entryPrice: + type: string + example: "7130.41000000" + markPrice: + type: string + example: "7257.66239673" + positionAmt: + type: string + example: "0.01000000" + symbol: + type: string + example: "BTCUSDT" + unRealizedProfit: + type: string + example: "1.24029054" + required: + - entryPrice + - markPrice + - positionAmt + - symbol + - unRealizedProfit + required: + - assets + - position + type: + type: string + example: "futures" + updateTime: + type: integer + format: int64 + example: 1576281599000 + required: + - data + - type + - updateTime + required: + - code + - msg + - snapshotVos + subAccountUSDTFuturesDetails: + type: object + properties: + futureAccountResp: + type: object + properties: + email: + type: string + example: "abc@test.com" + assets: + type: array + items: + type: object + properties: + asset: + type: string + example: "USDT" + initialMargin: + type: string + example: "0.00000000" + maintenanceMargin: + type: string + example: "0.00000000" + marginBalance: + type: string + example: "0.88308000" + maxWithdrawAmount: + type: string + example: "0.88308000" + openOrderInitialMargin: + type: string + example: "0.00000000" + positionInitialMargin: + type: string + example: "0.00000000" + unrealizedProfit: + type: string + example: "0.00000000" + walletBalance: + type: string + example: "0.88308000" + required: + - asset + - initialMargin + - maintenanceMargin + - marginBalance + - maxWithdrawAmount + - openOrderInitialMargin + - positionInitialMargin + - unrealizedProfit + - walletBalance + canDeposit: + type: boolean + canTrade: + type: boolean + canWithdraw: + type: boolean + feeTier: + type: integer + format: int64 + example: 2 + maxWithdrawAmount: + type: string + example: "0.88308000" + totalInitialMargin: + type: string + example: "0.00000000" + totalMaintenanceMargin: + type: string + example: "0.00000000" + totalMarginBalance: + type: string + example: "0.88308000" + totalOpenOrderInitialMargin: + type: string + example: "0.00000000" + totalPositionInitialMargin: + type: string + example: "0.00000000" + totalUnrealizedProfit: + type: string + example: "0.00000000" + totalWalletBalance: + type: string + example: "0.88308000" + updateTime: + type: integer + format: int64 + example: 1576756674610 + required: + - email + - assets + - canDeposit + - canTrade + - canWithdraw + - feeTier + - maxWithdrawAmount + - totalInitialMargin + - totalMaintenanceMargin + - totalMarginBalance + - totalOpenOrderInitialMargin + - totalPositionInitialMargin + - totalUnrealizedProfit + - totalWalletBalance + - updateTime + required: + - futureAccountResp + subAccountCOINFuturesDetails: + type: object + properties: + email: + type: string + example: "abc@test.com" + assets: + type: array + items: + type: object + properties: + asset: + type: string + example: "BTC" + initialMargin: + type: string + example: "0.00000000" + maintenanceMargin: + type: string + example: "0.00000000" + marginBalance: + type: string + example: "0.88308000" + maxWithdrawAmount: + type: string + example: "0.88308000" + openOrderInitialMargin: + type: string + example: "0.00000000" + positionInitialMargin: + type: string + example: "0.00000000" + unrealizedProfit: + type: string + example: "0.00000000" + walletBalance: + type: string + example: "0.88308000" + required: + - asset + - initialMargin + - maintenanceMargin + - marginBalance + - maxWithdrawAmount + - openOrderInitialMargin + - positionInitialMargin + - unrealizedProfit + - walletBalance + canDeposit: + type: boolean + canTrade: + type: boolean + canWithdraw: + type: boolean + feeTier: + type: integer + format: int64 + example: 2 + updateTime: + type: integer + format: int64 + example: 1598959682001 + required: + - email + - assets + - canDeposit + - canTrade + - canWithdraw + - feeTier + - updateTime + subAccountUSDTFuturesSummary: + type: object + properties: + futureAccountSummaryResp: + type: object + properties: + totalInitialMargin: + type: string + example: "9.83137400" + totalMaintenanceMargin: + type: string + example: "0.41568700" + totalMarginBalance: + type: string + example: "23.03235621" + totalOpenOrderInitialMargin: + type: string + example: "9.00000000" + totalPositionInitialMargin: + type: string + example: "0.83137400" + totalUnrealizedProfit: + type: string + example: "0.03219710" + totalWalletBalance: + type: string + example: "22.15879444" + asset: + type: string + example: "USD" + description: The sum of BUSD and USDT + subAccountList: + type: array + items: + type: object + properties: + email: + type: string + example: "123@test.com" + totalInitialMargin: + type: string + example: "9.00000000" + totalMaintenanceMargin: + type: string + example: "0.00000000" + totalMarginBalance: + type: string + example: "22.12659734" + totalOpenOrderInitialMargin: + type: string + example: "9.00000000" + totalPositionInitialMargin: + type: string + example: "0.00000000" + totalUnrealizedProfit: + type: string + example: "0.00000000" + totalWalletBalance: + type: string + example: "22.12659734" + asset: + type: string + example: "USD" + description: The sum of BUSD and USDT + required: + - email + - totalInitialMargin + - totalMaintenanceMargin + - totalMarginBalance + - totalOpenOrderInitialMargin + - totalPositionInitialMargin + - totalUnrealizedProfit + - totalWalletBalance + - asset + required: + - totalInitialMargin + - totalMaintenanceMargin + - totalMarginBalance + - totalOpenOrderInitialMargin + - totalPositionInitialMargin + - totalUnrealizedProfit + - totalWalletBalance + - asset + - subAccountList + required: + - futureAccountSummaryResp + subAccountCOINFuturesSummary: + type: object + properties: + deliveryAccountSummaryResp: + type: object + properties: + totalMarginBalanceOfBTC: + type: string + example: 25.03221121 + totalUnrealizedProfitOfBTC: + type: string + example: 0.12233410 + totalWalletBalanceOfBTC: + type: string + example: 22.15879444 + asset: + type: string + example: BTC + subAccountList: + type: array + items: + type: object + properties: + email: + type: string + example: 123@test.com + totalMarginBalance: + type: string + example: 22.12659734 + totalUnrealizedProfit: + type: string + example: 0.00000000 + totalWalletBalance: + type: string + example: 22.12659734 + asset: + type: string + example: BTC + required: + - email + - totalMarginBalance + - totalUnrealizedProfit + - totalWalletBalance + - asset + required: + - totalMarginBalanceOfBTC + - totalUnrealizedProfitOfBTC + - totalWalletBalanceOfBTC + - asset + - subAccountList + required: + - deliveryAccountSummaryResp + subAccountUSDTFuturesPositionRisk: + type: object + properties: + futurePositionRiskVos: + type: array + items: + type: object + properties: + entryPrice: + type: string + example: "9975.12000" + leverage: + type: string + example: "50" + description: current initial leverage + maxNotional: + type: string + example: "1000000" + description: notional value limit of current initial leverage + liquidationPrice: + type: string + example: "7963.54" + markPrice: + type: string + example: "9973.50770517" + positionAmount: + type: string + example: "0.010" + symbol: + type: string + example: "BTCUSDT" + unrealizedProfit: + type: string + example: "-0.01612295" + required: + - entryPrice + - leverage + - maxNotional + - liquidationPrice + - markPrice + - positionAmount + - symbol + - unrealizedProfit + required: + - futurePositionRiskVos + subAccountCOINFuturesPositionRisk: + type: object + properties: + deliveryPositionRiskVos: + type: array + items: + type: object + properties: + entryPrice: + type: string + example: "9975.12000" + markPrice: + type: string + example: "9973.50770517" + leverage: + type: string + example: "20" + isolated: + type: string + example: false + isolatedWallet: + type: string + example: "9973.50770517" + isolatedMargin: + type: string + example: "0.00000000" + isAutoAddMargin: + type: string + example: "false" + positionSide: + type: string + example: "BOTH" + positionAmount: + type: string + example: "1.230" + symbol: + type: string + example: "BTCUSD_201225" + unrealizedProfit: + type: string + example: "-0.01612295" + required: + - entryPrice + - markPrice + - leverage + - isolated + - isolatedWallet + - isolatedMargin + - isAutoAddMargin + - positionSide + - positionAmount + - symbol + - unrealizedProfit + required: + - deliveryPositionRiskVos + savingsFlexiblePurchaseRecord: + type: array + items: + type: object + properties: + amount: + type: string + example: "100.00000000" + asset: + type: string + example: "USDT" + createTime: + type: integer + format: int64 + example: 1575018510000 + lendingType: + type: string + example: "DAILY" + productName: + type: string + example: "USDT" + purchaseId: + type: integer + format: int64 + example: 26055 + status: + type: string + example: "SUCCESS" + required: + - amount + - asset + - createTime + - lendingType + - productName + - purchaseId + - status + savingsFixedActivityPurchaseRecord: + type: array + items: + type: object + properties: + amount: + type: string + example: "100.00000000" + asset: + type: string + example: "USDT" + createTime: + type: integer + format: int64 + example: 1575018453000 + lendingType: + type: string + example: "ACTIVITY" + lot: + type: integer + format: int64 + example: 1 + productName: + type: string + example: "【Special】USDT 7D (8%)" + purchaseId: + type: integer + format: int64 + example: 36857 + status: + type: string + example: "SUCCESS" + required: + - amount + - asset + - createTime + - lendingType + - lot + - productName + - purchaseId + - status + savingsFlexibleRedemptionRecord: + type: array + items: + type: object + properties: + amount: + type: string + example: "10.54000000" + asset: + type: string + example: "USDT" + createTime: + type: integer + format: int64 + example: 1577257222000 + principal: + type: string + example: "10.54000000" + projectId: + type: string + example: "USDT001" + projectName: + type: string + example: "USDT" + status: + type: string + example: "PAID" + type: + type: string + example: "FAST" + required: + - amount + - asset + - createTime + - principal + - projectId + - projectName + - status + - type + savingsFixedActivityRedemptionRecord: + type: array + items: + type: object + properties: + amount: + type: string + example: "0.07070000" + asset: + type: string + example: "USDT" + createTime: + type: integer + format: int64 + example: 1566200161000 + interest: + type: string + example: "0.00070000" + principal: + type: string + example: "0.07000000" + projectId: + type: string + example: "test06" + projectName: + type: string + example: "USDT 1 day (10% annualized)" + startTime: + type: integer + format: int64 + example: 1566198000000 + status: + type: string + example: "PAID" + required: + - amount + - asset + - createTime + - interest + - principal + - projectId + - projectName + - startTime + - status + bswapAddLiquidityPreviewCombination: + type: object + properties: + quoteAsset: + type: string + example: "USDT" + baseAsset: + type: string + example: "BUSD" + quoteAmt: + type: integer + format: int64 + example: 300000 + baseAmt: + type: integer + format: int64 + example: 299975 + price: + type: number + format: double + example: 1.00008334 + share: + type: number + format: double + example: 1.23 + required: + - quoteAsset + - baseAsset + - quoteAmt + - baseAmt + - price + - share + bswapAddLiquidityPreviewSingle: + type: object + properties: + quoteAsset: + type: string + example: "USDT" + quoteAmt: + type: integer + format: int64 + example: 300000 + price: + type: number + format: double + example: 1.00008334 + share: + type: number + format: double + example: 1.23 + slippage: + type: number + format: double + example: 0.00007245 + fee: + type: number + format: double + example: 120 + required: + - quoteAsset + - quoteAmt + - price + - share + - slippage + - fee + bswapRmvLiquidityPreviewCombination: + type: object + properties: + quoteAsset: + type: string + example: "USDT" + baseAsset: + type: string + example: "BUSD" + quoteAmt: + type: integer + format: int64 + example: 300000 + baseAmt: + type: integer + format: int64 + example: 299975 + price: + type: number + format: double + example: 1.00008334 + required: + - quoteAsset + - baseAsset + - quoteAmt + - baseAmt + - price + bswapRmvLiquidityPreviewSingle: + type: object + properties: + quoteAsset: + type: string + example: "USDT" + quoteAmt: + type: integer + format: int64 + example: 300000 + price: + type: number + format: double + example: 1.00008334 + slippage: + type: number + format: double + example: 0.00007245 + fee: + type: number + format: double + example: 120 + required: + - quoteAsset + - quoteAmt + - price + - slippage + - fee + error: + type: object + properties: + code: + type: integer + format: int64 + description: Error code + msg: + type: string + description: Error message + example: "error message" + required: + - code + - msg + securitySchemes: + ApiKeyAuth: + name: X-MBX-APIKEY + in: header + description: Binance Public API Key + type: apiKey \ No newline at end of file diff --git a/.circleci/specifications/z_complex_self_made_example.yml b/.circleci/specifications/z_complex_self_made_example.yml index 6080759..14c34e6 100644 --- a/.circleci/specifications/z_complex_self_made_example.yml +++ b/.circleci/specifications/z_complex_self_made_example.yml @@ -287,6 +287,15 @@ components: Test6: type: string enum: ["hello", "there"] + Test7: + type: array + items: + type: object + properties: + prop1: + type: integer + prop2: + type: string CoverType: type: object properties: @@ -300,6 +309,7 @@ components: - $ref: '#/components/schemas/Test4' - $ref: '#/components/schemas/Test5' - $ref: '#/components/schemas/Test6' + - $ref: '#/components/schemas/Test7' parameters: PetParameters: name: petId diff --git a/.circleci/test_system_1 b/.circleci/test_system_1 index fc3e48d..48099a0 100755 --- a/.circleci/test_system_1 +++ b/.circleci/test_system_1 @@ -12,7 +12,9 @@ specifications=( official-uspto.yaml petstore-expanded.json selenium.yaml + spot_api.yml uber.json + z_complex_self_made_example.yml ) outDir=openapi @@ -51,7 +53,7 @@ for specification in "${specifications[@]}"; do rm -rf $outDir printf "\n\nRun compile test for $specification\n" echo "-------------------------" - $GENERATOR_EXE "../specifications/$specification" --output-dir=$outDir --response-type-suffix="Response'" + $GENERATOR_EXE "../specifications/$specification" --output-dir=$outDir --response-type-suffix="Response'" --opaque-schema="aggTrade" continueOnFailure "code generation" "$specification" cd $outDir stack build --fast diff --git a/openapi3-code-generator/src/OpenAPI/Generate/Model.hs b/openapi3-code-generator/src/OpenAPI/Generate/Model.hs index 9445746..aeb9c14 100644 --- a/openapi3-code-generator/src/OpenAPI/Generate/Model.hs +++ b/openapi3-code-generator/src/OpenAPI/Generate/Model.hs @@ -508,9 +508,12 @@ defineNewSchemaForAllOf schemaName description schemas = do -- | defines an array defineArrayModelForSchema :: TypeAliasStrategy -> Text -> OAS.SchemaObject -> OAM.Generator TypeWithDeclaration defineArrayModelForSchema strategy schemaName schema = do + arrayItemTypeSuffix <- case strategy of + CreateTypeAlias -> OAM.getSetting OAO.settingArrayItemTypeSuffix + DontCreateTypeAlias -> pure "" -- The suffix is only relevant for top level declarations because only there a named type of the array even exists (type', (content, dependencies)) <- case OAS.items schema of - Just itemSchema -> OAM.nested "items" $ defineModelForSchemaNamed schemaName itemSchema + Just itemSchema -> OAM.nested "items" $ defineModelForSchemaNamed (schemaName <> arrayItemTypeSuffix) itemSchema -- not allowed by the spec Nothing -> do OAM.logWarning "Array type was defined without a items schema and therefore cannot be defined correctly" diff --git a/openapi3-code-generator/src/OpenAPI/Generate/OptParse.hs b/openapi3-code-generator/src/OpenAPI/Generate/OptParse.hs index 245d021..9bdc8cd 100644 --- a/openapi3-code-generator/src/OpenAPI/Generate/OptParse.hs +++ b/openapi3-code-generator/src/OpenAPI/Generate/OptParse.hs @@ -71,6 +71,8 @@ data Settings = Settings settingResponseBodyTypeSuffix :: !Text, -- | The suffix which is added to the request body data types settingRequestBodyTypeSuffix :: !Text, + -- | The suffix which is added to the item type of an array. This is only applied to item types of top level array types which an alias is generated for. + settingArrayItemTypeSuffix :: !Text, -- | The suffix which is added to the parameters type of operations settingParametersTypeSuffix :: !Text, -- | The prefix which is added to query parameters @@ -125,6 +127,7 @@ combineToSettings Flags {..} mConf = do settingResponseTypeSuffix = fromMaybe "Response" $ flagResponseTypeSuffix <|> mc configResponseTypeSuffix settingResponseBodyTypeSuffix = fromMaybe "ResponseBody" $ flagResponseBodyTypeSuffix <|> mc configResponseBodyTypeSuffix settingRequestBodyTypeSuffix = fromMaybe "RequestBody" $ flagRequestBodyTypeSuffix <|> mc configRequestBodyTypeSuffix + settingArrayItemTypeSuffix = fromMaybe "Item" $ flagArrayItemTypeSuffix <|> mc configArrayItemTypeSuffix settingParametersTypeSuffix = fromMaybe "Parameters" $ flagParametersTypeSuffix <|> mc configParametersTypeSuffix settingParameterQueryPrefix = fromMaybe "query" $ flagParameterQueryPrefix <|> mc configParameterQueryPrefix settingParameterPathPrefix = fromMaybe "path" $ flagParameterPathPrefix <|> mc configParameterPathPrefix diff --git a/openapi3-code-generator/src/OpenAPI/Generate/OptParse/Configuration.hs b/openapi3-code-generator/src/OpenAPI/Generate/OptParse/Configuration.hs index 4d9324b..95d137c 100644 --- a/openapi3-code-generator/src/OpenAPI/Generate/OptParse/Configuration.hs +++ b/openapi3-code-generator/src/OpenAPI/Generate/OptParse/Configuration.hs @@ -38,6 +38,7 @@ data Configuration = Configuration configResponseTypeSuffix :: !(Maybe Text), configResponseBodyTypeSuffix :: !(Maybe Text), configRequestBodyTypeSuffix :: !(Maybe Text), + configArrayItemTypeSuffix :: !(Maybe Text), configParametersTypeSuffix :: !(Maybe Text), configParameterQueryPrefix :: !(Maybe Text), configParameterPathPrefix :: !(Maybe Text), @@ -77,6 +78,7 @@ instance YamlSchema Configuration where <*> optionalField "responseTypeSuffix" "The suffix which is added to the response data types" <*> optionalField "responseBodyTypeSuffix" "The suffix which is added to the response body data types" <*> optionalField "requestBodyTypeSuffix" "The suffix which is added to the request body data types" + <*> optionalField "arrayItemTypeSuffix" "The suffix which is added to the item type of an array. This is only applied to item types of top level array types which an alias is generated for." <*> optionalField "parametersTypeSuffix" "The suffix which is added to the parameters type of operations" <*> optionalField "parameterQueryPrefix" "The prefix which is added to query parameters" <*> optionalField "parameterPathPrefix" "The prefix which is added to path parameters" diff --git a/openapi3-code-generator/src/OpenAPI/Generate/OptParse/Flags.hs b/openapi3-code-generator/src/OpenAPI/Generate/OptParse/Flags.hs index 8b08678..a69ca25 100644 --- a/openapi3-code-generator/src/OpenAPI/Generate/OptParse/Flags.hs +++ b/openapi3-code-generator/src/OpenAPI/Generate/OptParse/Flags.hs @@ -34,6 +34,7 @@ data Flags = Flags flagResponseTypeSuffix :: !(Maybe Text), flagResponseBodyTypeSuffix :: !(Maybe Text), flagRequestBodyTypeSuffix :: !(Maybe Text), + flagArrayItemTypeSuffix :: !(Maybe Text), flagParametersTypeSuffix :: !(Maybe Text), flagParameterQueryPrefix :: !(Maybe Text), flagParameterPathPrefix :: !(Maybe Text), @@ -70,6 +71,7 @@ parseFlags = <*> parseFlagResponseTypeSuffix <*> parseFlagResponseBodyTypeSuffix <*> parseFlagRequestBodyTypeSuffix + <*> parseFlagArrayItemTypeSuffix <*> parseFlagParametersTypeSuffix <*> parseFlagParameterQueryPrefix <*> parseFlagParameterPathPrefix @@ -257,6 +259,16 @@ parseFlagRequestBodyTypeSuffix = long "request-body-type-suffix" ] +parseFlagArrayItemTypeSuffix :: Parser (Maybe Text) +parseFlagArrayItemTypeSuffix = + optional $ + strOption $ + mconcat + [ metavar "SUFFIX", + help "The suffix which is added to the item type of an array (default: 'Item'). This is only applied to item types of top level array types which an alias is generated for.", + long "array-item-type-suffix" + ] + parseFlagParametersTypeSuffix :: Parser (Maybe Text) parseFlagParametersTypeSuffix = optional $