From 69535ec5f719e7c51698bfa5d5fe55dcaf6b4a87 Mon Sep 17 00:00:00 2001 From: whitebit-robot Date: Mon, 6 Nov 2023 10:03:55 +0100 Subject: [PATCH 1/7] add convert api docs --- pages/private/http-trade-v4.md | 286 ++++++++++++++++++++++++++++++++- 1 file changed, 285 insertions(+), 1 deletion(-) diff --git a/pages/private/http-trade-v4.md b/pages/private/http-trade-v4.md index 7c461b8..4b10ed5 100644 --- a/pages/private/http-trade-v4.md +++ b/pages/private/http-trade-v4.md @@ -31,7 +31,10 @@ - [Query unexecuted(active) OCO orders](#query-unexecutedactive-oco-orders) - [Create collateral OCO order](#create-collateral-oco-order) - [Cancel OCO order](#cancel-oco-order) - + - [Convert](#convert) + - [Estimate](#convert-estimate) + - [Confirm](#convert-confirm) + - [History](#convert-history) --- Base URL is https://whitebit.com @@ -4708,3 +4711,284 @@ Error codes: --- + +## Convert + +### Convert Estimate + +``` +[POST] /api/v4/convert/estimate +``` + +This endpoint creates a quote for converting one currency to another. + +❗ Rate limit 10000 requests/10 sec. + +**Response is cached for:** +NONE + +**Parameters:** + +| Name | Type | Mandatory | Description | +|-----------|--------|-----------|--------------------------------------------------------------------------------------------------------------------| +| from | String | **Yes** | From currency. Example: BTC | +| to | String | **Yes** | To currency. Example: USDT | +| direction | String | **Yes** | Convert direction. Can be either: 'from' or 'to'. Option 'to' means you want to receive 'amount' in 'to' currency. | +| amount | String | **Yes** | Amount to convert or receive. | + +**Request BODY raw:** + +Example of 'I want to estimate convert of BTC to 1 USDT': +```json +{ + "amount": "1", + "direction": "to", // enum('from', 'to') + "from": "BTC", + "to": "USDT", + "nonce": "{{nonce}}", + "request": "{{request}}" +} +``` + +Example of 'I want to estimate convert of 1 BTC to USDT': +```json +{ + "amount": "1", + "direction": "from", // enum('from', 'to') + "from": "BTC", + "to": "USDT", + "nonce": "{{nonce}}", + "request": "{{request}}" +} +``` + +**Response:** + +Available statuses: + +- `Status 200` +- `Status 400 if inner validation failed` +- `Status 422 if validation failed` + +```json +{ + "path": [ + { + "from": "BTC", + "to": "USDT", + "rate": "34299.76831549" + } + ], + "fee": "0", + "give": "50", + "receive": "1714988.41577452", + "rate": "34299.76831549", + "id": 123, + "expireAt": 1699016476 +} +``` + +
+Errors: + +```json +{ + "code": 0, + "message": "Validation failed", + "errors": { + "user": [ + "Terms of exchange are not accepted" + ] + } +} +``` + +```json +{ + "code": 30, + "message": "Validation failed", + "errors": { + "direction": [ + "Direction field does not exist in [from,to]." + ] + } +} +``` + +```json +{ + "code": 0, + "message": "Validation failed", + "errors": { + "from": [ + "Conversion markets not available" + ] + } +} +``` + +
+ +--- + +### Convert Confirm + +``` +[POST] /api/v4/convert/confirm +``` + +This endpoint confirms an estimated quote. + +❗ Rate limit 10000 requests/10 sec. + +**Response is cached for:** +NONE + +**Parameters:** + +| Name | Type | Mandatory | Description | +|---------|--------|-----------|-------------| +| quoteId | String | **Yes** | Quote ID | + +**Request BODY raw:** + +```json +{ + "quoteId": 4050, + "nonce": "{{nonce}}", + "request": "{{request}}" +} +``` + +**Response:** + +Available statuses: + +- `Status 200` +- `Status 400 if inner validation failed` +- `Status 422 if validation failed` + +```json +{ + "finalGive": "0.00002901", + "finalReceive": "1" +} +``` + +
+Errors: + +```json +{ + "code": 0, + "message": "Validation failed", + "errors": { + "quoteId": [ + "Quote could not be found" + ] + } +} +``` + +
+ +--- + +### Convert History + +``` +[POST] /api/v4/convert/history +``` + +This endpoint returns convert history. + +❗ Rate limit 10000 requests/10 sec. + +**Response is cached for:** +NONE + +**Parameters:** + +| Name | Type | Mandatory | Description | +|------------|--------|-----------|-------------------------------------------| +| fromTicker | String | **No** | From currency. Example: BTC | +| toTicker | String | **No** | To currency. Example: USDT | +| from | String | **No** | From time filter. Example: 1699260637 | +| to | String | **No** | To time filter. Example: 1699260637 | +| quoteId | String | **No** | Quote Id. Example: 4050 | +| limit | String | **No** | How many records to receive. Default: 100 | +| offset | String | **No** | Amount to convert or receive. Default 0 | + +**Request BODY raw:** + +```json +{ + "fromTicker": "BTC", + "nonce": "{{nonce}}", + "request": "{{request}}", +} +``` + +**Response:** + +Available statuses: + +- `Status 200` +- `Status 400 if inner validation failed` +- `Status 422 if validation failed` + +```json +{ + "records": [ + { + "id": "4030", + "path": [ + { + "from": "BTC", + "to": "USDT", + "rate": "34470.87211306" + } + ], + "date": 1699020642, + "fee": "0", + "give": "0.00002901", + "receive": "1", + "rate": "34470.87211306" + } + ], + "total": 4, + "limit": 1, + "offset": 0 +} +``` + +
+Errors: + +```json +{ + "code": 30, + "message": "Validation failed", + "errors": { + "fromTicker": [ + "fromTicker is invalid." + ] + } +} +``` + +```json +{ + "code": 30, + "message": "Validation failed", + "errors": { + "toTicker": [ + "toTicker is invalid." + ] + } +} +``` + +
+ +--- From 3a1b2a40ea7a8db8103264f9b458b545413ce612 Mon Sep 17 00:00:00 2001 From: whitebit-robot Date: Mon, 6 Nov 2023 10:05:19 +0100 Subject: [PATCH 2/7] fix newlines --- pages/private/http-trade-v4.md | 1 + 1 file changed, 1 insertion(+) diff --git a/pages/private/http-trade-v4.md b/pages/private/http-trade-v4.md index 4b10ed5..ed61b21 100644 --- a/pages/private/http-trade-v4.md +++ b/pages/private/http-trade-v4.md @@ -35,6 +35,7 @@ - [Estimate](#convert-estimate) - [Confirm](#convert-confirm) - [History](#convert-history) + --- Base URL is https://whitebit.com From 43b8a6527becc88fdb1e0512dc613ea5928ae4cf Mon Sep 17 00:00:00 2001 From: whitebit-robot Date: Tue, 7 Nov 2023 15:05:46 +0100 Subject: [PATCH 3/7] remove path from convert response --- pages/private/http-trade-v4.md | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/pages/private/http-trade-v4.md b/pages/private/http-trade-v4.md index ed61b21..5939844 100644 --- a/pages/private/http-trade-v4.md +++ b/pages/private/http-trade-v4.md @@ -4773,13 +4773,6 @@ Available statuses: ```json { - "path": [ - { - "from": "BTC", - "to": "USDT", - "rate": "34299.76831549" - } - ], "fee": "0", "give": "50", "receive": "1714988.41577452", @@ -4943,13 +4936,6 @@ Available statuses: "records": [ { "id": "4030", - "path": [ - { - "from": "BTC", - "to": "USDT", - "rate": "34470.87211306" - } - ], "date": 1699020642, "fee": "0", "give": "0.00002901", From 513524440a2bbf38ff5f0e027896fda01e6fe2a0 Mon Sep 17 00:00:00 2001 From: whitebit-robot Date: Wed, 8 Nov 2023 09:49:56 +0100 Subject: [PATCH 4/7] return path to history --- pages/private/http-trade-v4.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pages/private/http-trade-v4.md b/pages/private/http-trade-v4.md index 5939844..569bc66 100644 --- a/pages/private/http-trade-v4.md +++ b/pages/private/http-trade-v4.md @@ -4773,11 +4773,13 @@ Available statuses: ```json { + "id": 123, + "from": "BTC", + "to": "USDT", "fee": "0", "give": "50", "receive": "1714988.41577452", "rate": "34299.76831549", - "id": 123, "expireAt": 1699016476 } ``` @@ -4940,7 +4942,14 @@ Available statuses: "fee": "0", "give": "0.00002901", "receive": "1", - "rate": "34470.87211306" + "rate": "34470.87211306", + "path": [ + { + "from": "BTC", + "to": "USDT", + "rate": "34470.87211306" + } + ] } ], "total": 4, From 863ab757d34e4d55f2968035ca130139c7ffa0f2 Mon Sep 17 00:00:00 2001 From: whitebit-robot Date: Wed, 8 Nov 2023 11:43:30 +0100 Subject: [PATCH 5/7] change id type to string in estimate response --- pages/private/http-trade-v4.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/private/http-trade-v4.md b/pages/private/http-trade-v4.md index 569bc66..5bb8efd 100644 --- a/pages/private/http-trade-v4.md +++ b/pages/private/http-trade-v4.md @@ -4773,7 +4773,7 @@ Available statuses: ```json { - "id": 123, + "id": "123", "from": "BTC", "to": "USDT", "fee": "0", From a27761012a2a17935fb5624038a74f6d2d509de1 Mon Sep 17 00:00:00 2001 From: whitebit-robot Date: Thu, 9 Nov 2023 13:17:51 +0100 Subject: [PATCH 6/7] remove fee from response --- pages/private/http-trade-v4.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/pages/private/http-trade-v4.md b/pages/private/http-trade-v4.md index 5bb8efd..a56bfaa 100644 --- a/pages/private/http-trade-v4.md +++ b/pages/private/http-trade-v4.md @@ -4776,7 +4776,6 @@ Available statuses: "id": "123", "from": "BTC", "to": "USDT", - "fee": "0", "give": "50", "receive": "1714988.41577452", "rate": "34299.76831549", @@ -4939,7 +4938,6 @@ Available statuses: { "id": "4030", "date": 1699020642, - "fee": "0", "give": "0.00002901", "receive": "1", "rate": "34470.87211306", From 57e7df769dd3665ef18ccf74e5beaf9c1546154f Mon Sep 17 00:00:00 2001 From: whitebit-robot Date: Thu, 9 Nov 2023 13:53:49 +0100 Subject: [PATCH 7/7] update definition of direction --- pages/private/http-trade-v4.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/pages/private/http-trade-v4.md b/pages/private/http-trade-v4.md index a56bfaa..9deca17 100644 --- a/pages/private/http-trade-v4.md +++ b/pages/private/http-trade-v4.md @@ -4730,19 +4730,19 @@ NONE **Parameters:** -| Name | Type | Mandatory | Description | -|-----------|--------|-----------|--------------------------------------------------------------------------------------------------------------------| -| from | String | **Yes** | From currency. Example: BTC | -| to | String | **Yes** | To currency. Example: USDT | -| direction | String | **Yes** | Convert direction. Can be either: 'from' or 'to'. Option 'to' means you want to receive 'amount' in 'to' currency. | -| amount | String | **Yes** | Amount to convert or receive. | +| Name | Type | Mandatory | Description | +|-----------|--------|-----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| from | String | **Yes** | From currency. Example: BTC | +| to | String | **Yes** | To currency. Example: USDT | +| direction | String | **Yes** | Convert amount direction, defines in which currency corresponding “amount” field is populated. Use “to” in case amount is in “to” currency, use “from” if amount is in “from” currency (see use case samples below) | +| amount | String | **Yes** | Amount to convert or receive. | **Request BODY raw:** -Example of 'I want to estimate convert of BTC to 1 USDT': +Example of 'I would like to estimate convert of BTC to receive 35,103.1 USDT': ```json { - "amount": "1", + "amount": "35,103.1", "direction": "to", // enum('from', 'to') "from": "BTC", "to": "USDT", @@ -4751,7 +4751,7 @@ Example of 'I want to estimate convert of BTC to 1 USDT': } ``` -Example of 'I want to estimate convert of 1 BTC to USDT': +Example of 'I would like to estimate convert of 1 BTC to USDT': ```json { "amount": "1",