🧮 Расчёт суммы обмена
Code samples
POST /api/rates/calculate
Публичный эндпоинт. Рассчитывает сумму к получению по направлению и входящей сумме.
Body parameter
{
"direction_id": 1,
"amount_in": 100
}
🛠️ Параметры
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| body | body | object | true | none |
| » direction_id | body | integer | true | ID направления |
| » amount_in | body | number | true | Входящая сумма |
Example responses
200 Response
{
"amount_in": 100,
"amount_out": 7500,
"final_rate": 75,
"commission": 0,
"rate_provider_name": "Binance"
}
422 Response
{
"message": "Курс недоступен",
"errors": {}
}
🔁 Ответы
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | Результат расчёта | Inline |
| 422 | Unprocessable Entity | Курс недоступен или недостаточный резерв | Inline |
Response Schema
Status Code 200
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| » amount_in | number | false | none | none |
| » amount_out | number | false | none | none |
| » final_rate | number | false | none | none |
| » commission | number | false | none | none |
| » rate_provider_name | string¦null | false | none | none |
Status Code 422
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| » message | string | false | none | none |
| » errors | object | false | none | none |