Request a Quote
HTTP Request
POST /v5/asset/exchange/quote-apply
Request Parameters
Parameter | Required | Type | Comments |
---|---|---|---|
fromCoin | true | string | Convert from coin (coin to sell) |
toCoin | true | string | Convert to coin (coin to buy) |
fromCoinType | false | string | crypto |
toCoinType | false | string | crypto |
requestCoin | true | string | Request coin, same as fromCoin |
requestAmount | true | string | request coin amount (the amount you want to sell) |
accountType | true | string | Wallet type |
paramType | false | string | opFrom , mainly used for API broker user |
paramValue | false | string | Broker ID, mainly used for API broker user |
requestId | false | string | Customised request ID |
Response Parameters
Parameter | Type | Comments |
---|---|---|
quoteTxId | string | Quote transaction ID. It is system generated, and it is used to confirm quote and query the result of transaction |
exchangeRate | string | Exchange rate |
fromCoin | string | From coin |
fromCoinType | string | From coin type. crypto |
toCoin | string | To coin |
toCoinType | string | To coin type. crypto |
fromAmount | string | From coin amount (amount to sell) |
toAmount | string | To coin amount (amount to buy according to exchange rate) |
expiredTime | string | The expiry time for this quote (15 seconds) |
requestId | string | Customised request ID |
Request Example
- HTTP
- Python
- Node.js
POST /v5/asset/exchange/quote-apply HTTP/1.1
Host: api-testnet.bybit.com
X-BAPI-API-KEY: XXXXXX
X-BAPI-TIMESTAMP: 1720071077014
X-BAPI-RECV-WINDOW: 5000
X-BAPI-SIGN: XXXXXX
Content-Type: application/json
Content-Length: 172
{
"requestId": "test-00002",
"fromCoin": "ETH",
"toCoin": "BTC",
"accountType": "eb_convert_funding",
"requestCoin": "ETH",
"requestAmount": "0.1",
"paramType": "opFrom",
"paramValue": "broker-id-001"
}
const { RestClientV5 } = require('bybit-api');
const client = new RestClientV5({
testnet: true,
key: 'apikey',
secret: 'apisecret',
});
client
.requestConvertQuote({
requestId: 'test-00002',
fromCoin: 'ETH',
toCoin: 'BTC',
accountType: 'eb_convert_funding',
requestCoin: 'ETH',
requestAmount: '0.1',
})
.then((response) => {
console.log(response);
})
.catch((error) => {
console.error(error);
});
Response Example
{
"retCode": 0,
"retMsg": "ok",
"result": {
"quoteTxId": "10100108106409340067234418688",
"exchangeRate": "0.053517914861880000",
"fromCoin": "ETH",
"fromCoinType": "crypto",
"toCoin": "BTC",
"toCoinType": "crypto",
"fromAmount": "0.1",
"toAmount": "0.005351791486188000",
"expiredTime": "1720071092225",
"requestId": "test-00002"
},
"retExtInfo": {},
"time": 1720071077265
}