diff --git a/docs/changelog/v5.mdx b/docs/changelog/v5.mdx index a8dfb7a424..4076271788 100644 --- a/docs/changelog/v5.mdx +++ b/docs/changelog/v5.mdx @@ -4,6 +4,11 @@ title: V5 import '/src/css/changelog.css'; +## 2026-09-02 +### REST API +- [Event Trading](../v5/event/introduction) [NEW] + - Launch Event Contract OpenAPI. Includes Market, Trade endpoints and WebSocket streams. + ## 2026-08-31 ### REST API - [Integration Guidance](../v5/guide#authentication) diff --git a/docs/v5/account/transaction-log.mdx b/docs/v5/account/transaction-log.mdx index efa0505703..10f8e70a39 100644 --- a/docs/v5/account/transaction-log.mdx +++ b/docs/v5/account/transaction-log.mdx @@ -16,7 +16,7 @@ Query for transaction logs in your Unified account. It supports up to 2 years wo | Parameter | Required | Type | Comments| |:----- |:-------|:-----|------ | |[accountType](../enum#accounttype) |false |string |Account Type. `UNIFIED`| -|[category](../enum#category) |false |string |Product type `spot`,`linear`,`option`,`inverse`| +|[category](../enum#category) |false |string |Product type `spot`,`linear`,`option`,`inverse`,`event`| |currency |false |string |Currency, uppercase only | |baseCoin |false |string |BaseCoin, uppercase only. e.g., BTC of BTCPERP| |[type](../enum#typeuta-translog) |false |string |Types of transaction logs| @@ -32,7 +32,7 @@ Query for transaction logs in your Unified account. It supports up to 2 years wo |list |array |Object | |> id |string |Unique id | |> symbol |string |Symbol name | -|> category |string |Product type | +|> category |string |Product type. `spot`,`linear`,`option`,`inverse`,`event`| |> side |string |Side. `Buy`,`Sell`,`None` | |> transactionTime |string |Transaction timestamp (ms)| |> [type](../enum#typeuta-translog) |string |Type | diff --git a/docs/v5/enum.mdx b/docs/v5/enum.mdx index d05092df57..4f189f71f3 100644 --- a/docs/v5/enum.mdx +++ b/docs/v5/enum.mdx @@ -437,7 +437,7 @@ _Options:_ * `TRANSFER_OUT` Assets that transferred out from Unified wallet * `TRADE` * `SETTLEMENT` USDT Perp funding settlement, and USDC Perp funding settlement + USDC 8-hour session settlement -* `DELIVERY` USDC Futures, Option delivery +* `DELIVERY` USDC Futures, Option delivery, Event Contract settlement * `LIQUIDATION` * `ADL` Auto-Deleveraging * `AIRDROP` diff --git a/docs/v5/event/.gitkeep b/docs/v5/event/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/v5/event/introduction.mdx b/docs/v5/event/introduction.mdx new file mode 100644 index 0000000000..67f6bb913d --- /dev/null +++ b/docs/v5/event/introduction.mdx @@ -0,0 +1,15 @@ +--- +title: Introduction +sidebar_label: Introduction +sidebar_position: 0 +--- + +## Overview + +Event Contract is a structured product offered by Bybit that allows users to trade on the outcome of market events with a defined payout structure. + +## Access + +:::caution +Only **market makers** are permitted to call the Event Contract OpenAPI endpoints. To apply for market maker access, please contact your **Relation Manager**. +::: diff --git a/docs/v5/event/market/.gitkeep b/docs/v5/event/market/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/v5/event/market/instrument-info.mdx b/docs/v5/event/market/instrument-info.mdx new file mode 100644 index 0000000000..1173d7ef4a --- /dev/null +++ b/docs/v5/event/market/instrument-info.mdx @@ -0,0 +1,240 @@ +--- +title: Get Instrument Info +sidebar_label: Get Instrument Info +sidebar_position: 1 +--- + +Query Event Contract instrument information with pagination support. + +### HTTP Request + + +### Request Parameters +| Parameter | Required | Type | Comments | +|:----------|:---------|:-----|:---------| +|symbol |false |string |Symbol name, e.g. `ETHUSDT-28AUG26-2450-2570-OUT`| +|status |false |string |`PreLaunch`, `Trading`, `Delivering`, `Closed`| +|limit |false |integer |Items per page. Default: `50`, range: [`1`, `100`]| +|cursor |false |string |Pagination cursor. Use `nextPageCursor` from the previous response| + +### Response Parameters +| Parameter | Type | Comments | +|:----------|:-----|:---------| +|nextPageCursor |string |Cursor for next page| +|list |array |Instrument list| +|> symbol |string |Symbol name| +|> symbolId |integer |Symbol ID| +|> baseCoin |string |Base coin| +|> quoteCoin |string |Quote coin| +|> settleCoin |string |Settle coin| +|> eventContractType |string |Event Contract type: `Up_Down`, `Target`, `Range`| +|> durationWindow |string |Duration window in seconds. Empty string for non-Up_Down types| +|> rvThreshold |string |Volatility threshold| +|> rebate |string |Rebate rate. `0` for Up_Down type| +|> takerFeeRate |string |Taker fee rate| +|> makerFeeRate |string |Maker fee rate| +|> launchTime |string |Launch time in milliseconds| +|> deliveryTime |string |Delivery time in milliseconds| +|> status |string |Symbol status: `PreLaunch`, `Trading`, `Delivering`, `Closed`| +|> targetPrice |string |Target price. Target type only. `"0"` for Up_Down and Range| +|> lowerBound |string |[Range only] Lower bound of the range (exclusive). If the price is below this value, Range Out wins. `"0"` for Up_Down and Target| +|> upperBound |string |[Range only] Upper bound of the range (exclusive). If the price is above this value, Range Out wins. `"0"` for Up_Down and Target| +|> callOptionSymbolId |integer |Maps to the corresponding Call option symbolId. (1) Range upper bound: call option symbolId for the upper bound Strike; (2) Target ABOVE: call option symbolId for the Strike; (3) Up_Down and Target BELOW: `0`| +|> putOptionSymbolId |integer |Maps to the corresponding Put option symbolId. (1) Range lower bound: put option symbolId for the lower bound Strike; (2) Target BELOW: put option symbolId for the Strike; (3) Up_Down and Target ABOVE: `0`| +|> feeRateRule |array |Fee rate config| +|>> minSecToDelivery |integer |Interval start — seconds from now to settlement| +|>> maxSecToDelivery |integer |Interval end — seconds from now to settlement| +|>> baseMarkup |string |Base markup| +|> lotSizeFilter |object |Lot size config| +|>> minOrderAmount |string |Minimum order amount| +|>> maxOrderAmount |string |Maximum order amount| +|>> orderAmountTickSize |string |Order amount tick size| +|>> quoteMaxValidMs |integer |Maximum validity period for a single quote (milliseconds)| +|>> quoteMinIntervalPerUserMs |integer |Minimum interval between quote requests per UID (milliseconds)| +|> quotationLimit |array |Quotation limit config| +|>> minSecToDelivery |integer |Interval start — seconds from now to settlement| +|>> maxSecToDelivery |integer |Interval end — seconds from now to settlement| +|>> quoteMaxAmountPerUser |string |Maximum cumulative quote amount per UID| +|>> quoteMinAmountPerUser |string |Minimum cumulative quote amount per UID| +|>> quoteMinAmount |string |Minimum amount per single quote| + +--- + +### Request Example + +```http +GET /v5/event/instruments-info?status=Trading&limit=10 HTTP/1.1 +Host: api.bybit.com +``` + +### Response Example + +```json +{ + "retCode": 0, + "retMsg": "OK", + "result": { + "nextPageCursor": "0%2C10", + "list": [ + { + "symbolId": 500017, + "symbol": "BTCUSDT-15MIN-DOWN", + "baseCoin": "BTC", + "quoteCoin": "USDT", + "settleCoin": "USDT", + "eventContractType": "Up_Down", + "durationWindow": 900, + "rvThreshold": "0.60", + "rebate": "0", + "takerFeeRate": "0.0088", + "makerFeeRate": "0", + "launchTime": "1786000980000", + "deliveryTime": "1798779602000", + "status": "Trading", + "targetPrice": "0", + "lowerBound": "0", + "upperBound": "0", + "callOptionSymbolId": 0, + "putOptionSymbolId": 0, + "feeRateRule": [ + { + "minSecToDelivery": 0, + "maxSecToDelivery": 315360000, + "baseMarkup": "0.0600" + } + ], + "quotationLimit": [ + { + "minSecToDelivery": 0, + "maxSecToDelivery": 315360000, + "quoteMaxAmountPerUser": "20000", + "quoteMinAmountPerUser": "10000", + "quoteMinAmount": "50" + } + ], + "lotSizeFilter": { + "minOrderAmount": "5", + "maxOrderAmount": "800", + "orderAmountTickSize": "1", + "quoteMaxValidMs": 60000, + "quoteMinIntervalPerUserMs": 200 + } + }, + { + "symbolId": 500241, + "symbol": "ETHUSDT-22AUG26-1850-2000-OUT", + "baseCoin": "ETH", + "quoteCoin": "USDT", + "settleCoin": "USDT", + "eventContractType": "Range", + "durationWindow": "", + "rvThreshold": "0.62", + "rebate": "0.25", + "takerFeeRate": "0.008", + "makerFeeRate": "0", + "launchTime": "1787018820000", + "deliveryTime": "1787385600000", + "status": "Trading", + "targetPrice": "0", + "lowerBound": "1850", + "upperBound": "2000", + "callOptionSymbolId": 32101659, + "putOptionSymbolId": 32101656, + "feeRateRule": [ + { + "minSecToDelivery": 0, + "maxSecToDelivery": 259200, + "baseMarkup": "0.0230" + }, + { + "minSecToDelivery": 259200, + "maxSecToDelivery": 315360000, + "baseMarkup": "0.0180" + } + ], + "quotationLimit": [ + { + "minSecToDelivery": 0, + "maxSecToDelivery": 259200, + "quoteMaxAmountPerUser": "6000000", + "quoteMinAmountPerUser": "5000", + "quoteMinAmount": "500" + }, + { + "minSecToDelivery": 259200, + "maxSecToDelivery": 315360000, + "quoteMaxAmountPerUser": "990", + "quoteMinAmountPerUser": "3000", + "quoteMinAmount": "500" + } + ], + "lotSizeFilter": { + "minOrderAmount": "5", + "maxOrderAmount": "500", + "orderAmountTickSize": "1", + "quoteMaxValidMs": 6000000, + "quoteMinIntervalPerUserMs": 5000 + } + }, + { + "symbolId": 500239, + "symbol": "ETHUSDT-22AUG26-1850-BELOW", + "baseCoin": "ETH", + "quoteCoin": "USDT", + "settleCoin": "USDT", + "eventContractType": "Target", + "durationWindow": "", + "rvThreshold": "0.62", + "rebate": "0.25", + "takerFeeRate": "0.008", + "makerFeeRate": "0", + "launchTime": "1787051280000", + "deliveryTime": "1787385600000", + "status": "Trading", + "targetPrice": "1850", + "lowerBound": "0", + "upperBound": "0", + "callOptionSymbolId": 0, + "putOptionSymbolId": 32101656, + "feeRateRule": [ + { + "minSecToDelivery": 0, + "maxSecToDelivery": 259200, + "baseMarkup": "0.0230" + }, + { + "minSecToDelivery": 259200, + "maxSecToDelivery": 315360000, + "baseMarkup": "0.0180" + } + ], + "quotationLimit": [ + { + "minSecToDelivery": 0, + "maxSecToDelivery": 259200, + "quoteMaxAmountPerUser": "990000", + "quoteMinAmountPerUser": "5000", + "quoteMinAmount": "500" + }, + { + "minSecToDelivery": 259200, + "maxSecToDelivery": 315360000, + "quoteMaxAmountPerUser": "9000000", + "quoteMinAmountPerUser": "3000", + "quoteMinAmount": "500" + } + ], + "lotSizeFilter": { + "minOrderAmount": "5", + "maxOrderAmount": "500", + "orderAmountTickSize": "1", + "quoteMaxValidMs": 6000000, + "quoteMinIntervalPerUserMs": 5000 + } + } + ] + }, + "retExtInfo": {}, + "time": 1787108703481 +} +``` diff --git a/docs/v5/event/market/orderbook.mdx b/docs/v5/event/market/orderbook.mdx new file mode 100644 index 0000000000..f127c7574a --- /dev/null +++ b/docs/v5/event/market/orderbook.mdx @@ -0,0 +1,58 @@ +--- +title: Get Orderbook +sidebar_label: Get Orderbook +sidebar_position: 2 +--- + +Query 25-level orderbook data for an Event Contract symbol. + +### HTTP Request + + +### Request Parameters +| Parameter | Required | Type | Comments | +|:----------|:---------|:-----|:---------| +|symbol |**true** |string |Symbol name, e.g. `ETHUSDT-28AUG26-2450-2570-OUT`| + +### Response Parameters +| Parameter | Type | Comments | +|:----------|:-----|:---------| +|s |string |Symbol name| +|r |array |Orderbook entries. Up to 25 levels. Each entry is `[payoutRatio, orderValue]`| +|ts |integer |Matching engine timestamp in milliseconds| +|u |integer |Update ID| +|seq |integer |Cross sequence number| +|cts |integer |Creation timestamp in milliseconds| + +--- + +### Request Example + +```http +GET /v5/event/orderbook?symbol=ETHUSDT-28AUG26-2450-2570-OUT HTTP/1.1 +Host: api.bybit.com +``` + +### Response Example + +```json +{ + "retCode": 0, + "retMsg": "OK", + "result": { + "s": "BTCUSDT-5MIN-UP", + "r": [ + [ + "0.90", + "50000" + ] + ], + "ts": 1716863719031, + "u": 230704, + "seq": 1432604333, + "cts": 1716863718905 + }, + "retExtInfo": {}, + "time": 1716863719382 +} +``` diff --git a/docs/v5/event/trade/.gitkeep b/docs/v5/event/trade/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/v5/event/trade/cancel-quote.mdx b/docs/v5/event/trade/cancel-quote.mdx new file mode 100644 index 0000000000..ebc079ce6d --- /dev/null +++ b/docs/v5/event/trade/cancel-quote.mdx @@ -0,0 +1,60 @@ +--- +title: Cancel Quote +sidebar_label: Cancel Quote +sidebar_position: 7 +--- + +Cancel a submitted Event Contract quote. + +:::info +* Only **Event Contract maker accounts** are allowed to access this endpoint. +::: + +### HTTP Request + + +### Request Parameters +| Parameter | Required | Type | Comments | +|:----------|:---------|:-----|:---------| +|orderLinkId |false |string |User-defined order ID (Quote ID)| +|orderId |false |string |Order ID| + +### Response Parameters +| Parameter | Type | Comments | +|:----------|:-----|:---------| +|orderLinkId |string |User-defined order ID| +|orderId |string |Order ID| + +--- + +### Request Example + +```http +POST /v5/event/cancel HTTP/1.1 +Host: api.bybit.com +X-BAPI-SIGN: XXXXX +X-BAPI-API-KEY: xxxxxxxxxxxxxxxxxx +X-BAPI-TIMESTAMP: 1694402559000 +X-BAPI-RECV-WINDOW: 5000 +Content-Type: application/json + +{ + "orderLinkId": "xxxxxx", + "orderId": "xxxxxxxxxxefffff" +} +``` + +### Response Example + +```json +{ + "retCode": 0, + "retMsg": "OK", + "result": { + "orderLinkId": "xxxxxx", + "orderId": "xxxxxxxxxxefffff" + }, + "retExtInfo": {}, + "time": 1672217377164 +} +``` diff --git a/docs/v5/event/trade/execution.mdx b/docs/v5/event/trade/execution.mdx new file mode 100644 index 0000000000..01758d82cd --- /dev/null +++ b/docs/v5/event/trade/execution.mdx @@ -0,0 +1,117 @@ +--- +title: Get Event Contract Trade History +sidebar_label: Get Event Contract Trade History +sidebar_position: 5 +--- + +Query Event Contract trade (execution) records. Returns records in the past 2 years. + +:::info +* Only **Event Contract maker accounts** are allowed to access this endpoint. +* Default query window: **7 days** if `startTime`/`endTime` are not specified. +::: + +### HTTP Request + + +### Request Parameters +| Parameter | Required | Type | Comments | +|:----------|:---------|:-----|:---------| +|symbol |**true** |string |Symbol name, e.g. `ETHUSDT-28AUG26-2450-2570-OUT`| +|orderId |false |string |Order ID filter| +|orderLinkId |false |string |User-defined order ID| +|startTime |false |integer |Start time in milliseconds. Default: 7 days ago| +|endTime |false |integer |End time in milliseconds. Default: now| +|limit |false |integer |Number of items per page. Default: `50`, Range: [`1`, `100`]| +|cursor |false |string |Pagination cursor| + +### Response Parameters +| Parameter | Type | Comments | +|:----------|:-----|:---------| +|list |array |Event Contract trade record list| +|> orderId |string |Order ID| +|> orderLinkId |string |User-defined order ID| +|> execId |string |Execution ID| +|> symbol |string |Symbol name| +|> baseCoin |string |Base coin| +|> settleCoin |string |Settle coin| +|> side |string |Side: `Buy` or `Sell`| +|> [execType](../../../enum#exectype) |string |Execution type: `Trade`, `Settle`| +|> execPrice |string |Execution price (payout ratio)| +|> execValue |string |Execution value| +|> execFee |string |Execution fee| +|> execFeeRate |string |Execution fee rate| +|> orderPrice |string |Order price| +|> feeCoin |string |Fee coin| +|> transTime |string |Transaction time in milliseconds| +|> [timeInForce](../../../enum#timeinforce) |string |Time in force, e.g. `GTC`, `IOC`, `FOK`| +|> crossSeq |string |Cross sequence number| +|> ecPayout |string |Event Contract payout (settlement payout for this execution)| +|> ecDurationWindow |string |Duration window in seconds| +|> settleTimeMs |string |Settlement time in milliseconds| +|> ecOrderValue |string |Event Contract order value| +|> ecContractType |string |Event contract type: `UpDown`, `Target`, `Range`| +|> ecDirection |string |Direction: `UP`/`DOWN` (UpDown type), `ABOVE`/`BELOW` (Target type), `RANGE_IN`/`RANGE_OUT` (Range type)| +|> ecTargetPrice |string |Target price. Target type only.| +|> ecLowerBound |string |Lower bound. Range type only.| +|> ecUpperBound |string |Upper bound. Range type only.| +|> extraFees |string |Extra fees (JSON string if applicable)| +|cursor |string |Cursor for next page pagination| + +--- + +### Request Example + +```http +GET /v5/event/trades?symbol=ETHUSDT-28AUG26-2450-2570-OUT&limit=50 HTTP/1.1 +Host: api.bybit.com +X-BAPI-SIGN: XXXXX +X-BAPI-API-KEY: xxxxxxxxxxxxxxxxxx +X-BAPI-TIMESTAMP: 1694402559000 +X-BAPI-RECV-WINDOW: 5000 +``` + +### Response Example + +```json +{ + "retCode": 0, + "retMsg": "OK", + "result": { + "list": [ + { + "orderId": "1234567890", + "orderLinkId": "my-order-001", + "execId": "exec-001", + "symbol": "ETHUSDT-28AUG26-2450-2570-OUT", + "baseCoin": "BTC", + "settleCoin": "USDT", + "side": "Buy", + "execType": "Trade", + "execPrice": "1.95", + "execValue": "50", + "execFee": "0.5", + "execFeeRate": "0.01", + "orderPrice": "1.95", + "feeCoin": "USDT", + "transTime": "1694402559843", + "timeInForce": "GTC", + "crossSeq": "31413030", + "ecPayout": "0", + "ecDurationWindow": "300", + "settleTimeMs": "1694515498753", + "ecOrderValue": "50", + "ecContractType": "UpDown", + "ecDirection": "UP", + "ecTargetPrice": "", + "ecLowerBound": "", + "ecUpperBound": "", + "extraFees": "" + } + ], + "cursor": "" + }, + "retExtInfo": {}, + "time": 1694402560000 +} +``` diff --git a/docs/v5/event/trade/open-order.mdx b/docs/v5/event/trade/open-order.mdx new file mode 100644 index 0000000000..2d4111927c --- /dev/null +++ b/docs/v5/event/trade/open-order.mdx @@ -0,0 +1,106 @@ +--- +title: Get Event Contract Active Orders +sidebar_label: Get Event Contract Active Orders +sidebar_position: 2 +--- + +Query real-time unfilled or partially filled Event Contract orders. + +:::info +* Only **Event Contract maker accounts** are allowed to access this endpoint. +::: + +### HTTP Request + + +### Request Parameters +| Parameter | Required | Type | Comments | +|:----------|:---------|:-----|:---------| +|symbol |false |string |Symbol name, e.g. `ETHUSDT-28AUG26-2450-2570-OUT`| +|orderId |false |string |Order ID. If both `orderId` and `orderLinkId` are passed, `orderId` takes priority| +|orderLinkId |false |string |User-defined order ID| +|limit |false |integer |Number of items per page. Default: `20`, Range: [`1`, `50`]| +|cursor |false |string |Pagination cursor. Use `nextPageCursor` from the response to retrieve the next page| + +### Response Parameters +| Parameter | Type | Comments | +|:----------|:-----|:---------| +|list |array |Event Contract active order list| +|> orderId |string |Order ID| +|> orderLinkId |string |User-defined order ID| +|> symbol |string |Symbol name| +|> symbolId |string |Symbol ID| +|> side |string |Order side: `Buy` or `Sell`| +|> orderStatus |string |Order status: `New` (order created), `PartiallyFilled` (partially filled), `Untriggered` (awaiting trigger)| +|> payoutRatio |string |Order payout ratio (price)| +|> cumExecValue |string |Cumulative executed value| +|> cumExecFee |string |Cumulative executed fee| +|> leavesValue |string |Remaining order value| +|> ecContractType |string |Event contract type: `UpDown`, `Target`, `Range`| +|> ecDirection |string |Direction: `UP`/`DOWN` (UpDown type), `ABOVE`/`BELOW` (Target type), `RANGE_IN`/`RANGE_OUT` (Range type)| +|> ecOrderValue |string |Event Contract order value| +|> ecSettleTime |string |Expected settlement time in milliseconds| +|> ecTargetPrice |string |Target price. Target type only.| +|> ecLowerBound |string |Lower bound. Range type only.| +|> ecUpperBound |string |Upper bound. Range type only.| +|> ecDurationWindow |string |Duration window in seconds| +|> ecIndexPrice |string |Index price at order creation| +|> orderAvgPayoutRatio |string |Average payout ratio of filled portion| +|> createType |string |Order create type, e.g. `CreateByUser`| +|> createdTime |string |Order creation timestamp in milliseconds| +|> updatedTime |string |Order update timestamp in milliseconds| +|nextPageCursor |string |Cursor for next page pagination| + +--- + +### Request Example + +```http +GET /v5/event/order-realtime?symbol=ETHUSDT-28AUG26-2450-2570-OUT&limit=20 HTTP/1.1 +Host: api.bybit.com +X-BAPI-SIGN: XXXXX +X-BAPI-API-KEY: xxxxxxxxxxxxxxxxxx +X-BAPI-TIMESTAMP: 1694402559000 +X-BAPI-RECV-WINDOW: 5000 +``` + +### Response Example + +```json +{ + "retCode": 0, + "retMsg": "OK", + "result": { + "list": [ + { + "orderId": "1234567890", + "orderLinkId": "my-order-001", + "symbol": "ETHUSDT-28AUG26-2450-2570-OUT", + "symbolId": "100001", + "side": "Buy", + "orderStatus": "New", + "payoutRatio": "1.95", + "cumExecValue": "0", + "cumExecFee": "0", + "leavesValue": "50", + "ecContractType": "UpDown", + "ecDirection": "UP", + "ecOrderValue": "50", + "ecSettleTime": "1694515498753", + "ecTargetPrice": "", + "ecLowerBound": "", + "ecUpperBound": "", + "ecDurationWindow": "300", + "ecIndexPrice": "26000.5", + "orderAvgPayoutRatio": "0", + "createType": "CreateByUser", + "createdTime": "1694402559843", + "updatedTime": "1694402559843" + } + ], + "nextPageCursor": "" + }, + "retExtInfo": {}, + "time": 1694402560000 +} +``` diff --git a/docs/v5/event/trade/order-list.mdx b/docs/v5/event/trade/order-list.mdx new file mode 100644 index 0000000000..b6f70586b3 --- /dev/null +++ b/docs/v5/event/trade/order-list.mdx @@ -0,0 +1,124 @@ +--- +title: Get Event Contract Order History +sidebar_label: Get Event Contract Order History +sidebar_position: 1 +--- + +Query Event Contract historical orders. Returns orders in the past 2 years. + +:::info +* Only **Event Contract maker accounts** are allowed to access this endpoint. +* Results are sorted by `createdTime` in descending order. +* Default query window: **7 days** if `startTime`/`endTime` are not specified. +::: + +### HTTP Request + + +### Request Parameters +| Parameter | Required | Type | Comments | +|:----------|:---------|:-----|:---------| +|symbol |false |string |Symbol name, e.g. `ETHUSDT-28AUG26-2450-2570-OUT`| +|orderId |false |string |Order ID| +|orderLinkId |false |string |User-defined order ID| +|startTime |false |integer |Start time in milliseconds. Default: 7 days ago| +|endTime |false |integer |End time in milliseconds. Default: now| +|limit |false |integer |Number of items per page. Default: `50`, Range: [`1`, `100`]| +|cursor |false |string |Pagination cursor| + +### Response Parameters +| Parameter | Type | Comments | +|:----------|:-----|:---------| +|list |array |Event Contract order history list| +|> orderId |string |Order ID| +|> orderLinkId |string |User-defined order ID| +|> orderStatus |string |Order status: `Filled`, `Cancelled`, `Rejected`, `PartiallyFilledCanceled`| +|> symbol |string |Symbol name| +|> symbolId |string |Symbol ID| +|> baseCoin |string |Base coin| +|> quoteCoin |string |Quote coin| +|> settleCoin |string |Settle coin| +|> ecDirection |string |Direction: `UP`/`DOWN` (UpDown type), `ABOVE`/`BELOW` (Target type), `RANGE_IN`/`RANGE_OUT` (Range type)| +|> ecDurationWindow |string |Duration window in seconds| +|> ecTargetPrice |string |Target price. Target type only.| +|> ecContractType |string |Event contract type: `UpDown`, `Target`, `Range`| +|> ecLowerBound |string |Lower bound. Range type only.| +|> ecUpperBound |string |Upper bound. Range type only.| +|> settleTimeMs |string |Settlement time in milliseconds| +|> ecOrderValue |string |Event Contract order value| +|> ecIndexPrice |string |Index price at order creation| +|> orderAvgPayoutRatio |string |Average payout ratio of filled portion| +|> cumExecValue |string |Cumulative executed value| +|> payoutRatio |string |Order payout ratio (price)| +|> tradeFee |string |Trade fee| +|> transTime |string |Transaction time in milliseconds| +|> createTime |string |Order creation time in milliseconds| +|> updateTime |string |Order update time in milliseconds| +|> cumPayout |string |Cumulative payout| +|> cumExecFee |string |Cumulative executed fee| +|> cancelType |string |Cancel type. Empty if not cancelled.| +|> createType |string |Order create type, e.g. `CreateByUser`| +|> rejectReason |string |Reject reason. Empty if not rejected.| +|> extraFees |string |Extra fees (JSON string if applicable)| +|cursor |string |Cursor for next page pagination| + +--- + +### Request Example + +```http +GET /v5/event/order-list?symbol=ETHUSDT-28AUG26-2450-2570-OUT&limit=50 HTTP/1.1 +Host: api.bybit.com +X-BAPI-SIGN: XXXXX +X-BAPI-API-KEY: xxxxxxxxxxxxxxxxxx +X-BAPI-TIMESTAMP: 1694402559000 +X-BAPI-RECV-WINDOW: 5000 +``` + +### Response Example + +```json +{ + "retCode": 0, + "retMsg": "OK", + "result": { + "list": [ + { + "orderId": "1234567890", + "orderLinkId": "", + "orderStatus": "Filled", + "symbol": "ETHUSDT-28AUG26-2450-2570-OUT", + "symbolId": "100001", + "baseCoin": "BTC", + "quoteCoin": "USDT", + "settleCoin": "USDT", + "ecDirection": "UP", + "ecDurationWindow": "300", + "ecTargetPrice": "", + "ecContractType": "UpDown", + "ecLowerBound": "", + "ecUpperBound": "", + "settleTimeMs": "1694515498753", + "ecOrderValue": "50", + "ecIndexPrice": "26000.5", + "orderAvgPayoutRatio": "1.85", + "cumExecValue": "50", + "payoutRatio": "1.95", + "tradeFee": "0.5", + "transTime": "1694402559843", + "createTime": "1694402559843", + "updateTime": "1694515498753", + "cumPayout": "92.5", + "cumExecFee": "0.5", + "cancelType": "", + "createType": "CreateByUser", + "rejectReason": "", + "extraFees": "" + } + ], + "cursor": "" + }, + "retExtInfo": {}, + "time": 1694402560000 +} +``` diff --git a/docs/v5/event/trade/position.mdx b/docs/v5/event/trade/position.mdx new file mode 100644 index 0000000000..fb1addf883 --- /dev/null +++ b/docs/v5/event/trade/position.mdx @@ -0,0 +1,86 @@ +--- +title: Get Event Contract Position Info +sidebar_label: Get Event Contract Position Info +sidebar_position: 3 +--- + +Query real-time Event Contract position data. Covers UpDown, Target, and Range contract types. + +:::info +* Only **Event Contract maker accounts** are allowed to access this endpoint. +::: + +### HTTP Request + + +### Request Parameters +| Parameter | Required | Type | Comments | +|:----------|:---------|:-----|:---------| +|symbol |false |string |Symbol name, e.g. `ETHUSDT-28AUG26-2450-2570-OUT`. If not passed, returns all Event Contract positions| +|baseCoin |false |string |Base coin filter, e.g. `BTC`| +|settleCoin |false |string |Settle coin filter, e.g. `USDT`| +|limit |false |integer |Number of items per page. Default: `20`, Range: [`1`, `50`]| +|cursor |false |string |Pagination cursor. Use `nextPageCursor` from the response to retrieve the next page| + +### Response Parameters +| Parameter | Type | Comments | +|:----------|:-----|:---------| +|list |array |Event Contract position list| +|> symbol |string |Symbol name| +|> baseCoin |string |Base coin| +|> settleCoin |string |Settle coin| +|> side |string |Position side: `Buy` (long), `Sell` (short)| +|> ecContractType |string |Event contract type: `UpDown`, `Target`, `Range`| +|> ecDirection |string |Direction: `UP`/`DOWN` (UpDown type), `ABOVE`/`BELOW` (Target type), `RANGE_IN`/`RANGE_OUT` (Range type)| +|> avgPayoutRatio |string |Average payout ratio| +|> positionValue |string |Position value (cumulative executed value)| +|> ecSettleTime |string |Expected settlement time in milliseconds| +|> cumClosedPnl |string |Cumulative settled profit and loss| +|> createdTime |string |Position creation timestamp in milliseconds| +|> updatedTime |string |Position update timestamp in milliseconds| +|> seq |long |Cross sequence number for ordering| +|nextPageCursor |string |Cursor for next page pagination| + +--- + +### Request Example + +```http +GET /v5/event/positions?symbol=ETHUSDT-28AUG26-2450-2570-OUT&limit=20 HTTP/1.1 +Host: api.bybit.com +X-BAPI-SIGN: XXXXX +X-BAPI-API-KEY: xxxxxxxxxxxxxxxxxx +X-BAPI-TIMESTAMP: 1694402559000 +X-BAPI-RECV-WINDOW: 5000 +``` + +### Response Example + +```json +{ + "retCode": 0, + "retMsg": "OK", + "result": { + "list": [ + { + "symbol": "ETHUSDT-28AUG26-2450-2570-OUT", + "baseCoin": "BTC", + "settleCoin": "USDT", + "side": "Buy", + "ecContractType": "UpDown", + "ecDirection": "UP", + "avgPayoutRatio": "1.85", + "positionValue": "100", + "ecSettleTime": "1694515498753", + "cumClosedPnl": "50.5", + "createdTime": "1694402559843", + "updatedTime": "1694515498753", + "seq": 31413030 + } + ], + "nextPageCursor": "" + }, + "retExtInfo": {}, + "time": 1694402560000 +} +``` diff --git a/docs/v5/event/trade/settlement.mdx b/docs/v5/event/trade/settlement.mdx new file mode 100644 index 0000000000..15486f95a6 --- /dev/null +++ b/docs/v5/event/trade/settlement.mdx @@ -0,0 +1,106 @@ +--- +title: Get Event Contract Settlement Records +sidebar_label: Get Event Contract Settlement Records +sidebar_position: 4 +--- + +Query Event Contract settlement records. Returns records in the past 2 years. + +:::info +* Only **Event Contract maker accounts** are allowed to access this endpoint. +* Default query window: **7 days** if `startTime`/`endTime` are not specified. +::: + +### HTTP Request + + +### Request Parameters +| Parameter | Required | Type | Comments | +|:----------|:---------|:-----|:---------| +|symbol |**true** |string |Symbol name, e.g. `ETHUSDT-28AUG26-2450-2570-OUT`| +|orderId |false |string |Order ID filter| +|startTime |false |integer |Start time in milliseconds. Default: 7 days ago| +|endTime |false |integer |End time in milliseconds. Default: now| +|limit |false |integer |Number of items per page. Default: `50`, Range: [`1`, `100`]| +|cursor |false |string |Pagination cursor| + +### Response Parameters +| Parameter | Type | Comments | +|:----------|:-----|:---------| +|list |array |Event Contract settlement record list| +|> transId |string |Transaction ID| +|> symbol |string |Symbol name| +|> symbolId |string |Symbol ID| +|> baseCoin |string |Base coin| +|> settleCoin |string |Settle coin| +|> side |string |Side: `Buy` or `Sell`| +|> ecContractType |string |Event contract type: `UpDown`, `Target`, `Range`| +|> ecDirection |string |Direction: `UP`/`DOWN` (UpDown type), `ABOVE`/`BELOW` (Target type), `RANGE_IN`/`RANGE_OUT` (Range type)| +|> settlePrice |string |Settlement price| +|> entryPrice |string |Entry price| +|> grossPayoutRatio |string |Gross payout ratio| +|> ecDurationWindow |string |Duration window in seconds| +|> ecTargetPrice |string |Target price. Target type only.| +|> ecLowerBound |string |Lower bound. Range type only.| +|> ecUpperBound |string |Upper bound. Range type only.| +|> transTime |string |Transaction time in milliseconds| +|> crossSeq |string |Cross sequence number| +|> execFee |string |Execution fee| +|> execFeeRate |string |Execution fee rate| +|> payout |string |Settlement payout amount| +|> sessionRpl |string |Session realised PnL| +|> orderId |string |Related order ID| +|cursor |string |Cursor for next page pagination| + +--- + +### Request Example + +```http +GET /v5/event/settlements?symbol=ETHUSDT-28AUG26-2450-2570-OUT&limit=50 HTTP/1.1 +Host: api.bybit.com +X-BAPI-SIGN: XXXXX +X-BAPI-API-KEY: xxxxxxxxxxxxxxxxxx +X-BAPI-TIMESTAMP: 1694402559000 +X-BAPI-RECV-WINDOW: 5000 +``` + +### Response Example + +```json +{ + "retCode": 0, + "retMsg": "OK", + "result": { + "list": [ + { + "transId": "tx-001", + "symbol": "ETHUSDT-28AUG26-2450-2570-OUT", + "symbolId": "100001", + "baseCoin": "BTC", + "settleCoin": "USDT", + "side": "Buy", + "ecContractType": "UpDown", + "ecDirection": "UP", + "settlePrice": "26500", + "entryPrice": "26000.5", + "grossPayoutRatio": "1.85", + "ecDurationWindow": "300", + "ecTargetPrice": "", + "ecLowerBound": "", + "ecUpperBound": "", + "transTime": "1694515498753", + "crossSeq": "31413030", + "execFee": "0.5", + "execFeeRate": "0.01", + "payout": "92.5", + "sessionRpl": "42.5", + "orderId": "1234567890" + } + ], + "cursor": "" + }, + "retExtInfo": {}, + "time": 1694402560000 +} +``` diff --git a/docs/v5/event/trade/submit-quote.mdx b/docs/v5/event/trade/submit-quote.mdx new file mode 100644 index 0000000000..169033ccab --- /dev/null +++ b/docs/v5/event/trade/submit-quote.mdx @@ -0,0 +1,64 @@ +--- +title: Submit Quote +sidebar_label: Submit Quote +sidebar_position: 6 +--- + +Submit a payout ratio quote for an Event Contract symbol. + +:::info +* Only **Event Contract maker accounts** are allowed to access this endpoint. +::: + +### HTTP Request + + +### Request Parameters +| Parameter | Required | Type | Comments | +|:----------|:---------|:-----|:---------| +|symbol |**true** |string |Symbol name, e.g. `ETHUSDT-28AUG26-2450-2570-OUT`| +|orderLinkId |**true** |string |User-defined order ID| +|grossPayoutRatio |**true** |string |Gross payout ratio reported by the institution| +|amount |**true** |string |Amount for this quote (settle coin)| + +### Response Parameters +| Parameter | Type | Comments | +|:----------|:-----|:---------| +|orderLinkId |string |User-defined order ID| +|orderId |string |Order ID| + +--- + +### Request Example + +```http +POST /v5/event/quotes HTTP/1.1 +Host: api.bybit.com +X-BAPI-SIGN: XXXXX +X-BAPI-API-KEY: xxxxxxxxxxxxxxxxxx +X-BAPI-TIMESTAMP: 1694402559000 +X-BAPI-RECV-WINDOW: 5000 +Content-Type: application/json + +{ + "orderLinkId": "xxxx", + "symbol": "ETHUSDT-28AUG26-2450-2570-OUT", + "grossPayoutRatio": "0.5", + "amount": "100" +} +``` + +### Response Example + +```json +{ + "retCode": 0, + "retMsg": "OK", + "result": { + "orderLinkId": "xxxxxx", + "orderId": "xxxxxxxxxxefffff" + }, + "retExtInfo": {}, + "time": 1672217377164 +} +``` diff --git a/docs/v5/event/websocket/.gitkeep b/docs/v5/event/websocket/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/v5/event/websocket/private/execution.mdx b/docs/v5/event/websocket/private/execution.mdx new file mode 100644 index 0000000000..922db1db51 --- /dev/null +++ b/docs/v5/event/websocket/private/execution.mdx @@ -0,0 +1,117 @@ +--- +title: Execution +sidebar_label: Execution +sidebar_position: 2 +--- + +Subscribe to the `execution` or `execution.event` topic to receive real-time Event Contract execution (trade) updates. + +**Topic:** `execution` / `execution.event` + +:::info +* Authentication is required before subscribing to private topics. +* Pushed when an Event Contract order is filled (fully or partially). +::: + +### Response Parameters +| Parameter | Type | Comments | +|:----------|:-----|:---------| +|id |string |Message ID| +|topic |string |Topic name| +|creationTime |number |Data created timestamp (ms)| +|data |array |Object| +|> category |string |Product type. `event`| +|> transId |string |Transaction ID| +|> execId |string |Execution ID| +|> orderId |string |Order ID| +|> orderLinkId |string |User-defined order ID| +|> symbol |string |Symbol name| +|> symbolId |integer |Symbol ID| +|> baseCoin |string |Base coin| +|> quoteCoin |string |Quote coin| +|> settleCoin |string |Settle coin| +|> side |string |Side: `Buy` or `Sell`| +|> feeCoin |string |Fee coin| +|> [execType](../../../../enum#exectype) |string |Execution type: `Trade`, `Settle`| +|> execPrice |string |Execution price (payout ratio)| +|> execValue |string |Execution value| +|> execFee |string |Execution fee| +|> execFeeRate |string |Execution fee rate| +|> orderPrice |string |Order price| +|> ecContractType |integer |Event contract type| +|> ecDirection |integer |Direction| +|> ecDurationWindow |integer |Duration window in seconds| +|> ecTargetPrice |string |Target price. Target type only.| +|> ecLowerBound |string |Lower bound. Range type only.| +|> ecUpperBound |string |Upper bound. Range type only.| +|> ecOrderValue |string |Event Contract order value| +|> ecIndexPrice |string |Index price at execution| +|> ecPayout |string |Event Contract payout amount for this execution| +|> entryPrice |string |Entry price| +|> settlePrice |string |Settlement price| +|> grossPayoutRatio |string |Gross payout ratio| +|> sessionRpl |string |Session realised PnL| +|> transTime |string |Transaction time in milliseconds| +|> settleTimeMs |string |Settlement time in milliseconds| +|> crossSeq |string |Cross sequence number| +|> [timeInForce](../../../../enum#timeinforce) |string |Time in force, e.g. `GoodTillCancel`| +|> extraFees |array |Extra fees| + +### Subscribe Example +```json +{ + "op": "subscribe", + "args": [ + "execution" + ] +} +``` + +### Stream Example + +```json +{ + "topic": "execution", + "id": "1509583_ETHUSDT-5MIN-UP_1311", + "creationTime": 1787635282379, + "data": [ + { + "category": "event", + "transId": "0176bba4-66fa-542b-af33-cea000a83dc0", + "execId": "0176bba4-66fa-542b-af33-cea000a83dc0", + "orderId": "746a6c87-a6dd-4008-8889-37e694046681", + "orderLinkId": "cjm1119", + "symbol": "ETHUSDT-5MIN-UP", + "symbolId": 500000, + "baseCoin": "ETH", + "quoteCoin": "USDT", + "settleCoin": "USDT", + "side": "Sell", + "feeCoin": "USDT", + "execType": "Trade", + "execPrice": "3.5", + "execValue": "100", + "execFee": "4.28571429", + "execFeeRate": "0.04285715", + "orderPrice": "3.5", + "ecContractType": 1, + "ecDirection": 1, + "ecDurationWindow": 300, + "ecTargetPrice": "", + "ecLowerBound": "", + "ecUpperBound": "", + "ecOrderValue": "5000", + "ecPayout": "350", + "entryPrice": "3.5", + "settlePrice": "2503.50730825", + "grossPayoutRatio": "3.5", + "sessionRpl": "0", + "transTime": "1787635282374", + "settleTimeMs": "1787635582374", + "crossSeq": "1311", + "timeInForce": "GoodTillCancel", + "extraFees": [] + } + ] +} +``` diff --git a/docs/v5/event/websocket/private/order.mdx b/docs/v5/event/websocket/private/order.mdx new file mode 100644 index 0000000000..0025bda3b3 --- /dev/null +++ b/docs/v5/event/websocket/private/order.mdx @@ -0,0 +1,110 @@ +--- +title: Order +sidebar_label: Order +sidebar_position: 3 +--- + +Subscribe to the `order` or `order.event` topic to receive real-time Event Contract order updates. + +**Topic:** `order` / `order.event` + +:::info +* Authentication is required before subscribing to private topics. +* Pushed when an Event Contract order status changes (e.g., filled, partially filled, cancelled). +::: + +### Response Parameters +| Parameter | Type | Comments | +|:----------|:-----|:---------| +|id |string |Message ID| +|topic |string |Topic name| +|creationTime |number |Data created timestamp (ms)| +|data |array |Object| +|> category |string |Product type. `event`| +|> orderId |string |Order ID| +|> orderLinkId |string |User-defined order ID| +|> symbol |string |Symbol name| +|> symbolId |integer |Symbol ID| +|> side |string |Side: `Buy` or `Sell`| +|> baseCoin |string |Base coin| +|> quoteCoin |string |Quote coin| +|> settleCoin |string |Settle coin| +|> orderStatus |string |Order status: `New`, `PartiallyFilled`, `Filled`, `Cancelled`, `Rejected`| +|> ecContractType |string |Event contract type: `UpDown`, `Target`, `Range`| +|> ecDirection |string |Direction: `UP`/`DOWN` (UpDown type), `ABOVE`/`BELOW` (Target type), `RANGE_IN`/`RANGE_OUT` (Range type)| +|> ecDurationWindow |integer |Duration window in seconds| +|> ecTargetPrice |string |Target price. Target type only.| +|> ecLowerBound |string |Lower bound. Range type only.| +|> ecUpperBound |string |Upper bound. Range type only.| +|> ecOrderValue |string |Event Contract order value| +|> ecIndexPrice |string |Index price at order creation| +|> ecSettleTime |string |Expected settlement time in milliseconds| +|> payoutRatio |string |Order payout ratio (price)| +|> orderAvgPayoutRatio |string |Average payout ratio of filled portion| +|> cumExecValue |string |Cumulative executed value| +|> cumExecFee |string |Cumulative executed fee| +|> leavesValue |string |Remaining order value| +|> cumPayout |string |Cumulative payout| +|> createType |integer |Order create type| +|> cancelType |string |Cancel type| +|> rejectReason |string |Reject reason| +|> extraFees |array |Extra fees| +|> transTime |string |Transaction time in milliseconds| +|> createdTime |string |Order creation time in milliseconds| +|> updatedTime |string |Order update time in milliseconds| + +### Subscribe Example +```json +{ + "op": "subscribe", + "args": [ + "order" + ] +} +``` + +### Stream Example + +```json +{ + "topic": "order", + "id": "1509583_ETHUSDT-5MIN-UP_1311", + "creationTime": 1787635282379, + "data": [ + { + "category": "event", + "orderId": "746a6c87-a6dd-4008-8889-37e694046681", + "orderLinkId": "cjm1119", + "symbol": "ETHUSDT-5MIN-UP", + "symbolId": 500000, + "side": "Sell", + "baseCoin": "ETH", + "quoteCoin": "USDT", + "settleCoin": "USDT", + "orderStatus": "PartiallyFilled", + "ecContractType": "UpDown", + "ecDirection": "UP", + "ecDurationWindow": 300, + "ecTargetPrice": "", + "ecLowerBound": "", + "ecUpperBound": "", + "ecOrderValue": "5000", + "ecIndexPrice": "2503.50730825", + "ecSettleTime": "1787635582374", + "payoutRatio": "3.5", + "orderAvgPayoutRatio": "3.5000035", + "cumExecValue": "200", + "cumExecFee": "8.57142858", + "leavesValue": "4800", + "cumPayout": "700", + "createType": 1, + "cancelType": "UNKNOWN", + "rejectReason": "EC_NoError", + "extraFees": [], + "transTime": "1787635282374", + "createdTime": "1787635103917", + "updatedTime": "1787635103917" + } + ] +} +``` diff --git a/docs/v5/event/websocket/private/position.mdx b/docs/v5/event/websocket/private/position.mdx new file mode 100644 index 0000000000..7f7bb7fe72 --- /dev/null +++ b/docs/v5/event/websocket/private/position.mdx @@ -0,0 +1,72 @@ +--- +title: Position +sidebar_label: Position +sidebar_position: 1 +--- + +Subscribe to the `position.event` topic to receive real-time Event Contract position updates. + +**Topic:** `position.event` + +:::info +* Authentication is required before subscribing to private topics. +* Pushed when a new Event Contract position is created, position value changes (partial fill), or position is settled (`cumClosedPnl` updated). +::: + +### Response Parameters +| Parameter | Type | Comments | +|:----------|:-----|:---------| +|id |string |Message ID| +|topic |string |Topic name| +|creationTime |number |Data created timestamp (ms)| +|data |array |Object| +|> symbol |string |Symbol name| +|> baseCoin |string |Base coin| +|> settleCoin |string |Settle coin| +|> side |string |Position side: `Buy` (long), `Sell` (short)| +|> ecContractType |string |Event contract type: `UpDown`, `Target`, `Range`| +|> ecDirection |string |Direction: `UP`/`DOWN` (UpDown type), `ABOVE`/`BELOW` (Target type), `RANGE_IN`/`RANGE_OUT` (Range type)| +|> avgPayoutRatio |string |Average payout ratio| +|> positionValue |string |Position value (cumulative executed value)| +|> ecSettleTime |string |Expected settlement time in milliseconds| +|> cumClosedPnl |string |Cumulative settled profit and loss| +|> createdTime |string |Position creation timestamp in milliseconds| +|> updatedTime |string |Position update timestamp in milliseconds| +|> seq |long |Cross sequence number for ordering| + +### Subscribe Example +```json +{ + "op": "subscribe", + "args": [ + "position.event" + ] +} +``` + +### Stream Example + +```json +{ + "id": "592324d2bce751-ad38-48eb-8f42-4671d1fb4d4e", + "topic": "position.event", + "creationTime": 1694515703798, + "data": [ + { + "symbol": "ETHUSDT-28AUG26-2450-2570-OUT", + "baseCoin": "BTC", + "settleCoin": "USDT", + "side": "Buy", + "ecContractType": "UpDown", + "ecDirection": "UP", + "avgPayoutRatio": "1.85", + "positionValue": "100", + "ecSettleTime": "1694515498753", + "cumClosedPnl": "50.5", + "createdTime": "1694402559843", + "updatedTime": "1694515498753", + "seq": 31413030 + } + ] +} +``` diff --git a/docs/v5/event/websocket/public/.gitkeep b/docs/v5/event/websocket/public/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/v5/event/websocket/public/orderbook.mdx b/docs/v5/event/websocket/public/orderbook.mdx new file mode 100644 index 0000000000..b3125532f4 --- /dev/null +++ b/docs/v5/event/websocket/public/orderbook.mdx @@ -0,0 +1,97 @@ +--- +title: Orderbook +sidebar_label: Orderbook +sidebar_position: 1 +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +Subscribe to the Event Contract orderbook stream. Supports **25 levels**. + +Push frequency: **20ms** + +**Topic:**
+`orderbook.25.{symbol}` e.g., `orderbook.25.ETHUSDT-28AUG26-2450-2570-OUT` + +### Process snapshot/delta + +Once you have subscribed successfully, you will receive a `snapshot`. The WebSocket will keep pushing `delta` messages every time the orderbook changes. If you receive a new `snapshot` message, you will have to reset your local orderbook. + +To apply `delta` updates: +* If you receive a size of `0`, delete the entry +* If you receive an entry that does not exist, insert it +* If the entry exists, update the size + +### Response Parameters +| Parameter | Type | Comments | +|:----------|:-----|:---------| +|topic |string |Topic name| +|type |string |Data type: `snapshot`, `delta`| +|ts |number |Timestamp (ms) when the system generates the data| +|data |map |Object| +|> s |string |Symbol name| +|> r |array |Payout ratio orderbook entries. Up to 25 levels.| +|>> r[0] |string |Payout ratio (price)| +|>> r[1] |string |Order value (size). Size `0` means the entry should be deleted.| +|> u |integer |Update ID. If `u`=1, it is a snapshot caused by a service restart — overwrite your local orderbook.| +|> seq |integer |Cross sequence. Smaller seq means earlier data.| +|cts |number |Timestamp from the matching engine when this data is produced| + +### Subscribe Example + +```json +{ + "op": "subscribe", + "args": [ + "orderbook.25.ETHUSDT-28AUG26-2450-2570-OUT" + ] +} +``` + +### Response Example + + + + +```json +{ + "topic": "orderbook.25.ETHUSDT-28AUG26-2450-2570-OUT", + "ts": 1787794783020, + "type": "snapshot", + "data": { + "s": "ETHUSDT-28AUG26-2450-2570-OUT", + "r": [ + ["3.5", "14900"], + ["2.28", "500"], + ["2.07", "500"] + ], + "u": 702, + "seq": 49115 + }, + "cts": 1787794647814 +} +``` + + + + +```json +{ + "topic": "orderbook.25.ETHUSDT-28AUG26-2450-2570-OUT", + "ts": 1787798930119, + "type": "delta", + "data": { + "s": "ETHUSDT-28AUG26-2450-2570-OUT", + "r": [ + ["2.39", "0"] + ], + "u": 724, + "seq": 50266 + }, + "cts": 1787798930117 +} +``` + + + diff --git a/docs/v5/event/websocket/public/public-trade.mdx b/docs/v5/event/websocket/public/public-trade.mdx new file mode 100644 index 0000000000..b8d1a387a6 --- /dev/null +++ b/docs/v5/event/websocket/public/public-trade.mdx @@ -0,0 +1,57 @@ +--- +title: Trade +sidebar_label: Trade +sidebar_position: 2 +--- + +Subscribe to the Event Contract public trade stream. Pushed in real-time after each trade. + +Push frequency: **real-time** + +**Topic:**
+`publicTrade.{symbol}` e.g., `publicTrade.ETHUSDT-28AUG26-2450-2570-OUT` + +### Response Parameters +| Parameter | Type | Comments | +|:----------|:-----|:---------| +|topic |string |Topic name| +|type |string |Data type: `snapshot`| +|ts |number |Timestamp (ms) when the system generates the data| +|data |array |Object. Sorted by trade time in ascending order.| +|> T |number |Timestamp (ms) when the order is filled| +|> s |string |Symbol name| +|> r |string |Payout ratio (trade price)| +|> a |string |Trade amount (order value)| +|> i |string |Trade ID| +|> seq |integer |Cross sequence| + +### Subscribe Example + +```json +{ + "op": "subscribe", + "args": [ + "publicTrade.ETHUSDT-28AUG26-2450-2570-OUT" + ] +} +``` + +### Response Example + +```json +{ + "topic": "publicTrade.ETHUSDT-28AUG26-2450-2570-OUT", + "ts": 1787794797536, + "type": "snapshot", + "data": [ + { + "T": 1787794797534, + "s": "ETHUSDT-28AUG26-2450-2570-OUT", + "r": "3.5", + "a": "100", + "i": "ea89cadf-6471-5fd4-8248-20b470d8478b", + "seq": 49139 + } + ] +} +``` diff --git a/i18n/zh-TW/docusaurus-plugin-content-docs/current/changelog/v5.mdx b/i18n/zh-TW/docusaurus-plugin-content-docs/current/changelog/v5.mdx index 76a55c2f33..4736207940 100644 --- a/i18n/zh-TW/docusaurus-plugin-content-docs/current/changelog/v5.mdx +++ b/i18n/zh-TW/docusaurus-plugin-content-docs/current/changelog/v5.mdx @@ -4,6 +4,11 @@ title: V5 import '/src/css/changelog.css'; +## 2026-09-02 +### REST API +- [Event Trading](../v5/event/introduction) [NEW] + - 上線 Event Contract OpenAPI,包含 Market、Trade 接口及 WebSocket 推送。 + ## 2026-08-31 ### REST API - [接入指南](../v5/guide#authentication) diff --git a/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/account/transaction-log.mdx b/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/account/transaction-log.mdx index b50f32e622..02b46cac63 100644 --- a/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/account/transaction-log.mdx +++ b/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/account/transaction-log.mdx @@ -16,7 +16,7 @@ sidebar_position: 3 | 參數 | 是否必需 | 類型 | 說明| |:----- |:-------|:-----|------ | |[accountType](../enum#accounttype) |false |string |錢包類型. 僅支持`UNIFIED`| -|[category](../enum#category) |false |string |交易產品類型 `spot`,`linear`,`option`,`inverse`| +|[category](../enum#category) |false |string |交易產品類型 `spot`,`linear`,`option`,`inverse`,`event`| |currency |false |string |貨幣| |baseCoin |false |string |交易幣種. 例如: BTCUSDT 的 baseCoin 是 BTC| |[type](../enum#typeuta-translog) |false |string |交易日誌的類型 | @@ -32,7 +32,7 @@ sidebar_position: 3 |list |array |Object | |> id |string |唯一id | |> symbol |string |合約名稱 | -|> category |string |產品類型| +|> category |string |產品類型。`spot`,`linear`,`option`,`inverse`,`event`| |> side |string |方向. `Buy`,`Sell`,`None`| |> transactionTime |string |交易時間戳(毫秒)| |> [type](../enum#typeuta-translog) |string |類型 | diff --git a/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/enum.mdx b/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/enum.mdx index b04206fc78..0e8ef292fa 100644 --- a/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/enum.mdx +++ b/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/enum.mdx @@ -427,7 +427,7 @@ _期權:_ * `TRANSFER_OUT` 從統一錢包轉出到別的錢包 * `TRADE` * `SETTLEMENT` USDT永續的資金費結算; USDC永續的資金費結算以及USDC合約的8小時倉位結算 -* `DELIVERY` USDC交割合約和期權到期交割 +* `DELIVERY` USDC交割合約和期權到期交割、Event Contract 結算 * `LIQUIDATION` * `ADL` 自動減倉 * `AIRDROP` diff --git a/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/event/introduction.mdx b/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/event/introduction.mdx new file mode 100644 index 0000000000..23dbe6fdd3 --- /dev/null +++ b/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/event/introduction.mdx @@ -0,0 +1,15 @@ +--- +title: 簡介 +sidebar_label: 簡介 +sidebar_position: 0 +--- + +## 概述 + +Event Contract 是 Bybit 提供的結構化產品,允許用戶以固定賠付結構對市場事件的結果進行交易。 + +## 訪問權限 + +:::caution +僅**做市商**可調用 Event Contract OpenAPI 接口。如需申請做市商資格,請聯繫您的 **Relation Manager**。 +::: diff --git a/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/event/market/.gitkeep b/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/event/market/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/event/market/instrument-info.mdx b/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/event/market/instrument-info.mdx new file mode 100644 index 0000000000..1e28085c94 --- /dev/null +++ b/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/event/market/instrument-info.mdx @@ -0,0 +1,240 @@ +--- +title: 查詢合約信息 +sidebar_label: 查詢合約信息 +sidebar_position: 1 +--- + +查詢 Event Contract 合約信息,支持分頁。 + +### HTTP 請求 + + +### 請求參數 +| 參數 | 是否必需 | 類型 | 說明 | +|:-----|:---------|:-----|:-----| +|symbol |否 |string |交易對名稱,如 `ETHUSDT-28AUG26-2450-2570-OUT`| +|status |否 |string |`PreLaunch`、`Trading`、`Delivering`、`Closed`| +|limit |否 |integer |每頁數量。默認:`50`,範圍:[`1`, `100`]| +|cursor |否 |string |分頁游標,使用上一次返回的 `nextPageCursor`| + +### 返回參數 +| 參數 | 類型 | 說明 | +|:-----|:-----|:-----| +|nextPageCursor |string |下一頁分頁游標| +|list |array |合約列表| +|> symbol |string |交易對名稱| +|> symbolId |integer |交易對 ID| +|> baseCoin |string |標的幣種| +|> quoteCoin |string |計價幣種| +|> settleCoin |string |結算幣種| +|> eventContractType |string |事件合約類型:`Up_Down`、`Target`、`Range`| +|> durationWindow |string |持續時間窗口(秒)。非 Up_Down 類型返回空字符串| +|> rvThreshold |string |波動率閾值| +|> rebate |string |返傭比率。Up_Down 類型為 `0`| +|> takerFeeRate |string |Taker 手續費率| +|> makerFeeRate |string |Maker 手續費率| +|> launchTime |string |上線時間(毫秒)| +|> deliveryTime |string |交割時間(毫秒)| +|> status |string |合約狀態:`PreLaunch`、`Trading`、`Delivering`、`Closed`| +|> targetPrice |string |目標價格,僅 Target 類型適用。Up_Down 和 Range 類型返回 `"0"`| +|> lowerBound |string |[Range 類型] 範圍下限(不含)。低於此值則 Range Out 獲勝。Up_Down 和 Target 類型返回 `"0"`| +|> upperBound |string |[Range 類型] 範圍上限(不含)。高於此值則 Range Out 獲勝。Up_Down 和 Target 類型返回 `"0"`| +|> callOptionSymbolId |integer |對應的 Call 期權 symbolId。(1) Range 上限:填入上限 Strike 對應的 call option symbolId;(2) Target ABOVE:填入 Strike 對應的 call option symbolId;(3) Up_Down 及 Target BELOW:填 `0`| +|> putOptionSymbolId |integer |對應的 Put 期權 symbolId。(1) Range 下限:填入下限 Strike 對應的 put option symbolId;(2) Target BELOW:填入 Strike 對應的 put option symbolId;(3) Up_Down 及 Target ABOVE:填 `0`| +|> feeRateRule |array |費率配置| +|>> minSecToDelivery |integer |區間起始——距結算的秒數下限| +|>> maxSecToDelivery |integer |區間結束——距結算的秒數上限| +|>> baseMarkup |string |基礎 Markup| +|> lotSizeFilter |object |訂單規模配置| +|>> minOrderAmount |string |最小訂單金額| +|>> maxOrderAmount |string |最大訂單金額| +|>> orderAmountTickSize |string |訂單金額步長| +|>> quoteMaxValidMs |integer |單次報價最長有效期(毫秒)| +|>> quoteMinIntervalPerUserMs |integer |每個 UID 報價請求的最小時間間隔(毫秒)| +|> quotationLimit |array |報價限額配置| +|>> minSecToDelivery |integer |區間起始——距結算的秒數下限| +|>> maxSecToDelivery |integer |區間結束——距結算的秒數上限| +|>> quoteMaxAmountPerUser |string |每個 UID 累計最大報價金額| +|>> quoteMinAmountPerUser |string |每個 UID 累計最小報價金額| +|>> quoteMinAmount |string |單次最小報價金額| + +--- + +### 請求示例 + +```http +GET /v5/event/instruments-info?status=Trading&limit=10 HTTP/1.1 +Host: api.bybit.com +``` + +### 返回示例 + +```json +{ + "retCode": 0, + "retMsg": "OK", + "result": { + "nextPageCursor": "0%2C10", + "list": [ + { + "symbolId": 500017, + "symbol": "BTCUSDT-15MIN-DOWN", + "baseCoin": "BTC", + "quoteCoin": "USDT", + "settleCoin": "USDT", + "eventContractType": "Up_Down", + "durationWindow": 900, + "rvThreshold": "0.60", + "rebate": "0", + "takerFeeRate": "0.0088", + "makerFeeRate": "0", + "launchTime": "1786000980000", + "deliveryTime": "1798779602000", + "status": "Trading", + "targetPrice": "0", + "lowerBound": "0", + "upperBound": "0", + "callOptionSymbolId": 0, + "putOptionSymbolId": 0, + "feeRateRule": [ + { + "minSecToDelivery": 0, + "maxSecToDelivery": 315360000, + "baseMarkup": "0.0600" + } + ], + "quotationLimit": [ + { + "minSecToDelivery": 0, + "maxSecToDelivery": 315360000, + "quoteMaxAmountPerUser": "20000", + "quoteMinAmountPerUser": "10000", + "quoteMinAmount": "50" + } + ], + "lotSizeFilter": { + "minOrderAmount": "5", + "maxOrderAmount": "800", + "orderAmountTickSize": "1", + "quoteMaxValidMs": 60000, + "quoteMinIntervalPerUserMs": 200 + } + }, + { + "symbolId": 500241, + "symbol": "ETHUSDT-22AUG26-1850-2000-OUT", + "baseCoin": "ETH", + "quoteCoin": "USDT", + "settleCoin": "USDT", + "eventContractType": "Range", + "durationWindow": "", + "rvThreshold": "0.62", + "rebate": "0.25", + "takerFeeRate": "0.008", + "makerFeeRate": "0", + "launchTime": "1787018820000", + "deliveryTime": "1787385600000", + "status": "Trading", + "targetPrice": "0", + "lowerBound": "1850", + "upperBound": "2000", + "callOptionSymbolId": 32101659, + "putOptionSymbolId": 32101656, + "feeRateRule": [ + { + "minSecToDelivery": 0, + "maxSecToDelivery": 259200, + "baseMarkup": "0.0230" + }, + { + "minSecToDelivery": 259200, + "maxSecToDelivery": 315360000, + "baseMarkup": "0.0180" + } + ], + "quotationLimit": [ + { + "minSecToDelivery": 0, + "maxSecToDelivery": 259200, + "quoteMaxAmountPerUser": "6000000", + "quoteMinAmountPerUser": "5000", + "quoteMinAmount": "500" + }, + { + "minSecToDelivery": 259200, + "maxSecToDelivery": 315360000, + "quoteMaxAmountPerUser": "990", + "quoteMinAmountPerUser": "3000", + "quoteMinAmount": "500" + } + ], + "lotSizeFilter": { + "minOrderAmount": "5", + "maxOrderAmount": "500", + "orderAmountTickSize": "1", + "quoteMaxValidMs": 6000000, + "quoteMinIntervalPerUserMs": 5000 + } + }, + { + "symbolId": 500239, + "symbol": "ETHUSDT-22AUG26-1850-BELOW", + "baseCoin": "ETH", + "quoteCoin": "USDT", + "settleCoin": "USDT", + "eventContractType": "Target", + "durationWindow": "", + "rvThreshold": "0.62", + "rebate": "0.25", + "takerFeeRate": "0.008", + "makerFeeRate": "0", + "launchTime": "1787051280000", + "deliveryTime": "1787385600000", + "status": "Trading", + "targetPrice": "1850", + "lowerBound": "0", + "upperBound": "0", + "callOptionSymbolId": 0, + "putOptionSymbolId": 32101656, + "feeRateRule": [ + { + "minSecToDelivery": 0, + "maxSecToDelivery": 259200, + "baseMarkup": "0.0230" + }, + { + "minSecToDelivery": 259200, + "maxSecToDelivery": 315360000, + "baseMarkup": "0.0180" + } + ], + "quotationLimit": [ + { + "minSecToDelivery": 0, + "maxSecToDelivery": 259200, + "quoteMaxAmountPerUser": "990000", + "quoteMinAmountPerUser": "5000", + "quoteMinAmount": "500" + }, + { + "minSecToDelivery": 259200, + "maxSecToDelivery": 315360000, + "quoteMaxAmountPerUser": "9000000", + "quoteMinAmountPerUser": "3000", + "quoteMinAmount": "500" + } + ], + "lotSizeFilter": { + "minOrderAmount": "5", + "maxOrderAmount": "500", + "orderAmountTickSize": "1", + "quoteMaxValidMs": 6000000, + "quoteMinIntervalPerUserMs": 5000 + } + } + ] + }, + "retExtInfo": {}, + "time": 1787108703481 +} +``` diff --git a/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/event/market/orderbook.mdx b/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/event/market/orderbook.mdx new file mode 100644 index 0000000000..813d39039e --- /dev/null +++ b/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/event/market/orderbook.mdx @@ -0,0 +1,58 @@ +--- +title: 查詢訂單簿 +sidebar_label: 查詢訂單簿 +sidebar_position: 2 +--- + +查詢 Event Contract 交易對的 25 檔訂單簿數據。 + +### HTTP 請求 + + +### 請求參數 +| 參數 | 是否必需 | 類型 | 說明 | +|:-----|:---------|:-----|:-----| +|symbol |**true** |string |交易對名稱,如 `ETHUSDT-28AUG26-2450-2570-OUT`| + +### 返回參數 +| 參數 | 類型 | 說明 | +|:-----|:-----|:-----| +|s |string |交易對名稱| +|r |array |訂單簿條目,最多 25 檔。每條格式為 `[賠付比率, 訂單金額]`| +|ts |integer |撮合引擎時間戳(毫秒)| +|u |integer |更新 ID| +|seq |integer |跨業務序號| +|cts |integer |創建時間戳(毫秒)| + +--- + +### 請求示例 + +```http +GET /v5/event/orderbook?symbol=ETHUSDT-28AUG26-2450-2570-OUT HTTP/1.1 +Host: api.bybit.com +``` + +### 返回示例 + +```json +{ + "retCode": 0, + "retMsg": "OK", + "result": { + "s": "BTCUSDT-5MIN-UP", + "r": [ + [ + "0.90", + "50000" + ] + ], + "ts": 1716863719031, + "u": 230704, + "seq": 1432604333, + "cts": 1716863718905 + }, + "retExtInfo": {}, + "time": 1716863719382 +} +``` diff --git a/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/event/trade/.gitkeep b/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/event/trade/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/event/trade/cancel-quote.mdx b/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/event/trade/cancel-quote.mdx new file mode 100644 index 0000000000..9b01f38f80 --- /dev/null +++ b/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/event/trade/cancel-quote.mdx @@ -0,0 +1,60 @@ +--- +title: 撤銷報價 +sidebar_label: 撤銷報價 +sidebar_position: 7 +--- + +撤銷已提交的 Event Contract 報價。 + +:::info +* 僅 **Event Contract maker 帳戶**可訪問此接口。 +::: + +### HTTP 請求 + + +### 請求參數 +| 參數 | 是否必需 | 類型 | 說明 | +|:-----|:---------|:-----|:-----| +|orderLinkId |否 |string |用戶自定義訂單 ID(報價 ID)| +|orderId |否 |string |訂單 ID| + +### 返回參數 +| 參數 | 類型 | 說明 | +|:-----|:-----|:-----| +|orderLinkId |string |用戶自定義訂單 ID| +|orderId |string |訂單 ID| + +--- + +### 請求示例 + +```http +POST /v5/event/cancel HTTP/1.1 +Host: api.bybit.com +X-BAPI-SIGN: XXXXX +X-BAPI-API-KEY: xxxxxxxxxxxxxxxxxx +X-BAPI-TIMESTAMP: 1694402559000 +X-BAPI-RECV-WINDOW: 5000 +Content-Type: application/json + +{ + "orderLinkId": "xxxxxx", + "orderId": "xxxxxxxxxxefffff" +} +``` + +### 返回示例 + +```json +{ + "retCode": 0, + "retMsg": "OK", + "result": { + "orderLinkId": "xxxxxx", + "orderId": "xxxxxxxxxxefffff" + }, + "retExtInfo": {}, + "time": 1672217377164 +} +``` diff --git a/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/event/trade/execution.mdx b/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/event/trade/execution.mdx new file mode 100644 index 0000000000..a4c9e40afb --- /dev/null +++ b/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/event/trade/execution.mdx @@ -0,0 +1,117 @@ +--- +title: 查詢Event Contract成交記錄 +sidebar_label: 查詢Event Contract成交記錄 +sidebar_position: 5 +--- + +查詢 Event Contract 成交(執行)記錄,支持查詢過去 2 年內的數據。 + +:::info +* 僅 **Event Contract maker 帳戶**可訪問此接口。 +* 若未指定 `startTime`/`endTime`,默認查詢窗口為 **7 天**。 +::: + +### HTTP 請求 + + +### 請求參數 +| 參數 | 是否必需 | 類型 | 說明 | +|:-----|:---------|:-----|:-----| +|symbol |**true** |string |交易對名稱,如 `ETHUSDT-28AUG26-2450-2570-OUT`| +|orderId |否 |string |訂單 ID 篩選| +|orderLinkId |否 |string |用戶自定義訂單 ID| +|startTime |否 |integer |開始時間(毫秒)。默認:7 天前| +|endTime |否 |integer |結束時間(毫秒)。默認:當前時間| +|limit |否 |integer |每頁數量。默認:`50`,範圍:[`1`, `100`]| +|cursor |否 |string |分頁游標| + +### 返回參數 +| 參數 | 類型 | 說明 | +|:-----|:-----|:-----| +|list |array |Event Contract 成交記錄列表| +|> orderId |string |訂單 ID| +|> orderLinkId |string |用戶自定義訂單 ID| +|> execId |string |成交 ID| +|> symbol |string |交易對名稱| +|> baseCoin |string |標的幣種| +|> settleCoin |string |結算幣種| +|> side |string |方向:`Buy` 或 `Sell`| +|> [execType](../../../enum#exectype) |string |成交類型:`Trade`、`Settle`| +|> execPrice |string |成交價格(賠付比率)| +|> execValue |string |成交金額| +|> execFee |string |成交手續費| +|> execFeeRate |string |成交手續費率| +|> orderPrice |string |訂單價格| +|> feeCoin |string |手續費幣種| +|> transTime |string |成交時間(毫秒)| +|> [timeInForce](../../../enum#timeinforce) |string |訂單有效期,如 `GTC`、`IOC`、`FOK`| +|> crossSeq |string |跨業務序號| +|> ecPayout |string |Event Contract 賠付金額(本次成交的結算賠付)| +|> ecDurationWindow |string |持續時間窗口(秒)| +|> settleTimeMs |string |結算時間(毫秒)| +|> ecOrderValue |string |Event Contract 訂單金額| +|> ecContractType |string |事件合約類型:`UpDown`、`Target`、`Range`| +|> ecDirection |string |方向:`UP`/`DOWN`(UpDown 類型),`ABOVE`/`BELOW`(Target 類型),`RANGE_IN`/`RANGE_OUT`(Range 類型)| +|> ecTargetPrice |string |目標價格,僅 Target 類型適用| +|> ecLowerBound |string |下限價格,僅 Range 類型適用| +|> ecUpperBound |string |上限價格,僅 Range 類型適用| +|> extraFees |string |額外費用(適用時為 JSON 字符串)| +|cursor |string |下一頁分頁游標| + +--- + +### 請求示例 + +```http +GET /v5/event/trades?symbol=ETHUSDT-28AUG26-2450-2570-OUT&limit=50 HTTP/1.1 +Host: api.bybit.com +X-BAPI-SIGN: XXXXX +X-BAPI-API-KEY: xxxxxxxxxxxxxxxxxx +X-BAPI-TIMESTAMP: 1694402559000 +X-BAPI-RECV-WINDOW: 5000 +``` + +### 返回示例 + +```json +{ + "retCode": 0, + "retMsg": "OK", + "result": { + "list": [ + { + "orderId": "1234567890", + "orderLinkId": "my-order-001", + "execId": "exec-001", + "symbol": "ETHUSDT-28AUG26-2450-2570-OUT", + "baseCoin": "BTC", + "settleCoin": "USDT", + "side": "Buy", + "execType": "Trade", + "execPrice": "1.95", + "execValue": "50", + "execFee": "0.5", + "execFeeRate": "0.01", + "orderPrice": "1.95", + "feeCoin": "USDT", + "transTime": "1694402559843", + "timeInForce": "GTC", + "crossSeq": "31413030", + "ecPayout": "0", + "ecDurationWindow": "300", + "settleTimeMs": "1694515498753", + "ecOrderValue": "50", + "ecContractType": "UpDown", + "ecDirection": "UP", + "ecTargetPrice": "", + "ecLowerBound": "", + "ecUpperBound": "", + "extraFees": "" + } + ], + "cursor": "" + }, + "retExtInfo": {}, + "time": 1694402560000 +} +``` diff --git a/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/event/trade/open-order.mdx b/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/event/trade/open-order.mdx new file mode 100644 index 0000000000..e9c48f1fbd --- /dev/null +++ b/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/event/trade/open-order.mdx @@ -0,0 +1,106 @@ +--- +title: 查詢Event Contract活躍訂單 +sidebar_label: 查詢Event Contract活躍訂單 +sidebar_position: 2 +--- + +查詢實時未成交或部分成交的 Event Contract 訂單。 + +:::info +* 僅 **Event Contract maker 帳戶**可訪問此接口。 +::: + +### HTTP 請求 + + +### 請求參數 +| 參數 | 是否必需 | 類型 | 說明 | +|:-----|:---------|:-----|:-----| +|symbol |否 |string |交易對名稱,如 `ETHUSDT-28AUG26-2450-2570-OUT`| +|orderId |否 |string |訂單 ID。若同時傳入 `orderId` 和 `orderLinkId`,以 `orderId` 為準| +|orderLinkId |否 |string |用戶自定義訂單 ID| +|limit |否 |integer |每頁數量。默認:`20`,範圍:[`1`, `50`]| +|cursor |否 |string |分頁游標,使用返回結果中的 `nextPageCursor` 獲取下一頁| + +### 返回參數 +| 參數 | 類型 | 說明 | +|:-----|:-----|:-----| +|list |array |Event Contract 活躍訂單列表| +|> orderId |string |訂單 ID| +|> orderLinkId |string |用戶自定義訂單 ID| +|> symbol |string |交易對名稱| +|> symbolId |string |交易對 ID| +|> side |string |訂單方向:`Buy` 或 `Sell`| +|> orderStatus |string |訂單狀態:`New`(已創建)、`PartiallyFilled`(部分成交)、`Untriggered`(等待觸發)| +|> payoutRatio |string |訂單賠付比率(價格)| +|> cumExecValue |string |累計成交金額| +|> cumExecFee |string |累計已結算手續費| +|> leavesValue |string |剩餘未成交金額| +|> ecContractType |string |事件合約類型:`UpDown`、`Target`、`Range`| +|> ecDirection |string |方向:`UP`/`DOWN`(UpDown 類型),`ABOVE`/`BELOW`(Target 類型),`RANGE_IN`/`RANGE_OUT`(Range 類型)| +|> ecOrderValue |string |Event Contract 訂單金額| +|> ecSettleTime |string |預計結算時間(毫秒)| +|> ecTargetPrice |string |目標價格,僅 Target 類型適用| +|> ecLowerBound |string |下限價格,僅 Range 類型適用| +|> ecUpperBound |string |上限價格,僅 Range 類型適用| +|> ecDurationWindow |string |持續時間窗口(秒)| +|> ecIndexPrice |string |下單時的指數價格| +|> orderAvgPayoutRatio |string |已成交部分的平均賠付比率| +|> createType |string |訂單創建類型,如 `CreateByUser`| +|> createdTime |string |訂單創建時間(毫秒)| +|> updatedTime |string |訂單更新時間(毫秒)| +|nextPageCursor |string |下一頁分頁游標| + +--- + +### 請求示例 + +```http +GET /v5/event/order-realtime?symbol=ETHUSDT-28AUG26-2450-2570-OUT&limit=20 HTTP/1.1 +Host: api.bybit.com +X-BAPI-SIGN: XXXXX +X-BAPI-API-KEY: xxxxxxxxxxxxxxxxxx +X-BAPI-TIMESTAMP: 1694402559000 +X-BAPI-RECV-WINDOW: 5000 +``` + +### 返回示例 + +```json +{ + "retCode": 0, + "retMsg": "OK", + "result": { + "list": [ + { + "orderId": "1234567890", + "orderLinkId": "my-order-001", + "symbol": "ETHUSDT-28AUG26-2450-2570-OUT", + "symbolId": "100001", + "side": "Buy", + "orderStatus": "New", + "payoutRatio": "1.95", + "cumExecValue": "0", + "cumExecFee": "0", + "leavesValue": "50", + "ecContractType": "UpDown", + "ecDirection": "UP", + "ecOrderValue": "50", + "ecSettleTime": "1694515498753", + "ecTargetPrice": "", + "ecLowerBound": "", + "ecUpperBound": "", + "ecDurationWindow": "300", + "ecIndexPrice": "26000.5", + "orderAvgPayoutRatio": "0", + "createType": "CreateByUser", + "createdTime": "1694402559843", + "updatedTime": "1694402559843" + } + ], + "nextPageCursor": "" + }, + "retExtInfo": {}, + "time": 1694402560000 +} +``` diff --git a/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/event/trade/order-list.mdx b/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/event/trade/order-list.mdx new file mode 100644 index 0000000000..5600055b63 --- /dev/null +++ b/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/event/trade/order-list.mdx @@ -0,0 +1,124 @@ +--- +title: 查詢Event Contract歷史訂單 +sidebar_label: 查詢Event Contract歷史訂單 +sidebar_position: 1 +--- + +查詢事件合約歷史訂單,支持查詢過去 2 年內的訂單記錄。 + +:::info +* 僅 **Event Contract maker 帳戶**可訪問此接口。 +* 結果按 `createdTime` 降序排列。 +* 若未指定 `startTime`/`endTime`,默認查詢窗口為 **7 天**。 +::: + +### HTTP 請求 + + +### 請求參數 +| 參數 | 是否必需 | 類型 | 說明 | +|:-----|:---------|:-----|:-----| +|symbol |否 |string |交易對名稱,如 `ETHUSDT-28AUG26-2450-2570-OUT`| +|orderId |否 |string |訂單 ID| +|orderLinkId |否 |string |用戶自定義訂單 ID| +|startTime |否 |integer |開始時間(毫秒)。默認:7 天前| +|endTime |否 |integer |結束時間(毫秒)。默認:當前時間| +|limit |否 |integer |每頁數量。默認:`50`,範圍:[`1`, `100`]| +|cursor |否 |string |分頁游標| + +### 返回參數 +| 參數 | 類型 | 說明 | +|:-----|:-----|:-----| +|list |array |Event Contract 歷史訂單列表| +|> orderId |string |訂單 ID| +|> orderLinkId |string |用戶自定義訂單 ID| +|> orderStatus |string |訂單狀態:`Filled`(已成交)、`Cancelled`(已取消)、`Rejected`(已拒絕)、`PartiallyFilledCanceled`(部分成交後取消)| +|> symbol |string |交易對名稱| +|> symbolId |string |交易對 ID| +|> baseCoin |string |標的幣種| +|> quoteCoin |string |計價幣種| +|> settleCoin |string |結算幣種| +|> ecDirection |string |方向:`UP`/`DOWN`(UpDown 類型),`ABOVE`/`BELOW`(Target 類型),`RANGE_IN`/`RANGE_OUT`(Range 類型)| +|> ecDurationWindow |string |持續時間窗口(秒)| +|> ecTargetPrice |string |目標價格,僅 Target 類型適用| +|> ecContractType |string |事件合約類型:`UpDown`、`Target`、`Range`| +|> ecLowerBound |string |下限價格,僅 Range 類型適用| +|> ecUpperBound |string |上限價格,僅 Range 類型適用| +|> settleTimeMs |string |結算時間(毫秒)| +|> ecOrderValue |string |Event Contract 訂單金額| +|> ecIndexPrice |string |下單時的指數價格| +|> orderAvgPayoutRatio |string |已成交部分的平均賠付比率| +|> cumExecValue |string |累計成交金額| +|> payoutRatio |string |訂單賠付比率(價格)| +|> tradeFee |string |交易手續費| +|> transTime |string |成交時間(毫秒)| +|> createTime |string |訂單創建時間(毫秒)| +|> updateTime |string |訂單更新時間(毫秒)| +|> cumPayout |string |累計賠付金額| +|> cumExecFee |string |累計已結算手續費| +|> cancelType |string |取消類型,未取消時為空| +|> createType |string |訂單創建類型,如 `CreateByUser`| +|> rejectReason |string |拒絕原因,未拒絕時為空| +|> extraFees |string |額外費用(適用時為 JSON 字符串)| +|cursor |string |下一頁分頁游標| + +--- + +### 請求示例 + +```http +GET /v5/event/order-list?symbol=ETHUSDT-28AUG26-2450-2570-OUT&limit=50 HTTP/1.1 +Host: api.bybit.com +X-BAPI-SIGN: XXXXX +X-BAPI-API-KEY: xxxxxxxxxxxxxxxxxx +X-BAPI-TIMESTAMP: 1694402559000 +X-BAPI-RECV-WINDOW: 5000 +``` + +### 返回示例 + +```json +{ + "retCode": 0, + "retMsg": "OK", + "result": { + "list": [ + { + "orderId": "1234567890", + "orderLinkId": "", + "orderStatus": "Filled", + "symbol": "ETHUSDT-28AUG26-2450-2570-OUT", + "symbolId": "100001", + "baseCoin": "BTC", + "quoteCoin": "USDT", + "settleCoin": "USDT", + "ecDirection": "UP", + "ecDurationWindow": "300", + "ecTargetPrice": "", + "ecContractType": "UpDown", + "ecLowerBound": "", + "ecUpperBound": "", + "settleTimeMs": "1694515498753", + "ecOrderValue": "50", + "ecIndexPrice": "26000.5", + "orderAvgPayoutRatio": "1.85", + "cumExecValue": "50", + "payoutRatio": "1.95", + "tradeFee": "50", + "transTime": "1694402559843", + "createTime": "1694402559843", + "updateTime": "1694515498753", + "cumPayout": "92.5", + "cumExecFee": "0.5", + "cancelType": "", + "createType": "CreateByUser", + "rejectReason": "", + "extraFees": "" + } + ], + "cursor": "" + }, + "retExtInfo": {}, + "time": 1694402560000 +} +``` diff --git a/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/event/trade/position.mdx b/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/event/trade/position.mdx new file mode 100644 index 0000000000..6ea1326a13 --- /dev/null +++ b/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/event/trade/position.mdx @@ -0,0 +1,86 @@ +--- +title: 查詢Event Contract倉位信息 +sidebar_label: 查詢Event Contract倉位信息 +sidebar_position: 3 +--- + +查詢實時 Event Contract 倉位數據,涵蓋 UpDown、Target 及 Range 合約類型。 + +:::info +* 僅 **Event Contract maker 帳戶**可訪問此接口。 +::: + +### HTTP 請求 + + +### 請求參數 +| 參數 | 是否必需 | 類型 | 說明 | +|:-----|:---------|:-----|:-----| +|symbol |否 |string |交易對名稱,如 `ETHUSDT-28AUG26-2450-2570-OUT`。不傳則返回所有 Event Contract 倉位| +|baseCoin |否 |string |標的幣種篩選,如 `BTC`| +|settleCoin |否 |string |結算幣種篩選,如 `USDT`| +|limit |否 |integer |每頁數量。默認:`20`,範圍:[`1`, `50`]| +|cursor |否 |string |分頁游標,使用返回結果中的 `nextPageCursor` 獲取下一頁| + +### 返回參數 +| 參數 | 類型 | 說明 | +|:-----|:-----|:-----| +|list |array |Event Contract 倉位列表| +|> symbol |string |交易對名稱| +|> baseCoin |string |標的幣種| +|> settleCoin |string |結算幣種| +|> side |string |倉位方向:`Buy`(做多)、`Sell`(做空)| +|> ecContractType |string |事件合約類型:`UpDown`、`Target`、`Range`| +|> ecDirection |string |方向:`UP`/`DOWN`(UpDown 類型),`ABOVE`/`BELOW`(Target 類型),`RANGE_IN`/`RANGE_OUT`(Range 類型)| +|> avgPayoutRatio |string |平均賠付比率| +|> positionValue |string |倉位價值(累計成交金額)| +|> ecSettleTime |string |預計結算時間(毫秒)| +|> cumClosedPnl |string |累計已結算盈虧| +|> createdTime |string |倉位創建時間(毫秒)| +|> updatedTime |string |倉位更新時間(毫秒)| +|> seq |long |跨業務序號,用於排序| +|nextPageCursor |string |下一頁分頁游標| + +--- + +### 請求示例 + +```http +GET /v5/event/positions?symbol=ETHUSDT-28AUG26-2450-2570-OUT&limit=20 HTTP/1.1 +Host: api.bybit.com +X-BAPI-SIGN: XXXXX +X-BAPI-API-KEY: xxxxxxxxxxxxxxxxxx +X-BAPI-TIMESTAMP: 1694402559000 +X-BAPI-RECV-WINDOW: 5000 +``` + +### 返回示例 + +```json +{ + "retCode": 0, + "retMsg": "OK", + "result": { + "list": [ + { + "symbol": "ETHUSDT-28AUG26-2450-2570-OUT", + "baseCoin": "BTC", + "settleCoin": "USDT", + "side": "Buy", + "ecContractType": "UpDown", + "ecDirection": "UP", + "avgPayoutRatio": "1.85", + "positionValue": "100", + "ecSettleTime": "1694515498753", + "cumClosedPnl": "50.5", + "createdTime": "1694402559843", + "updatedTime": "1694515498753", + "seq": 31413030 + } + ], + "nextPageCursor": "" + }, + "retExtInfo": {}, + "time": 1694402560000 +} +``` diff --git a/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/event/trade/settlement.mdx b/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/event/trade/settlement.mdx new file mode 100644 index 0000000000..399591c626 --- /dev/null +++ b/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/event/trade/settlement.mdx @@ -0,0 +1,106 @@ +--- +title: 查詢Event Contract結算記錄 +sidebar_label: 查詢Event Contract結算記錄 +sidebar_position: 4 +--- + +查詢 Event Contract 結算記錄,支持查詢過去 2 年內的數據。 + +:::info +* 僅 **Event Contract maker 帳戶**可訪問此接口。 +* 若未指定 `startTime`/`endTime`,默認查詢窗口為 **7 天**。 +::: + +### HTTP 請求 + + +### 請求參數 +| 參數 | 是否必需 | 類型 | 說明 | +|:-----|:---------|:-----|:-----| +|symbol |**true** |string |交易對名稱,如 `ETHUSDT-28AUG26-2450-2570-OUT`| +|orderId |否 |string |訂單 ID 篩選| +|startTime |否 |integer |開始時間(毫秒)。默認:7 天前| +|endTime |否 |integer |結束時間(毫秒)。默認:當前時間| +|limit |否 |integer |每頁數量。默認:`50`,範圍:[`1`, `100`]| +|cursor |否 |string |分頁游標| + +### 返回參數 +| 參數 | 類型 | 說明 | +|:-----|:-----|:-----| +|list |array |Event Contract 結算記錄列表| +|> transId |string |交易 ID| +|> symbol |string |交易對名稱| +|> symbolId |string |交易對 ID| +|> baseCoin |string |標的幣種| +|> settleCoin |string |結算幣種| +|> side |string |方向:`Buy` 或 `Sell`| +|> ecContractType |string |事件合約類型:`UpDown`、`Target`、`Range`| +|> ecDirection |string |方向:`UP`/`DOWN`(UpDown 類型),`ABOVE`/`BELOW`(Target 類型),`RANGE_IN`/`RANGE_OUT`(Range 類型)| +|> settlePrice |string |結算價格| +|> entryPrice |string |入場價格| +|> grossPayoutRatio |string |毛賠付比率| +|> ecDurationWindow |string |持續時間窗口(秒)| +|> ecTargetPrice |string |目標價格,僅 Target 類型適用| +|> ecLowerBound |string |下限價格,僅 Range 類型適用| +|> ecUpperBound |string |上限價格,僅 Range 類型適用| +|> transTime |string |結算時間(毫秒)| +|> crossSeq |string |跨業務序號| +|> execFee |string |執行手續費| +|> execFeeRate |string |執行手續費率| +|> payout |string |結算賠付金額| +|> sessionRpl |string |本次持倉已結盈虧| +|> orderId |string |關聯訂單 ID| +|cursor |string |下一頁分頁游標| + +--- + +### 請求示例 + +```http +GET /v5/event/settlements?symbol=ETHUSDT-28AUG26-2450-2570-OUT&limit=50 HTTP/1.1 +Host: api.bybit.com +X-BAPI-SIGN: XXXXX +X-BAPI-API-KEY: xxxxxxxxxxxxxxxxxx +X-BAPI-TIMESTAMP: 1694402559000 +X-BAPI-RECV-WINDOW: 5000 +``` + +### 返回示例 + +```json +{ + "retCode": 0, + "retMsg": "OK", + "result": { + "list": [ + { + "transId": "tx-001", + "symbol": "ETHUSDT-28AUG26-2450-2570-OUT", + "symbolId": "100001", + "baseCoin": "BTC", + "settleCoin": "USDT", + "side": "Buy", + "ecContractType": "UpDown", + "ecDirection": "UP", + "settlePrice": "26500", + "entryPrice": "26000.5", + "grossPayoutRatio": "1.85", + "ecDurationWindow": "300", + "ecTargetPrice": "", + "ecLowerBound": "", + "ecUpperBound": "", + "transTime": "1694515498753", + "crossSeq": "31413030", + "execFee": "0.5", + "execFeeRate": "0.01", + "payout": "92.5", + "sessionRpl": "42.5", + "orderId": "1234567890" + } + ], + "cursor": "" + }, + "retExtInfo": {}, + "time": 1694402560000 +} +``` diff --git a/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/event/trade/submit-quote.mdx b/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/event/trade/submit-quote.mdx new file mode 100644 index 0000000000..9b2e1734cf --- /dev/null +++ b/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/event/trade/submit-quote.mdx @@ -0,0 +1,64 @@ +--- +title: 提交報價 +sidebar_label: 提交報價 +sidebar_position: 6 +--- + +為 Event Contract 交易對提交賠付比率報價。 + +:::info +* 僅 **Event Contract maker 帳戶**可訪問此接口。 +::: + +### HTTP 請求 + + +### 請求參數 +| 參數 | 是否必需 | 類型 | 說明 | +|:-----|:---------|:-----|:-----| +|symbol |**true** |string |交易對名稱,如 `ETHUSDT-28AUG26-2450-2570-OUT`| +|orderLinkId |**true** |string |用戶自定義訂單 ID| +|grossPayoutRatio |**true** |string |機構報出的毛賠付比率| +|amount |**true** |string |本次報價金額(結算幣種)| + +### 返回參數 +| 參數 | 類型 | 說明 | +|:-----|:-----|:-----| +|orderLinkId |string |用戶自定義訂單 ID| +|orderId |string |訂單 ID| + +--- + +### 請求示例 + +```http +POST /v5/event/quotes HTTP/1.1 +Host: api.bybit.com +X-BAPI-SIGN: XXXXX +X-BAPI-API-KEY: xxxxxxxxxxxxxxxxxx +X-BAPI-TIMESTAMP: 1694402559000 +X-BAPI-RECV-WINDOW: 5000 +Content-Type: application/json + +{ + "orderLinkId": "xxxx", + "symbol": "ETHUSDT-28AUG26-2450-2570-OUT", + "grossPayoutRatio": "0.5", + "amount": "100" +} +``` + +### 返回示例 + +```json +{ + "retCode": 0, + "retMsg": "OK", + "result": { + "orderLinkId": "xxxxxx", + "orderId": "xxxxxxxxxxefffff" + }, + "retExtInfo": {}, + "time": 1672217377164 +} +``` diff --git a/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/event/websocket/.gitkeep b/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/event/websocket/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/event/websocket/private/execution.mdx b/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/event/websocket/private/execution.mdx new file mode 100644 index 0000000000..32cb86eb85 --- /dev/null +++ b/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/event/websocket/private/execution.mdx @@ -0,0 +1,117 @@ +--- +title: 成交 +sidebar_label: 成交 +sidebar_position: 2 +--- + +訂閱 `execution` 或 `execution.event` 主題,實時接收 Event Contract 成交更新推送。 + +**Topic:** `execution` / `execution.event` + +:::info +* 訂閱私有主題前需先完成身份驗證。 +* 當 Event Contract 訂單發生成交(完全或部分成交)時推送。 +::: + +### 返回參數 +| 參數 | 類型 | 說明 | +|:-----|:-----|:-----| +|id |string |消息 ID| +|topic |string |Topic 名稱| +|creationTime |number |數據創建時間戳(毫秒)| +|data |array |對象| +|> category |string |產品類型。`event`| +|> transId |string |交易 ID| +|> execId |string |成交 ID| +|> orderId |string |訂單 ID| +|> orderLinkId |string |用戶自定義訂單 ID| +|> symbol |string |交易對名稱| +|> symbolId |integer |交易對 ID| +|> baseCoin |string |標的幣種| +|> quoteCoin |string |計價幣種| +|> settleCoin |string |結算幣種| +|> side |string |方向:`Buy` 或 `Sell`| +|> feeCoin |string |手續費幣種| +|> [execType](../../../../enum#exectype) |string |成交類型:`Trade`、`Settle`| +|> execPrice |string |成交價格(賠付比率)| +|> execValue |string |成交金額| +|> execFee |string |成交手續費| +|> execFeeRate |string |成交手續費率| +|> orderPrice |string |訂單價格| +|> ecContractType |integer |事件合約類型| +|> ecDirection |integer |方向| +|> ecDurationWindow |integer |持續時間窗口(秒)| +|> ecTargetPrice |string |目標價格,僅 Target 類型適用| +|> ecLowerBound |string |下限價格,僅 Range 類型適用| +|> ecUpperBound |string |上限價格,僅 Range 類型適用| +|> ecOrderValue |string |Event Contract 訂單金額| +|> ecIndexPrice |string |成交時的指數價格| +|> ecPayout |string |本次成交的 Event Contract 賠付金額| +|> entryPrice |string |入場價格| +|> settlePrice |string |結算價格| +|> grossPayoutRatio |string |毛賠付比率| +|> sessionRpl |string |本次持倉已結盈虧| +|> transTime |string |成交時間(毫秒)| +|> settleTimeMs |string |結算時間(毫秒)| +|> crossSeq |string |跨業務序號| +|> [timeInForce](../../../../enum#timeinforce) |string |訂單有效期,如 `GoodTillCancel`| +|> extraFees |array |額外費用| + +### 訂閱示例 +```json +{ + "op": "subscribe", + "args": [ + "execution" + ] +} +``` + +### 推送示例 + +```json +{ + "topic": "execution", + "id": "1509583_ETHUSDT-5MIN-UP_1311", + "creationTime": 1787635282379, + "data": [ + { + "category": "event", + "transId": "0176bba4-66fa-542b-af33-cea000a83dc0", + "execId": "0176bba4-66fa-542b-af33-cea000a83dc0", + "orderId": "746a6c87-a6dd-4008-8889-37e694046681", + "orderLinkId": "cjm1119", + "symbol": "ETHUSDT-5MIN-UP", + "symbolId": 500000, + "baseCoin": "ETH", + "quoteCoin": "USDT", + "settleCoin": "USDT", + "side": "Sell", + "feeCoin": "USDT", + "execType": "Trade", + "execPrice": "3.5", + "execValue": "100", + "execFee": "4.28571429", + "execFeeRate": "0.04285715", + "orderPrice": "3.5", + "ecContractType": 1, + "ecDirection": 1, + "ecDurationWindow": 300, + "ecTargetPrice": "", + "ecLowerBound": "", + "ecUpperBound": "", + "ecOrderValue": "5000", + "ecPayout": "350", + "entryPrice": "3.5", + "settlePrice": "2503.50730825", + "grossPayoutRatio": "3.5", + "sessionRpl": "0", + "transTime": "1787635282374", + "settleTimeMs": "1787635582374", + "crossSeq": "1311", + "timeInForce": "GoodTillCancel", + "extraFees": [] + } + ] +} +``` diff --git a/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/event/websocket/private/order.mdx b/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/event/websocket/private/order.mdx new file mode 100644 index 0000000000..22cebc8219 --- /dev/null +++ b/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/event/websocket/private/order.mdx @@ -0,0 +1,110 @@ +--- +title: 訂單 +sidebar_label: 訂單 +sidebar_position: 3 +--- + +訂閱 `order` 或 `order.event` 主題,實時接收 Event Contract 訂單狀態更新推送。 + +**Topic:** `order` / `order.event` + +:::info +* 訂閱私有主題前需先完成身份驗證。 +* 當 Event Contract 訂單狀態發生變化時推送(如成交、部分成交、取消等)。 +::: + +### 返回參數 +| 參數 | 類型 | 說明 | +|:-----|:-----|:-----| +|id |string |消息 ID| +|topic |string |Topic 名稱| +|creationTime |number |數據創建時間戳(毫秒)| +|data |array |對象| +|> category |string |產品類型。`event`| +|> orderId |string |訂單 ID| +|> orderLinkId |string |用戶自定義訂單 ID| +|> symbol |string |交易對名稱| +|> symbolId |integer |交易對 ID| +|> side |string |方向:`Buy` 或 `Sell`| +|> baseCoin |string |標的幣種| +|> quoteCoin |string |計價幣種| +|> settleCoin |string |結算幣種| +|> orderStatus |string |訂單狀態:`New`、`PartiallyFilled`、`Filled`、`Cancelled`、`Rejected`| +|> ecContractType |string |事件合約類型:`UpDown`、`Target`、`Range`| +|> ecDirection |string |方向:`UP`/`DOWN`(UpDown 類型),`ABOVE`/`BELOW`(Target 類型),`RANGE_IN`/`RANGE_OUT`(Range 類型)| +|> ecDurationWindow |integer |持續時間窗口(秒)| +|> ecTargetPrice |string |目標價格,僅 Target 類型適用| +|> ecLowerBound |string |下限價格,僅 Range 類型適用| +|> ecUpperBound |string |上限價格,僅 Range 類型適用| +|> ecOrderValue |string |Event Contract 訂單金額| +|> ecIndexPrice |string |下單時的指數價格| +|> ecSettleTime |string |預計結算時間(毫秒)| +|> payoutRatio |string |訂單賠付比率(價格)| +|> orderAvgPayoutRatio |string |已成交部分的平均賠付比率| +|> cumExecValue |string |累計成交金額| +|> cumExecFee |string |累計已結算手續費| +|> leavesValue |string |剩餘未成交金額| +|> cumPayout |string |累計賠付金額| +|> createType |integer |訂單創建類型| +|> cancelType |string |取消類型| +|> rejectReason |string |拒絕原因| +|> extraFees |array |額外費用| +|> transTime |string |成交時間(毫秒)| +|> createdTime |string |訂單創建時間(毫秒)| +|> updatedTime |string |訂單更新時間(毫秒)| + +### 訂閱示例 +```json +{ + "op": "subscribe", + "args": [ + "order" + ] +} +``` + +### 推送示例 + +```json +{ + "topic": "order", + "id": "1509583_ETHUSDT-5MIN-UP_1311", + "creationTime": 1787635282379, + "data": [ + { + "category": "event", + "orderId": "746a6c87-a6dd-4008-8889-37e694046681", + "orderLinkId": "cjm1119", + "symbol": "ETHUSDT-5MIN-UP", + "symbolId": 500000, + "side": "Sell", + "baseCoin": "ETH", + "quoteCoin": "USDT", + "settleCoin": "USDT", + "orderStatus": "PartiallyFilled", + "ecContractType": "UpDown", + "ecDirection": "UP", + "ecDurationWindow": 300, + "ecTargetPrice": "", + "ecLowerBound": "", + "ecUpperBound": "", + "ecOrderValue": "5000", + "ecIndexPrice": "2503.50730825", + "ecSettleTime": "1787635582374", + "payoutRatio": "3.5", + "orderAvgPayoutRatio": "3.5000035", + "cumExecValue": "200", + "cumExecFee": "8.57142858", + "leavesValue": "4800", + "cumPayout": "700", + "createType": 1, + "cancelType": "UNKNOWN", + "rejectReason": "EC_NoError", + "extraFees": [], + "transTime": "1787635282374", + "createdTime": "1787635103917", + "updatedTime": "1787635103917" + } + ] +} +``` diff --git a/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/event/websocket/private/position.mdx b/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/event/websocket/private/position.mdx new file mode 100644 index 0000000000..07fb34a43e --- /dev/null +++ b/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/event/websocket/private/position.mdx @@ -0,0 +1,72 @@ +--- +title: 持倉 +sidebar_label: 持倉 +sidebar_position: 1 +--- + +訂閱 `position.event` 主題,實時接收 Event Contract 倉位更新推送。 + +**Topic:** `position.event` + +:::info +* 訂閱私有主題前需先完成身份驗證。 +* 以下情況會觸發推送:新建 Event Contract 倉位(訂單成交)、倉位金額變動(部分成交)、倉位結算(`cumClosedPnl` 更新)。 +::: + +### 返回參數 +| 參數 | 類型 | 說明 | +|:-----|:-----|:-----| +|id |string |消息 ID| +|topic |string |Topic 名稱| +|creationTime |number |數據創建時間戳(毫秒)| +|data |array |對象| +|> symbol |string |交易對名稱| +|> baseCoin |string |標的幣種| +|> settleCoin |string |結算幣種| +|> side |string |倉位方向:`Buy`(做多)、`Sell`(做空)| +|> ecContractType |string |事件合約類型:`UpDown`、`Target`、`Range`| +|> ecDirection |string |方向:`UP`/`DOWN`(UpDown 類型),`ABOVE`/`BELOW`(Target 類型),`RANGE_IN`/`RANGE_OUT`(Range 類型)| +|> avgPayoutRatio |string |平均賠付比率| +|> positionValue |string |倉位價值(累計成交金額)| +|> ecSettleTime |string |預計結算時間(毫秒)| +|> cumClosedPnl |string |累計已結算盈虧| +|> createdTime |string |倉位創建時間(毫秒)| +|> updatedTime |string |倉位更新時間(毫秒)| +|> seq |long |跨業務序號,用於排序| + +### 訂閱示例 +```json +{ + "op": "subscribe", + "args": [ + "position.event" + ] +} +``` + +### 推送示例 + +```json +{ + "id": "592324d2bce751-ad38-48eb-8f42-4671d1fb4d4e", + "topic": "position.event", + "creationTime": 1694515703798, + "data": [ + { + "symbol": "ETHUSDT-28AUG26-2450-2570-OUT", + "baseCoin": "BTC", + "settleCoin": "USDT", + "side": "Buy", + "ecContractType": "UpDown", + "ecDirection": "UP", + "avgPayoutRatio": "1.85", + "positionValue": "100", + "ecSettleTime": "1694515498753", + "cumClosedPnl": "50.5", + "createdTime": "1694402559843", + "updatedTime": "1694515498753", + "seq": 31413030 + } + ] +} +``` diff --git a/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/event/websocket/public/.gitkeep b/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/event/websocket/public/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/event/websocket/public/orderbook.mdx b/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/event/websocket/public/orderbook.mdx new file mode 100644 index 0000000000..5ad4e7f605 --- /dev/null +++ b/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/event/websocket/public/orderbook.mdx @@ -0,0 +1,97 @@ +--- +title: 訂單簿 +sidebar_label: 訂單簿 +sidebar_position: 1 +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +訂閱 Event Contract 訂單簿數據流,支持 **25 檔**行情。 + +推送頻率:**20ms** + +**Topic:**
+`orderbook.25.{symbol}`,如 `orderbook.25.ETHUSDT-28AUG26-2450-2570-OUT` + +### 快照/增量處理說明 + +訂閱成功後,首先收到 `snapshot` 全量數據。之後每次訂單簿變動,系統推送 `delta` 增量數據。若收到新的 `snapshot`,需重置本地訂單簿。 + +增量更新規則: +* 收到 size = `0`:刪除該條目 +* 收到不存在的條目:插入新條目 +* 收到已存在的條目:更新 size + +### 返回參數 +| 參數 | 類型 | 說明 | +|:-----|:-----|:-----| +|topic |string |Topic 名稱| +|type |string |數據類型:`snapshot`、`delta`| +|ts |number |系統生成數據的時間戳(毫秒)| +|data |map |對象| +|> s |string |交易對名稱| +|> r |array |賠付比率訂單簿條目,最多 25 檔| +|>> r[0] |string |賠付比率(價格)| +|>> r[1] |string |訂單金額(數量)。為 `0` 時表示該條目需刪除| +|> u |integer |更新 ID。若 `u`=1,表示服務重啟後的快照,需重置本地訂單簿| +|> seq |integer |跨業務序號,seq 越小說明數據越早生成| +|cts |number |撮合引擎生成此數據的時間戳| + +### 訂閱示例 + +```json +{ + "op": "subscribe", + "args": [ + "orderbook.25.ETHUSDT-28AUG26-2450-2570-OUT" + ] +} +``` + +### 推送示例 + + + + +```json +{ + "topic": "orderbook.25.ETHUSDT-28AUG26-2450-2570-OUT", + "ts": 1787794783020, + "type": "snapshot", + "data": { + "s": "ETHUSDT-28AUG26-2450-2570-OUT", + "r": [ + ["3.5", "14900"], + ["2.28", "500"], + ["2.07", "500"] + ], + "u": 702, + "seq": 49115 + }, + "cts": 1787794647814 +} +``` + + + + +```json +{ + "topic": "orderbook.25.ETHUSDT-28AUG26-2450-2570-OUT", + "ts": 1787798930119, + "type": "delta", + "data": { + "s": "ETHUSDT-28AUG26-2450-2570-OUT", + "r": [ + ["2.39", "0"] + ], + "u": 724, + "seq": 50266 + }, + "cts": 1787798930117 +} +``` + + + diff --git a/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/event/websocket/public/public-trade.mdx b/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/event/websocket/public/public-trade.mdx new file mode 100644 index 0000000000..ca2f6ae51c --- /dev/null +++ b/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/event/websocket/public/public-trade.mdx @@ -0,0 +1,57 @@ +--- +title: 成交 +sidebar_label: 成交 +sidebar_position: 2 +--- + +訂閱 Event Contract 公共成交數據流,每筆成交實時推送。 + +推送頻率:**實時** + +**Topic:**
+`publicTrade.{symbol}`,如 `publicTrade.ETHUSDT-28AUG26-2450-2570-OUT` + +### 返回參數 +| 參數 | 類型 | 說明 | +|:-----|:-----|:-----| +|topic |string |Topic 名稱| +|type |string |數據類型:`snapshot`| +|ts |number |系統生成數據的時間戳(毫秒)| +|data |array |對象,按成交時間升序排列| +|> T |number |訂單成交時間戳(毫秒)| +|> s |string |交易對名稱| +|> r |string |賠付比率(成交價格)| +|> a |string |成交金額(訂單金額)| +|> i |string |成交 ID| +|> seq |integer |跨業務序號| + +### 訂閱示例 + +```json +{ + "op": "subscribe", + "args": [ + "publicTrade.ETHUSDT-28AUG26-2450-2570-OUT" + ] +} +``` + +### 推送示例 + +```json +{ + "topic": "publicTrade.ETHUSDT-28AUG26-2450-2570-OUT", + "ts": 1787794797536, + "type": "snapshot", + "data": [ + { + "T": 1787794797534, + "s": "ETHUSDT-28AUG26-2450-2570-OUT", + "r": "3.5", + "a": "100", + "i": "ea89cadf-6471-5fd4-8248-20b470d8478b", + "seq": 49139 + } + ] +} +``` diff --git a/sidebars.js b/sidebars.js index 5886634870..b3568d41d1 100644 --- a/sidebars.js +++ b/sidebars.js @@ -350,6 +350,33 @@ const sidebars = { }, ] }, + { + type: 'category', + label: 'Event Trading', + items: [ + 'v5/event/introduction', + { + type: 'category', + label: 'Market', + items: [ + { + type: 'autogenerated', + dirName: 'v5/event/market' + } + ] + }, + { + type: 'category', + label: 'Trade', + items: [ + { + type: 'autogenerated', + dirName: 'v5/event/trade' + } + ] + }, + ] + }, { type: 'category', label: 'Affiliate', @@ -882,6 +909,32 @@ const sidebars = { ] } ] + }, + { + type: 'category', + label: 'Event Trading', + items: [ + { + type: 'category', + label: 'Public', + items: [ + { + type: 'autogenerated', + dirName: 'v5/event/websocket/public' + } + ] + }, + { + type: 'category', + label: 'Private', + items: [ + { + type: 'autogenerated', + dirName: 'v5/event/websocket/private' + } + ] + } + ] } ] },