申請報價
HTTP 請求
POST /v5/asset/exchange/quote-apply
請求參數
參數 | 是否必需 | 類型 | 說明 |
---|---|---|---|
fromCoin | true | string | 兌出幣種 |
toCoin | true | string | 兌入幣種 |
fromCoinType | false | string | crypto |
toCoinType | false | string | crypto |
requestCoin | true | string | 請求報價幣種, 和兌出幣種保持一致 |
requestAmount | true | string | 請求報價幣種數量 |
accountType | true | string | 帳戶類型 |
paramType | false | string | opFrom , 主要用於API broker |
paramValue | false | string | Broker ID, 主要用於API broker |
requestId | false | string | 自定義的請求ID |
響應參數
參數 | 類型 | 說明 |
---|---|---|
quoteTxId | string | 報價單號. 由系統生成, 用於後面的確認報價和查詢 |
exchangeRate | string | 兌換率 |
fromCoin | string | 兌出幣種 |
fromCoinType | string | 兌出幣種類型. crypto |
toCoin | string | 兌入幣種 |
toCoinType | string | 兌入幣種類型. crypto |
fromAmount | string | 兌出幣種數量 |
toAmount | string | 兌入幣種數量 |
expiredTime | string | 報價單過期的時間戳(有效期為15秒) |
requestId | string | 自定義請求ID |
請求示例
- 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);
});
響應示例
{
"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
}