Execute Buy
Execute a buy order for prediction outcome tokens, paying USDC to receive outcome token shares.
info
- Must call Get Engine Status first to verify the engine is available
- Must call Get Event Detail to obtain
tokenIdand verify the market is open - Must call Get Order Estimate to preview the order
- Must display the estimate to the user and obtain explicit confirmation before calling this endpoint
- Phase 1 supports
orderType=1(FOK) only — orders that cannot be fully filled are cancelled - A
200response is an acknowledgment only — use Get Order List to check the final fill status
HTTP Request
POST/v5/alpha/prediction/buyRequest Parameters
| Parameter | Required | Type | Comments |
|---|---|---|---|
| tokenId | true | string | Outcome token ID to buy (from Get Event Detail) |
| amount | true | string | USDC amount to invest (positive decimal as string) |
| payTokenCode | true | string | Payment token code. Phase 1 fixed to USDC |
| orderType | true | integer | Order type. Refer to predictionOrderType. Phase 1: 1 (FOK) only |
| slippage | true | string | Maximum acceptable price slippage as decimal. 0.05 = 5% tolerance |
| eventId | true | string | Event ID associated with the token |
Response Parameters
| Parameter | Type | Comments |
|---|---|---|
| orderNo | string | Order number. Use with Get Order List to check fill status |
Request Example
- HTTP
- Python
- Node.js
POST /v5/alpha/prediction/buy HTTP/1.1
Host: api.bybit.com
X-BAPI-SIGN: XXXXXX
X-BAPI-API-KEY: xxxxxxxxxxxxxxxxxx
X-BAPI-TIMESTAMP: 1704067200000
X-BAPI-RECV-WINDOW: 5000
Content-Type: application/json
{
"tokenId": "token_yes_123",
"amount": "100",
"payTokenCode": "USDC",
"orderType": 1,
"slippage": "0.05",
"eventId": "event_123"
}
Response Example
{
"retCode": 0,
"retMsg": "OK",
"result": {
"orderNo": "ord_buy_20240101_001"
},
"retExtInfo": {},
"time": 1704067200000
}