diff --git a/docs/v5/enum.mdx b/docs/v5/enum.mdx index 8a38e10d9c..b9cf3c0fd3 100644 --- a/docs/v5/enum.mdx +++ b/docs/v5/enum.mdx @@ -846,4 +846,71 @@ with the example of BTCUSDT: * `Pending` * `Success` * `Settled` -* `Fail` \ No newline at end of file +* `Fail` + +### stocks + +### stocks-side +* `BUY` Buy +* `SELL` Sell + +### stocks-type +* `MARKET` Market order. Uses `notional` (USDC amount) when `BUY`; uses `qty` (shares) when `SELL` +* `LIMIT` Limit order. Requires `qty` and `limitPrice` +* `STOP` Stop order. Requires `qty` and `stopPrice`. Executes as market after the trigger +* `STOP_LIMIT` Stop-limit order. Requires `qty`, `stopPrice` and `limitPrice`. Places a limit order after the trigger + +### stocks-timeInForce +* `DAY` Day order. Auto-cancelled at the main US market close +* `GTC` Good Till Cancelled +* `IOC` Immediate or Cancel. Any unfilled portion is cancelled immediately + +**Note:** `SELL` only supports `DAY` and `GTC`. `IOC` is supported but constrained to `LIMIT` + whole-share + `RTH`. + +### stocks-tradingSession +* `RTH` Regular Trading Hours (default) +* `24H` 24-hour session, including pre-market, post-market and overnight. Non-`RTH` sessions accept `LIMIT` orders only + +### stocks-orderStatus +* `PENDING` Order accepted and queued for execution. Returned as the initial status by Place Order +* `queued` Queued — order submitted, waiting for market open to execute +* `active` Active — order is live and waiting for fill conditions +* `filled` Filled — order fully filled +* `partial_filled` Cancelled after partial fill — order was cancelled/failed with some prior fills +* `cancelled` Cancelled — order was cancelled/failed with no fills + +### stocks-convertType +* `MINT` Underlying → mStocks Token +* `REDEEM` mStocks Token → Underlying + +### stocks-convertStatus +* `PENDING` Processing +* `SUCCESS` Completed +* `FAILED` Failed + +### stocks-accountType +* `all` Auto-select account (default) +* `uta` Route into the Unified Trading Account (UTA) +* `fund` Route into the Funding Account + +### stocks-flow +* `CEX` Centralized exchange flow. Both Mint and Burn are processed through the Bybit main site +* `DEX` Decentralized flow. Mint to the specified contract address; Burn flow depends on `burnScene` + +### stocks-burnScene +* `DEP` Burn through the Bybit main site (Deposit) +* `NDP` Burn without going through the main site (Non-Deposit) + +### stocks-symbolType +* `US_STOCK` US stock. Currently the only supported instrument type + +### stocks-statusCode +* `1` Pre-market (04:00–09:30 ET, XNYS/XNAS only) +* `2` Regular hours (09:30–16:00 ET, XNYS/XNAS) +* `3` Post-market (16:00–20:00 ET, XNYS/XNAS only) +* `4` Overnight session (20:00 ET–next day 04:00 ET, OCEA) +* `5` Closed (weekends, holidays, off-hours) + +### stocks-tradingHolidayType +* `HOLIDAY` Statutory holiday. Market closed all day +* `EARLY_CLOSE` Early close. `endTime` is the actual close time of that day diff --git a/docs/v5/stocks/cancel-order.mdx b/docs/v5/stocks/cancel-order.mdx new file mode 100644 index 0000000000..6880db7bf5 --- /dev/null +++ b/docs/v5/stocks/cancel-order.mdx @@ -0,0 +1,63 @@ +--- +title: Cancel Stock Order +sidebar_label: Cancel Stock Order +sidebar_position: 2 +--- +Cancel a stock buy or sell order by order number. + +:::info important +- This endpoint is only available for Market Maker. +- Only non-terminal orders (`queued` / `active`) can be cancelled. +- The cancel request is dispatched asynchronously to the router. A successful response does not mean the order has been cancelled on the venue. Please poll the [Get Stock Order Detail](./order-detail) endpoint to confirm the final status. +::: + +### HTTP Request + + +### Request Parameters +| Parameter | Required | Type | Comments| +|:----- |:-------|:-----|------ | +|orderNo |**true** |string |System order number | + +### Response Parameters +| Parameter | Type | Comments| +|:----- |:-----|----- | +|orderNo |string |Echo of the order number | + +--- + +### Request Example + + + + +```http +POST /v5/rwa/stocks/order/cancel HTTP/1.1 +Host: api-testnet.bybit.com +X-BAPI-API-KEY: xxxxxxxxxxxxxxxxxx +X-BAPI-TIMESTAMP: 1787657753833 +X-BAPI-RECV-WINDOW: 5000 +X-BAPI-SIGN: XXXXX +Content-Type: application/json + +{ + "orderNo": "SB227696733955111526412" +} +``` + + + + +### Response Example + +```json +{ + "retCode": 0, + "retMsg": "ok", + "result": { + "orderNo": "SB227696733955111526412" + }, + "retExtInfo": {}, + "time": 1787657753833 +} +``` diff --git a/docs/v5/stocks/convert-detail.mdx b/docs/v5/stocks/convert-detail.mdx new file mode 100644 index 0000000000..ab10e577aa --- /dev/null +++ b/docs/v5/stocks/convert-detail.mdx @@ -0,0 +1,80 @@ +--- +title: Get Convert Detail +sidebar_label: Get Convert Detail +sidebar_position: 6 +--- +Query the full status and settlement result of a single Convert order by order number or idempotency key. Used for MM reconciliation, status polling and failure diagnosis. + +:::info +This endpoint is only available for Market Maker. +::: + +### HTTP Request + + +### Request Parameters +| Parameter | Required | Type | Comments| +|:----- |:-------|:-----|------ | +|orderNo |false |string |Convert order number. Either `orderNo` or `requestId` is **required** | +|requestId |false |string |Idempotency key used at submission. Either `orderNo` or `requestId` is **required** | + +### Response Parameters +| Parameter | Type | Comments| +|:----- |:-----|----- | +|orderNo |string |Convert order number | +|requestId |string |Client idempotency key | +|[status](../enum#stocks-convertstatus) |string |Current order status | +|[convertType](../enum#stocks-converttype) |string |Direction | +|symbol |string |Underlying stock symbol | +|tokenSymbol |string |Corresponding mStocks Token | +|inputAmount |string |Input amount | +|outputAmount |string |Actual output amount. Estimated value when not settled | +|appliedMultiplier |string |Actually applied conversion ratio | +|[accountType](../enum#stocks-accounttype) |string |Account type. Only effective for `REDEEM` | +|failReason |string |Failure reason. Non-empty when `status=FAILED` | +|submittedAt |integer |Server accepted timestamp in milliseconds | +|updatedAt |integer |Last update timestamp in milliseconds | + +--- + +### Request Example + + + + +```http +GET /v5/rwa/stocks/convert/detail?orderNo=CVT1755590600987654321 HTTP/1.1 +Host: api-testnet.bybit.com +X-BAPI-API-KEY: xxxxxxxxxxxxxxxxxx +X-BAPI-TIMESTAMP: 1787657753833 +X-BAPI-RECV-WINDOW: 5000 +X-BAPI-SIGN: XXXXX +``` + + + + +### Response Example + +```json +{ + "retCode": 0, + "retMsg": "ok", + "result": { + "orderNo": "CVT1755590600987654321", + "requestId": "mm-cvt-20260819-0007", + "status": "SUCCESS", + "convertType": "MINT", + "symbol": "AAPL-US", + "tokenSymbol": "AAPLM", + "inputAmount": "5", + "outputAmount": "50", + "appliedMultiplier": "10", + "accountType": null, + "failReason": null, + "submittedAt": 1755590600180, + "updatedAt": 1755590620400 + }, + "time": 1724534400123 +} +``` diff --git a/docs/v5/stocks/convert-list.mdx b/docs/v5/stocks/convert-list.mdx new file mode 100644 index 0000000000..0c07992919 --- /dev/null +++ b/docs/v5/stocks/convert-list.mdx @@ -0,0 +1,71 @@ +--- +title: Get Convert List +sidebar_label: Get Convert List +sidebar_position: 4 +--- +Query the currently supported Convert symbols and live rate snapshots. Used for quote display and front-end snapshot validation before submitting a Convert request. + +:::info +This endpoint is only available for Market Maker. +::: + +### HTTP Request + + +### Request Parameters +| Parameter | Required | Type | Comments| +|:----- |:-------|:-----|------ | +|symbol |false |string |Filter by symbol, e.g. `AAPL-US`. Returns all supported symbols if omitted | + +### Response Parameters +| Parameter | Type | Comments| +|:----- |:-----|----- | +|data |array<object> |Convert symbol list | +|> symbol |string |Underlying stock symbol, e.g. `AAPL-US` | +|> tokenSymbol |string |Corresponding mStocks Token, e.g. `AAPLM` | +|> multiplier |string |Currently effective conversion ratio (1 share of underlying → N Tokens) | +|> mintEnabled |boolean |Whether MINT (underlying → Token) is allowed | +|> redeemEnabled |boolean |Whether REDEEM (Token → underlying) is allowed | +|> minInputAmount |string |Minimum input amount per submission | + +--- + +### Request Example + + + + +```http +GET /v5/rwa/stocks/convert/list HTTP/1.1 +Host: api-testnet.bybit.com +X-BAPI-API-KEY: xxxxxxxxxxxxxxxxxx +X-BAPI-TIMESTAMP: 1787657753833 +X-BAPI-RECV-WINDOW: 5000 +X-BAPI-SIGN: XXXXX +``` + + + + +### Response Example + +```json +{ + "retCode": 0, + "retMsg": "ok", + "result": { + "data": [ + { + "symbol": "AAPL-US", + "tokenSymbol": "AAPLM", + "multiplier": "10", + "mintEnabled": true, + "redeemEnabled": true, + "minInputAmount": "0.1" + } + ] + }, + "retExtInfo": {}, + "time": 1787657753833 +} +``` diff --git a/docs/v5/stocks/convert-submit.mdx b/docs/v5/stocks/convert-submit.mdx new file mode 100644 index 0000000000..1bc8c6980f --- /dev/null +++ b/docs/v5/stocks/convert-submit.mdx @@ -0,0 +1,145 @@ +--- +title: Submit Convert +sidebar_label: Submit Convert +sidebar_position: 5 +--- +Submit a Convert order. Supports both directions: `MINT` (underlying → mStocks Token) and `REDEEM` (mStocks Token → underlying). The client must attach the rate snapshot `multiplier` obtained from [Get Convert List](./convert-list); the server validates it against the currently effective ratio to prevent execution anomalies caused by rate jumps. + +:::info +This endpoint is only available for Market Maker. +::: + +### HTTP Request + + +### Request Parameters +| Parameter | Required | Type | Comments| +|:----- |:-------|:-----|------ | +|[convertType](../enum#stocks-converttype) |**true** |string |Direction. `MINT`, `REDEEM` | +|symbol |**true** |string |Underlying stock symbol, e.g. `AAPL-US` | +|inputAmount |**true** |string |Input amount. Number of underlying shares when `MINT`; number of Tokens when `REDEEM` | +|frontMultiplier |**true** |string |Conversion ratio from the front-end snapshot | +|[accountType](../enum#stocks-accounttype) |false |string |Only effective when `REDEEM`. `all` (default), `uta`, `fund` | +|requestId |**true** |string |Idempotency key. Length ≤ 36. Alphanumeric plus `-` `_`. Must be unique within 24 hours for the same MM account | +|contractAddr |false |string |Token receive address when `MINT`; Token provide address when `REDEEM`. **Do not send when `flow=DEX` and `burnScene=NDP`** | +|[flow](../enum#stocks-flow) |**true** |string |`CEX`, `DEX`. `MINT` flows are identical across CEX/DEX (mint to the specified address). `REDEEM` (burn) flows differ between CEX and DEX | +|[burnScene](../enum#stocks-burnscene) |false |string |Scene for **DEX `REDEEM` (burn)**: `DEP` (through Bybit main site), `NDP` (not through Bybit main site) | + +### Response Parameters +| Parameter | Type | Comments| +|:----- |:-----|----- | +|orderNo |string |Convert order number | +|[status](../enum#stocks-convertstatus) |string |Initial Convert status | +|[convertType](../enum#stocks-converttype) |string |Echo of direction | +|symbol |string |Echo of symbol | +|inputAmount |string |Echo of input amount | +|outputAmount |string |Output amount | +|appliedMultiplier |string |Actually applied conversion ratio | +|submittedAt |integer |Server accepted timestamp in milliseconds | + +--- + +### Request Example + + + + +```http +POST /v5/rwa/stocks/convert/submit HTTP/1.1 +Host: api-testnet.bybit.com +X-BAPI-API-KEY: xxxxxxxxxxxxxxxxxx +X-BAPI-TIMESTAMP: 1787657753833 +X-BAPI-RECV-WINDOW: 5000 +X-BAPI-SIGN: XXXXX +Content-Type: application/json + +{ + "convertType": "MINT", + "symbol": "TSLA-US", + "inputAmount": "1", + "frontMultiplier": "1", + "requestId": "mm-cvt-20260825-0001" +} +``` + + + + +### Response Example + +```json +{ + "retCode": 0, + "retMsg": "ok", + "result": { + "orderNo": "MM20240825001", + "status": "PENDING", + "convertType": "MINT", + "symbol": "AAPL", + "inputAmount": "100", + "outputAmount": "1", + "appliedMultiplier": "100", + "submittedAt": 1724534400000 + }, + "time": 1724534400123 +} +``` + +### Scenario Examples + +```json +// Scenario 1: CEX Mint (Underlying → Token) +{ + "convertType": "MINT", + "symbol": "AAPL-US", + "inputAmount": "5", + "frontMultiplier": "10", + "flow": "CEX", + "contractAddr": "0xabc...", + "requestId": "mm-001" +} + +// Scenario 2: CEX Burn (Token → Underlying) +{ + "convertType": "REDEEM", + "symbol": "AAPL-US", + "inputAmount": "50", + "frontMultiplier": "10", + "flow": "CEX", + "accountType": "all", + "requestId": "mm-002" +} + +// Scenario 3: DEX Mint (Underlying → Token) +{ + "convertType": "MINT", + "symbol": "AAPL-US", + "inputAmount": "5", + "frontMultiplier": "10", + "flow": "DEX", + "contractAddr": "0xabc...", + "requestId": "mm-003" +} + +// Scenario 4a: DEX Burn through Bybit main site (DEP) +{ + "convertType": "REDEEM", + "symbol": "AAPL-US", + "inputAmount": "50", + "frontMultiplier": "10", + "flow": "DEX", + "burnScene": "DEP", + "requestId": "mm-004" +} + +// Scenario 4b: DEX Burn not through main site — on-chain transfer (NDP) +{ + "convertType": "REDEEM", + "symbol": "AAPL-US", + "inputAmount": "50", + "frontMultiplier": "10", + "flow": "DEX", + "burnScene": "NDP", + "requestId": "mm-005" +} +``` diff --git a/docs/v5/stocks/market-session.mdx b/docs/v5/stocks/market-session.mdx new file mode 100644 index 0000000000..22eaa89530 --- /dev/null +++ b/docs/v5/stocks/market-session.mdx @@ -0,0 +1,70 @@ +--- +title: Get Market Session +sidebar_label: Get Market Session +sidebar_position: 8 +--- +Query the current trading session state of the stock market and the list of non-tradable periods (early close and holidays). + +:::info +This endpoint is only available for Market Maker. +::: + +### HTTP Request + + +### Request Parameters +| Parameter | Required | Type | Comments| +|:----- |:-------|:-----|------ | +|symbol |false |string |Stock symbol, e.g. `AAPL-US` | + +### Response Parameters +| Parameter | Type | Comments| +|:----- |:-----|----- | +|[symbolType](../enum#stocks-symboltype) |string |Stock type. `US_STOCK` | +|[statusCode](../enum#stocks-statuscode) |integer |Current session state. `1`: pre-market, `2`: regular hours, `3`: post-market, `4`: overnight, `5`: closed | +|serverTime |integer |Server UTC epoch ms. Used to eliminate client local time drift | +|currentPhaseEndTime |integer |Current phase end time (epoch ms) | +|nextMarketOpenTime |integer |Next main-market open time (epoch ms) | +|stocksTradingHoliday |array<object> |All non-tradable periods | +|> [type](../enum#stocks-tradingholidaytype) |string |Type. `EARLY_CLOSE`, `HOLIDAY` | +|> startTime |string |Start time | +|> endTime |string |End time | + +--- + +### Request Example + + + + +```http +GET /v5/rwa/stocks/market/session?symbol=TSLA-US HTTP/1.1 +Host: api-testnet.bybit.com +X-BAPI-API-KEY: xxxxxxxxxxxxxxxxxx +X-BAPI-TIMESTAMP: 1787662431425 +X-BAPI-RECV-WINDOW: 5000 +X-BAPI-SIGN: XXXXX +``` + + + + +### Response Example + +```json +{ + "retCode": 0, + "retMsg": "ok", + "result": { + "symbolType": "US_STOCK", + "statusCode": 4, + "serverTime": 1787662431425, + "currentPhaseEndTime": 1787299200000, + "nextMarketOpenTime": 1787319000000, + "stocksTradingHoliday": [ + { "type": "HOLIDAY", "startTime": 1756684800000, "endTime": 1756771200000 } + ] + }, + "time": 1787662431500 +} +``` diff --git a/docs/v5/stocks/order-detail.mdx b/docs/v5/stocks/order-detail.mdx new file mode 100644 index 0000000000..67ff24b716 --- /dev/null +++ b/docs/v5/stocks/order-detail.mdx @@ -0,0 +1,95 @@ +--- +title: Get Stock Order Detail +sidebar_label: Get Stock Order Detail +sidebar_position: 3 +--- +Query the full status, parameters and fill details of a single stock order by order number or client order ID. Used for MM reconciliation, status polling and failure diagnosis. + +:::info +This endpoint is only available for Market Maker. +::: + +### HTTP Request + + +### Request Parameters +| Parameter | Required | Type | Comments| +|:----- |:-------|:-----|------ | +|orderNo |false |string |System order number. Either `orderNo` or `clientOrderId` is **required** | +|clientOrderId |false |string |Client idempotency ID. Either `orderNo` or `clientOrderId` is **required** | + +### Response Parameters +| Parameter | Type | Comments| +|:----- |:-----|----- | +|orderNo |string |System order number | +|clientOrderId |string |Client order ID (if provided at placement) | +|symbol |string |Stock symbol | +|quoteToken |string |Quote asset | +|[side](../enum#stocks-side) |string |Order side | +|[type](../enum#stocks-type) |string |Order type | +|qty |string |Order quantity (shares). May be `null` when the order was placed with `notional` | +|notional |string |Order notional amount (USDC). Non-empty only when `side=BUY` and `type=MARKET` | +|limitPrice |string |Limit price. `null` for non-limit orders | +|stopPrice |string |Trigger price. `null` for non-stop orders | +|[timeInForce](../enum#stocks-timeinforce) |string |Time in force | +|[tradingSession](../enum#stocks-tradingsession) |string |Trading session | +|tokenize |boolean |Whether to auto tokenize | +|[orderStatus](../enum#stocks-orderstatus) |string |Current order status | +|filledQty |string |Cumulative filled quantity (shares) | +|filledNotional |string |Cumulative filled amount (USDC) | +|avgPrice |string |Average fill price (USD). `"0"` when not filled | +|failReason |string |Failure reason. Value comes from the [orderStatus](../enum#stocks-orderstatus) enum | +|orderTime |integer |Client order timestamp in milliseconds | +|updatedAt |integer |Last update timestamp in milliseconds | + +--- + +### Request Example + + + + +```http +GET /v5/rwa/stocks/order/detail?orderNo=SB227696733955111526412 HTTP/1.1 +Host: api-testnet.bybit.com +X-BAPI-API-KEY: xxxxxxxxxxxxxxxxxx +X-BAPI-TIMESTAMP: 1787657753833 +X-BAPI-RECV-WINDOW: 5000 +X-BAPI-SIGN: XXXXX +``` + + + + +### Response Example + +```json +{ + "retCode": 0, + "retMsg": "ok", + "result": { + "orderNo": "SB227696733955111526412", + "clientOrderId": "", + "symbol": "TSLA-US", + "quoteToken": "USDC", + "side": "BUY", + "type": "LIMIT", + "qty": "2", + "notional": "", + "limitPrice": "350", + "stopPrice": "", + "timeInForce": "DAY", + "tradingSession": "RTH", + "tokenize": false, + "orderStatus": "cancelled", + "filledQty": "0", + "filledNotional": "0", + "avgPrice": "0", + "failReason": "", + "orderTime": 1786171659000, + "updatedAt": 1786419757000 + }, + "retExtInfo": {}, + "time": 1787657753833 +} +``` diff --git a/docs/v5/stocks/place-order.mdx b/docs/v5/stocks/place-order.mdx new file mode 100644 index 0000000000..5f30901344 --- /dev/null +++ b/docs/v5/stocks/place-order.mdx @@ -0,0 +1,89 @@ +--- +title: Place Stock Order +sidebar_label: Place Stock Order +sidebar_position: 1 +--- +This endpoint submits a stock buy or sell order. Buy orders are quoted in USDC, while sell orders are quoted in the number of underlying shares. + +:::info +- This endpoint is only available for Market Maker. +- **Supported order type:** `MARKET`, `LIMIT`, `STOP`, `STOP_LIMIT` +::: + +### HTTP Request + + +### Request Parameters +| Parameter | Required | Type | Comments| +|:----- |:-------|:-----|------ | +|symbol |**true** |string |Stock symbol, e.g. `TSLA-US`, `AAPL-US`| +|quoteToken |**true** |string |Quote asset. Currently only `USDC` is supported| +|[side](../enum#stocks-side) |**true** |string |`BUY`, `SELL`| +|[type](../enum#stocks-type) |**true** |string |Order type. `MARKET`, `LIMIT`, `STOP`, `STOP_LIMIT`| +|qty |false |string |Order quantity. **Required** for `SELL`; **required** for `BUY` with `type=LIMIT`/`STOP`/`STOP_LIMIT`. Mutually exclusive with `notional`| +|notional |false |string |Notional amount (USDC). Only valid when `side=BUY` and `type=MARKET`. Mutually exclusive with `qty`| +|limitPrice |false |string |Limit price. **Required** when `type=LIMIT` or `STOP_LIMIT`| +|stopPrice |false |string |Trigger price. **Required** when `type=STOP` or `STOP_LIMIT`| +|[timeInForce](../enum#stocks-timeinforce) |**true** |string |Time in force: `DAY` / `GTC` / `IOC`. `SELL` only supports `DAY` / `GTC`; `IOC` requires `type=LIMIT` + whole-share `qty` + `tradingSession=RTH` | +|[tradingSession](../enum#stocks-tradingsession) |false |string |Trading session. `RTH` (default), `24H`. Non-`RTH` sessions accept `LIMIT` orders only | +|tokenize |false |boolean |Whether to auto tokenize after the order is filled. Default: `false`. Only valid for `BUY`| +|orderTime |**true** |integer |Client order timestamp in milliseconds| + +### Response Parameters +| Parameter | Type | Comments| +|:----- |:-----|----- | +|orderNo |string |System order number | +|[orderStatus](../enum#stocks-orderstatus) |string |Initial order status | +|acceptedTime |integer |Server accepted timestamp in milliseconds | + +:::info +The acknowledgement of a place order request indicates that the request was successfully accepted. Please poll the [Get Stock Order Detail](./order-detail) endpoint to confirm the final order status. +::: + +--- + +### Request Example + + + + +```http +POST /v5/rwa/stocks/order HTTP/1.1 +Host: api-testnet.bybit.com +X-BAPI-API-KEY: xxxxxxxxxxxxxxxxxx +X-BAPI-TIMESTAMP: 1787656687706 +X-BAPI-RECV-WINDOW: 5000 +X-BAPI-SIGN: XXXXX +Content-Type: application/json + +{ + "symbol": "TSLA-US", + "quoteToken": "USDC", + "side": "BUY", + "type": "LIMIT", + "qty": "2", + "limitPrice": "300.00", + "timeInForce": "DAY", + "tradingSession": "RTH", + "orderTime": 1787656687706 +} +``` + + + + +### Response Example + +```json +{ + "retCode": 0, + "retMsg": "ok", + "result": { + "orderNo": "SB227696733955111526412", + "orderStatus": "PENDING", + "acceptedTime": 1787657753833 + }, + "retExtInfo": {}, + "time": 1755590400200 +} +``` diff --git a/docs/v5/stocks/positions.mdx b/docs/v5/stocks/positions.mdx new file mode 100644 index 0000000000..2cb569ae30 --- /dev/null +++ b/docs/v5/stocks/positions.mdx @@ -0,0 +1,69 @@ +--- +title: Get Stock Positions +sidebar_label: Get Stock Positions +sidebar_position: 7 +--- +Query all underlying stock position snapshots under the current MM account, including total holdings, available holdings, pending shares. + +:::info +This endpoint is only available for Market Maker. +::: + +### HTTP Request + + +### Request Parameters +| Parameter | Required | Type | Comments| +|:----- |:-------|:-----|------ | +|symbol |false |string |Stock symbol, e.g. `AAPL-US`. Filter by symbol; returns all positions if omitted | +|showZero |false |boolean |Whether to return zero-quantity positions. Default: `false` | + +### Response Parameters +| Parameter | Type | Comments| +|:----- |:-----|----- | +|data |array<object> |Position list | +|> symbol |string |Stock symbol | +|> qty |string |Total position quantity (shares) | +|> availableQty |string |Available position (sellable / transferable) | +|> pendingQty |string |Pending position (locked by pending settlements or orders) | +|> updatedAt |integer |Snapshot update timestamp in milliseconds | + +--- + +### Request Example + + + + +```http +GET /v5/rwa/stocks/positions?showZero=false HTTP/1.1 +Host: api-testnet.bybit.com +X-BAPI-API-KEY: xxxxxxxxxxxxxxxxxx +X-BAPI-TIMESTAMP: 1787657753833 +X-BAPI-RECV-WINDOW: 5000 +X-BAPI-SIGN: XXXXX +``` + + + + +### Response Example + +```json +{ + "retCode": 0, + "retMsg": "ok", + "result": { + "data": [ + { + "symbol": "AAPL", + "qty": "100", + "availableQty": "80", + "pendingQty": "20", + "updatedAt": 1724534400000 + } + ] + }, + "time": 1724534400123 +} +``` diff --git a/i18n/zh-TW/docusaurus-plugin-content-docs/current.json b/i18n/zh-TW/docusaurus-plugin-content-docs/current.json index 70832ecf6a..bc9e7e041b 100644 --- a/i18n/zh-TW/docusaurus-plugin-content-docs/current.json +++ b/i18n/zh-TW/docusaurus-plugin-content-docs/current.json @@ -3,6 +3,10 @@ "message": "Bybit 平台", "description": "The label for category Bybit Platform in sidebar v5SideBar" }, + "sidebar.v5SideBar.category.Stocks": { + "message": "股票", + "description": "The label for category Stocks in sidebar v5SideBar" + }, "sidebar.v5SideBar.category.Web3": { "message": "Web3", "description": "The label for category Web3 in sidebar v5SideBar" 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 5c0742e7b1..b83b97bd3e 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 @@ -849,4 +849,71 @@ _期權_: * `Pending` * `Success` * `Settled` -* `Fail` \ No newline at end of file +* `Fail` + +### stocks + +### stocks-side +* `BUY` 買入 +* `SELL` 賣出 + +### stocks-type +* `MARKET` 市價單。`BUY` 時以 `notional`(USDC 金額)計;`SELL` 時以 `qty`(股數)計 +* `LIMIT` 限價單。需填 `qty` 和 `limitPrice` +* `STOP` 止損單。需填 `qty` 和 `stopPrice`;觸發後以市價成交 +* `STOP_LIMIT` 止損限價單。需填 `qty`、`stopPrice` 和 `limitPrice`;觸發後以限價委託 + +### stocks-timeInForce +* `DAY` 當日有效,北美主市場收盤時自動撤單 +* `GTC` 撤銷前持續有效(Good Till Cancelled) +* `IOC` 立即成交,未成交部分立即取消 + +**注意:** `SELL` 方向僅支持 `DAY` 和 `GTC`。`IOC` 支持但有約束(`LIMIT` + 整股 + `RTH`)。 + +### stocks-tradingSession +* `RTH` Regular Trading Hours,正常交易時段(默認值) +* `24H` 全天候交易時段,包含盤前 / 盤後 / 夜盤。非 `RTH` 時段只允許 `LIMIT` 單 + +### stocks-orderStatus +* `PENDING` 訂單已接收,排隊等待執行。下單接口返回的初始狀態 +* `queued` 排隊中——訂單已提交,等待市場開盤後執行 +* `active` 掛單中——訂單已生效,正在等待成交條件觸發 +* `filled` 已成交——訂單全部成交完成 +* `partial_filled` 部分成交後撤單——訂單被取消 / 失敗,但撤單前已有部分成交 +* `cancelled` 已撤銷——訂單被取消 / 失敗,且無任何成交 + +### stocks-convertType +* `MINT` 正股 → mStocks Token +* `REDEEM` mStocks Token → 正股 + +### stocks-convertStatus +* `PENDING` 處理中 +* `SUCCESS` 處理完成 +* `FAILED` 處理失敗 + +### stocks-accountType +* `all` 自動選擇賬戶(默認值) +* `uta` 指定劃入統一交易賬戶(UTA) +* `fund` 指定劃入資金賬戶 + +### stocks-flow +* `CEX` 中心化交易所鏈路,Mint / Burn 均通過 Bybit 主站處理 +* `DEX` 去中心化鏈路,Mint 到指定合約地址;Burn 流程見 `burnScene` + +### stocks-burnScene +* `DEP` Bybit 主站(Deposit)Burn +* `NDP` 不經主站(Non-Deposit)Burn + +### stocks-symbolType +* `US_STOCK` 美股。當前業務僅支持這一種 + +### stocks-statusCode +* `1` 盤前(04:00–09:30 ET,僅 XNYS/XNAS) +* `2` 盤中(09:30–16:00 ET,XNYS/XNAS) +* `3` 盤後(16:00–20:00 ET,僅 XNYS/XNAS) +* `4` 夜盤(20:00 ET–次日 04:00 ET,OCEA) +* `5` 休市(週末 / 假日 / 時段外) + +### stocks-tradingHolidayType +* `HOLIDAY` 法定假日,全天休市 +* `EARLY_CLOSE` 提前收盤,`endTime` 為當日實際收盤時間 \ No newline at end of file diff --git a/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/stocks/cancel-order.mdx b/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/stocks/cancel-order.mdx new file mode 100644 index 0000000000..d9c21996ce --- /dev/null +++ b/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/stocks/cancel-order.mdx @@ -0,0 +1,63 @@ +--- +title: 撤銷股票委託單 +sidebar_label: 撤銷股票委託單 +sidebar_position: 2 +--- +根據訂單號撤銷一筆股票買賣訂單。 + +:::info 重要 +- 本接口僅面向做市商(Market Maker)開放。 +- 僅非終態訂單(`queued` / `active`)可撤銷。 +- 撤單請求異步派發到 router,接口返回不代表已實際撤銷,需通過[查詢股票委託單詳情](./order-detail)輪詢最終狀態。 +::: + +### HTTP請求 + + +### 請求參數 +| 參數 | 是否必需 | 類型 | 說明| +|:----- |:-------|:-----|------ | +|orderNo |**true** |string |系統訂單號 | + +### 響應參數 +| 參數 | 類型 | 說明| +|:----- |:-----|----- | +|orderNo |string |回顯訂單號 | + +--- + +### 請求示例 + + + + +```http +POST /v5/rwa/stocks/order/cancel HTTP/1.1 +Host: api-testnet.bybit.com +X-BAPI-API-KEY: xxxxxxxxxxxxxxxxxx +X-BAPI-TIMESTAMP: 1787657753833 +X-BAPI-RECV-WINDOW: 5000 +X-BAPI-SIGN: XXXXX +Content-Type: application/json + +{ + "orderNo": "SB227696733955111526412" +} +``` + + + + +### 響應示例 + +```json +{ + "retCode": 0, + "retMsg": "ok", + "result": { + "orderNo": "SB227696733955111526412" + }, + "retExtInfo": {}, + "time": 1787657753833 +} +``` diff --git a/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/stocks/convert-detail.mdx b/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/stocks/convert-detail.mdx new file mode 100644 index 0000000000..e351fff539 --- /dev/null +++ b/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/stocks/convert-detail.mdx @@ -0,0 +1,80 @@ +--- +title: 查詢 Convert 訂單詳情 +sidebar_label: 查詢 Convert 訂單詳情 +sidebar_position: 6 +--- +根據訂單號或冪等鍵查詢單筆 Convert 訂單的完整狀態與結算結果。用於 MM 側對賬、狀態輪詢與失敗原因定位。 + +:::info +本接口僅面向做市商(Market Maker)開放。 +::: + +### HTTP請求 + + +### 請求參數 +| 參數 | 是否必需 | 類型 | 說明| +|:----- |:-------|:-----|------ | +|orderNo |false |string |Convert 訂單號。`orderNo` 與 `requestId` 二選一 | +|requestId |false |string |提交時使用的冪等鍵。`orderNo` 與 `requestId` 二選一 | + +### 響應參數 +| 參數 | 類型 | 說明| +|:----- |:-----|----- | +|orderNo |string |Convert 訂單號 | +|requestId |string |客戶端冪等鍵 | +|[status](../enum#stocks-convertstatus) |string |當前訂單狀態 | +|[convertType](../enum#stocks-converttype) |string |方向 | +|symbol |string |底層股票代碼 | +|tokenSymbol |string |對應的 mStocks Token | +|inputAmount |string |輸入量 | +|outputAmount |string |實際輸出量,未完成時為預估值 | +|appliedMultiplier |string |實際生效的轉換比例 | +|[accountType](../enum#stocks-accounttype) |string |賬戶類型,僅 `REDEEM` 有效 | +|failReason |string |失敗原因,`status=FAILED` 時非空 | +|submittedAt |integer |服務端受理毫秒時間戳 | +|updatedAt |integer |訂單最近變更毫秒時間戳 | + +--- + +### 請求示例 + + + + +```http +GET /v5/rwa/stocks/convert/detail?orderNo=CVT1755590600987654321 HTTP/1.1 +Host: api-testnet.bybit.com +X-BAPI-API-KEY: xxxxxxxxxxxxxxxxxx +X-BAPI-TIMESTAMP: 1787657753833 +X-BAPI-RECV-WINDOW: 5000 +X-BAPI-SIGN: XXXXX +``` + + + + +### 響應示例 + +```json +{ + "retCode": 0, + "retMsg": "ok", + "result": { + "orderNo": "CVT1755590600987654321", + "requestId": "mm-cvt-20260819-0007", + "status": "SUCCESS", + "convertType": "MINT", + "symbol": "AAPL-US", + "tokenSymbol": "AAPLM", + "inputAmount": "5", + "outputAmount": "50", + "appliedMultiplier": "10", + "accountType": null, + "failReason": null, + "submittedAt": 1755590600180, + "updatedAt": 1755590620400 + }, + "time": 1724534400123 +} +``` diff --git a/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/stocks/convert-list.mdx b/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/stocks/convert-list.mdx new file mode 100644 index 0000000000..ae828abfcb --- /dev/null +++ b/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/stocks/convert-list.mdx @@ -0,0 +1,71 @@ +--- +title: Convert 列表 +sidebar_label: Convert 列表 +sidebar_position: 4 +--- +獲取當前支持的 Convert 交易對及實時匯率快照,用於提交 Convert 前的報價展示與前端快照校驗。 + +:::info +本接口僅面向做市商(Market Maker)開放。 +::: + +### HTTP請求 + + +### 請求參數 +| 參數 | 是否必需 | 類型 | 說明| +|:----- |:-------|:-----|------ | +|symbol |false |string |按標的過濾,如 `AAPL-US`;不傳則返回全部 | + +### 響應參數 +| 參數 | 類型 | 說明| +|:----- |:-----|----- | +|data |array<object> |Convert 交易對列表 | +|> symbol |string |底層股票代碼,如 `AAPL-US` | +|> tokenSymbol |string |對應的 mStocks Token,如 `AAPLM` | +|> multiplier |string |當前生效的轉換比例(1 股正股 → 若干 Token) | +|> mintEnabled |boolean |是否允許 MINT 方向(正股→Token) | +|> redeemEnabled |boolean |是否允許 REDEEM 方向(Token→正股) | +|> minInputAmount |string |單筆最小輸入量 | + +--- + +### 請求示例 + + + + +```http +GET /v5/rwa/stocks/convert/list HTTP/1.1 +Host: api-testnet.bybit.com +X-BAPI-API-KEY: xxxxxxxxxxxxxxxxxx +X-BAPI-TIMESTAMP: 1787657753833 +X-BAPI-RECV-WINDOW: 5000 +X-BAPI-SIGN: XXXXX +``` + + + + +### 響應示例 + +```json +{ + "retCode": 0, + "retMsg": "ok", + "result": { + "data": [ + { + "symbol": "AAPL-US", + "tokenSymbol": "AAPLM", + "multiplier": "10", + "mintEnabled": true, + "redeemEnabled": true, + "minInputAmount": "0.1" + } + ] + }, + "retExtInfo": {}, + "time": 1787657753833 +} +``` diff --git a/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/stocks/convert-submit.mdx b/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/stocks/convert-submit.mdx new file mode 100644 index 0000000000..c5096394d2 --- /dev/null +++ b/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/stocks/convert-submit.mdx @@ -0,0 +1,145 @@ +--- +title: 提交 Convert +sidebar_label: 提交 Convert +sidebar_position: 5 +--- +提交一筆 Convert 訂單。支持 `MINT`(正股 → mStocks Token)與 `REDEEM`(mStocks Token → 正股)兩種方向。提交時需帶上從 [Convert 列表](./convert-list) 拿到的匯率快照 `multiplier`,服務端會校驗是否與當前生效匯率一致,防止行情跳變導致的成交異常。 + +:::info +本接口僅面向做市商(Market Maker)開放。 +::: + +### HTTP請求 + + +### 請求參數 +| 參數 | 是否必需 | 類型 | 說明| +|:----- |:-------|:-----|------ | +|[convertType](../enum#stocks-converttype) |**true** |string |方向:`MINT`, `REDEEM` | +|symbol |**true** |string |底層股票代碼,如 `AAPL-US` | +|inputAmount |**true** |string |輸入數量(`MINT` 時為正股數量,`REDEEM` 時為 Token 數量) | +|frontMultiplier |**true** |string |前端快照的轉換比例 | +|[accountType](../enum#stocks-accounttype) |false |string |僅 `REDEEM` 生效:`all`(默認), `uta`, `fund` | +|requestId |**true** |string |冪等鍵,長度 ≤ 36,字母數字與 `-` `_`。同一 MM 賬號下 24 小時內唯一 | +|contractAddr |false |string |`MINT` 時代幣接收地址,`REDEEM` 時代幣提供地址。**當 `flow=DEX` 且 `burnScene=NDP` 時不要傳** | +|[flow](../enum#stocks-flow) |**true** |string |`CEX`, `DEX`。對於 `MINT`,CEX / DEX 都是 mint 到指定地址,流程一致;對於 `REDEEM`(burn),CEX 與 DEX 流程不一致 | +|[burnScene](../enum#stocks-burnscene) |false |string |**DEX `REDEEM`(burn)** 場景:`DEP`(走 Bybit 主站);`NDP`(不走 Bybit 主站) | + +### 響應參數 +| 參數 | 類型 | 說明| +|:----- |:-----|----- | +|orderNo |string |Convert 訂單號 | +|[status](../enum#stocks-convertstatus) |string |Convert 初始狀態 | +|[convertType](../enum#stocks-converttype) |string |回顯方向 | +|symbol |string |回顯標的 | +|inputAmount |string |回顯輸入量 | +|outputAmount |string |輸出量 | +|appliedMultiplier |string |實際生效的轉換比例 | +|submittedAt |integer |服務端受理毫秒時間戳 | + +--- + +### 請求示例 + + + + +```http +POST /v5/rwa/stocks/convert/submit HTTP/1.1 +Host: api-testnet.bybit.com +X-BAPI-API-KEY: xxxxxxxxxxxxxxxxxx +X-BAPI-TIMESTAMP: 1787657753833 +X-BAPI-RECV-WINDOW: 5000 +X-BAPI-SIGN: XXXXX +Content-Type: application/json + +{ + "convertType": "MINT", + "symbol": "TSLA-US", + "inputAmount": "1", + "frontMultiplier": "1", + "requestId": "mm-cvt-20260825-0001" +} +``` + + + + +### 響應示例 + +```json +{ + "retCode": 0, + "retMsg": "ok", + "result": { + "orderNo": "MM20240825001", + "status": "PENDING", + "convertType": "MINT", + "symbol": "AAPL", + "inputAmount": "100", + "outputAmount": "1", + "appliedMultiplier": "100", + "submittedAt": 1724534400000 + }, + "time": 1724534400123 +} +``` + +### 場景示例 + +```json +// 場景 1:CEX Mint(正股 → Token) +{ + "convertType": "MINT", + "symbol": "AAPL-US", + "inputAmount": "5", + "frontMultiplier": "10", + "flow": "CEX", + "contractAddr": "0xabc...", + "requestId": "mm-001" +} + +// 場景 2:CEX Burn(Token → 正股) +{ + "convertType": "REDEEM", + "symbol": "AAPL-US", + "inputAmount": "50", + "frontMultiplier": "10", + "flow": "CEX", + "accountType": "all", + "requestId": "mm-002" +} + +// 場景 3:DEX Mint(正股 → Token) +{ + "convertType": "MINT", + "symbol": "AAPL-US", + "inputAmount": "5", + "frontMultiplier": "10", + "flow": "DEX", + "contractAddr": "0xabc...", + "requestId": "mm-003" +} + +// 場景 4a:DEX Burn,走 Bybit 主站(DEP) +{ + "convertType": "REDEEM", + "symbol": "AAPL-US", + "inputAmount": "50", + "frontMultiplier": "10", + "flow": "DEX", + "burnScene": "DEP", + "requestId": "mm-004" +} + +// 場景 4b:DEX Burn,不走主站,鏈上直接劃轉(NDP) +{ + "convertType": "REDEEM", + "symbol": "AAPL-US", + "inputAmount": "50", + "frontMultiplier": "10", + "flow": "DEX", + "burnScene": "NDP", + "requestId": "mm-005" +} +``` diff --git a/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/stocks/market-session.mdx b/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/stocks/market-session.mdx new file mode 100644 index 0000000000..e35ec27e61 --- /dev/null +++ b/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/stocks/market-session.mdx @@ -0,0 +1,70 @@ +--- +title: 交易日曆數據 +sidebar_label: 交易日曆數據 +sidebar_position: 8 +--- +查詢當前股市交易時段狀態以及不可交易時間段列表(提前收盤、法定假日)。 + +:::info +本接口僅面向做市商(Market Maker)開放。 +::: + +### HTTP請求 + + +### 請求參數 +| 參數 | 是否必需 | 類型 | 說明| +|:----- |:-------|:-----|------ | +|symbol |false |string |股票代碼,例如 `AAPL-US` | + +### 響應參數 +| 參數 | 類型 | 說明| +|:----- |:-----|----- | +|[symbolType](../enum#stocks-symboltype) |string |股票類型。`US_STOCK` | +|[statusCode](../enum#stocks-statuscode) |integer |當前股票所處狀態。`1`: 盤前,`2`: 盤中,`3`: 盤後,`4`: 夜盤,`5`: 休市 | +|serverTime |integer |服務端 UTC epoch ms,用來消除用戶本地時間誤差 | +|currentPhaseEndTime |integer |當前時段結束時間(epoch ms) | +|nextMarketOpenTime |integer |下次主市場開盤時間(epoch ms) | +|stocksTradingHoliday |array<object> |所有不可交易時間段 | +|> [type](../enum#stocks-tradingholidaytype) |string |類型。`EARLY_CLOSE`, `HOLIDAY` | +|> startTime |string |開始時間 | +|> endTime |string |結束時間 | + +--- + +### 請求示例 + + + + +```http +GET /v5/rwa/stocks/market/session?symbol=TSLA-US HTTP/1.1 +Host: api-testnet.bybit.com +X-BAPI-API-KEY: xxxxxxxxxxxxxxxxxx +X-BAPI-TIMESTAMP: 1787662431425 +X-BAPI-RECV-WINDOW: 5000 +X-BAPI-SIGN: XXXXX +``` + + + + +### 響應示例 + +```json +{ + "retCode": 0, + "retMsg": "ok", + "result": { + "symbolType": "US_STOCK", + "statusCode": 4, + "serverTime": 1787662431425, + "currentPhaseEndTime": 1787299200000, + "nextMarketOpenTime": 1787319000000, + "stocksTradingHoliday": [ + { "type": "HOLIDAY", "startTime": 1756684800000, "endTime": 1756771200000 } + ] + }, + "time": 1787662431500 +} +``` diff --git a/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/stocks/order-detail.mdx b/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/stocks/order-detail.mdx new file mode 100644 index 0000000000..45d23424bf --- /dev/null +++ b/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/stocks/order-detail.mdx @@ -0,0 +1,95 @@ +--- +title: 查詢股票委託單詳情 +sidebar_label: 查詢股票委託單詳情 +sidebar_position: 3 +--- +根據訂單號或客戶端訂單號查詢單筆股票買賣訂單的完整狀態、參數與成交明細。用於 MM 側對賬、狀態輪詢與失敗原因定位。 + +:::info +本接口僅面向做市商(Market Maker)開放。 +::: + +### HTTP請求 + + +### 請求參數 +| 參數 | 是否必需 | 類型 | 說明| +|:----- |:-------|:-----|------ | +|orderNo |false |string |系統訂單號。`orderNo` 與 `clientOrderId` 二選一 | +|clientOrderId |false |string |客戶端冪等 ID。`orderNo` 與 `clientOrderId` 二選一 | + +### 響應參數 +| 參數 | 類型 | 說明| +|:----- |:-----|----- | +|orderNo |string |系統訂單號 | +|clientOrderId |string |客戶端訂單號(若下單時提供) | +|symbol |string |股票代碼 | +|quoteToken |string |計價資產 | +|[side](../enum#stocks-side) |string |方向 | +|[type](../enum#stocks-type) |string |訂單類型 | +|qty |string |委託數量(股),下單為 `notional` 時可能為 `null` | +|notional |string |委託名義額(USDC),僅 `side=BUY` 且 `type=MARKET` 時非空 | +|limitPrice |string |限價,非限價單為 `null` | +|stopPrice |string |觸發價,非止損單為 `null` | +|[timeInForce](../enum#stocks-timeinforce) |string |有效期 | +|[tradingSession](../enum#stocks-tradingsession) |string |交易時段 | +|tokenize |boolean |是否自動 tokenize | +|[orderStatus](../enum#stocks-orderstatus) |string |當前訂單狀態 | +|filledQty |string |累計成交數量(股) | +|filledNotional |string |累計成交金額(USDC) | +|avgPrice |string |成交均價(USD),未成交為 `"0"` | +|failReason |string |失敗原因,取值為 [orderStatus](../enum#stocks-orderstatus) 枚舉之一 | +|orderTime |integer |客戶端下單毫秒時間戳 | +|updatedAt |integer |訂單最近變更毫秒時間戳 | + +--- + +### 請求示例 + + + + +```http +GET /v5/rwa/stocks/order/detail?orderNo=SB227696733955111526412 HTTP/1.1 +Host: api-testnet.bybit.com +X-BAPI-API-KEY: xxxxxxxxxxxxxxxxxx +X-BAPI-TIMESTAMP: 1787657753833 +X-BAPI-RECV-WINDOW: 5000 +X-BAPI-SIGN: XXXXX +``` + + + + +### 響應示例 + +```json +{ + "retCode": 0, + "retMsg": "ok", + "result": { + "orderNo": "SB227696733955111526412", + "clientOrderId": "", + "symbol": "TSLA-US", + "quoteToken": "USDC", + "side": "BUY", + "type": "LIMIT", + "qty": "2", + "notional": "", + "limitPrice": "350", + "stopPrice": "", + "timeInForce": "DAY", + "tradingSession": "RTH", + "tokenize": false, + "orderStatus": "cancelled", + "filledQty": "0", + "filledNotional": "0", + "avgPrice": "0", + "failReason": "", + "orderTime": 1786171659000, + "updatedAt": 1786419757000 + }, + "retExtInfo": {}, + "time": 1787657753833 +} +``` diff --git a/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/stocks/place-order.mdx b/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/stocks/place-order.mdx new file mode 100644 index 0000000000..5392c40e97 --- /dev/null +++ b/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/stocks/place-order.mdx @@ -0,0 +1,89 @@ +--- +title: 股票下單 +sidebar_label: 股票下單 +sidebar_position: 1 +--- +本接口提交一筆股票買入或賣出訂單。買入以 USDC 計價,賣出以標的股數計價。 + +:::info +- 本接口僅面向做市商(Market Maker)開放。 +- **支持的訂單類型 (`type`):** `MARKET`, `LIMIT`, `STOP`, `STOP_LIMIT` +::: + +### HTTP請求 + + +### 請求參數 +| 參數 | 是否必需 | 類型 | 說明| +|:----- |:-------|:-----|------ | +|symbol |**true** |string |股票代碼,例如 `TSLA-US`、`AAPL-US`| +|quoteToken |**true** |string |計價資產,當前僅支持 `USDC`| +|[side](../enum#stocks-side) |**true** |string |方向:`BUY`, `SELL`| +|[type](../enum#stocks-type) |**true** |string |訂單類型:`MARKET`, `LIMIT`, `STOP`, `STOP_LIMIT`| +|qty |false |string |委託數量(股)。`SELL` **必傳**;`BUY` 的 `LIMIT`/`STOP`/`STOP_LIMIT` **必傳**;與 `notional` 互斥| +|notional |false |string |名義額(USDC)。僅 `side=BUY` 且 `type=MARKET` 時使用;與 `qty` 互斥| +|limitPrice |false |string |限價。`type=LIMIT` 或 `STOP_LIMIT` 時**必傳**| +|stopPrice |false |string |觸發價。`type=STOP` 或 `STOP_LIMIT` 時**必傳**| +|[timeInForce](../enum#stocks-timeinforce) |**true** |string |有效期:`DAY` / `GTC` / `IOC`。`SELL` 僅支持 `DAY` / `GTC`;`IOC` 需滿足 `type=LIMIT` + 整股 `qty` + `tradingSession=RTH` | +|[tradingSession](../enum#stocks-tradingsession) |false |string |交易時段:`RTH`(默認), `24H`。非 `RTH` 時段只允許 `LIMIT` 單 | +|tokenize |false |boolean |是否在成交後自動 tokenize,默認 `false`;僅對 `BUY` 生效| +|orderTime |**true** |integer |客戶端下單毫秒時間戳| + +### 響應參數 +| 參數 | 類型 | 說明| +|:----- |:-----|----- | +|orderNo |string |系統訂單號 | +|[orderStatus](../enum#stocks-orderstatus) |string |訂單初始狀態 | +|acceptedTime |integer |服務端受理毫秒時間戳 | + +:::info +下單請求返回 ack 僅表示請求被成功接受。請通過[查詢股票委託單詳情](./order-detail)接口輪詢最終訂單狀態。 +::: + +--- + +### 請求示例 + + + + +```http +POST /v5/rwa/stocks/order HTTP/1.1 +Host: api-testnet.bybit.com +X-BAPI-API-KEY: xxxxxxxxxxxxxxxxxx +X-BAPI-TIMESTAMP: 1787656687706 +X-BAPI-RECV-WINDOW: 5000 +X-BAPI-SIGN: XXXXX +Content-Type: application/json + +{ + "symbol": "TSLA-US", + "quoteToken": "USDC", + "side": "BUY", + "type": "LIMIT", + "qty": "2", + "limitPrice": "300.00", + "timeInForce": "DAY", + "tradingSession": "RTH", + "orderTime": 1787656687706 +} +``` + + + + +### 響應示例 + +```json +{ + "retCode": 0, + "retMsg": "ok", + "result": { + "orderNo": "SB227696733955111526412", + "orderStatus": "PENDING", + "acceptedTime": 1787657753833 + }, + "retExtInfo": {}, + "time": 1755590400200 +} +``` diff --git a/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/stocks/positions.mdx b/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/stocks/positions.mdx new file mode 100644 index 0000000000..e8546b5ecc --- /dev/null +++ b/i18n/zh-TW/docusaurus-plugin-content-docs/current/v5/stocks/positions.mdx @@ -0,0 +1,69 @@ +--- +title: 查詢股票持倉 +sidebar_label: 查詢股票持倉 +sidebar_position: 7 +--- +查詢當前 MM 賬號下所有正股持倉快照,包含總持倉、可用持倉、在途。 + +:::info +本接口僅面向做市商(Market Maker)開放。 +::: + +### HTTP請求 + + +### 請求參數 +| 參數 | 是否必需 | 類型 | 說明| +|:----- |:-------|:-----|------ | +|symbol |false |string |股票代碼,例如 `AAPL-US`。按標的過濾;不傳則返回全部持倉 | +|showZero |false |boolean |是否返回零持倉,默認 `false` | + +### 響應參數 +| 參數 | 類型 | 說明| +|:----- |:-----|----- | +|data |array<object> |持倉列表 | +|> symbol |string |股票代碼 | +|> qty |string |總持倉數量(股) | +|> availableQty |string |可用持倉數量(可賣出 / 可轉出) | +|> pendingQty |string |在途持倉數量(待結算或訂單鎖定) | +|> updatedAt |integer |快照更新毫秒時間戳 | + +--- + +### 請求示例 + + + + +```http +GET /v5/rwa/stocks/positions?showZero=false HTTP/1.1 +Host: api-testnet.bybit.com +X-BAPI-API-KEY: xxxxxxxxxxxxxxxxxx +X-BAPI-TIMESTAMP: 1787657753833 +X-BAPI-RECV-WINDOW: 5000 +X-BAPI-SIGN: XXXXX +``` + + + + +### 響應示例 + +```json +{ + "retCode": 0, + "retMsg": "ok", + "result": { + "data": [ + { + "symbol": "AAPL", + "qty": "100", + "availableQty": "80", + "pendingQty": "20", + "updatedAt": 1724534400000 + } + ] + }, + "time": 1724534400123 +} +``` diff --git a/sidebars.js b/sidebars.js index 40660a9f76..dd85248107 100644 --- a/sidebars.js +++ b/sidebars.js @@ -187,6 +187,16 @@ const sidebars = { } ] }, + { + type: 'category', + label: 'Stocks', + items: [ + { + type: 'autogenerated', + dirName: 'v5/stocks' + } + ] + }, // #3: Spot Margin Trade renamed (removed UTA), moved right after Trade { type: 'category',