Enhance WebSocket and API documentation; implement connection protection features

- Added a note in the HTTP API documentation regarding the non-guaranteed sequence of price levels in order book responses.
- Updated WebSocket documentation to include a connection duration limit and a note on local sorting requirements for price levels.
- Introduced connection event handling in the ExchangeAdapter interface, allowing for disconnection and reconnection events.
- Implemented connection protection logic in the StandxExchangeAdapter and MakerPointsEngine to manage order states during connection disruptions.
- Enhanced the StandxGateway with methods for querying open orders and forcefully canceling all orders, improving reliability during network issues.
This commit is contained in:
discountry
2026-01-16 10:49:16 +08:00
parent d493642935
commit aa24995d28
6 changed files with 411 additions and 5 deletions
+4 -2
View File
@@ -679,6 +679,8 @@ To receive order updates via [Order Response Stream](https://docs.standx.com/sta
`GET /api/query_depth_book`
**⚠️ Note: The sequence of price levels in the asks and bids arrays is not guaranteed. Please implement local sorting on the client side based on your specific requirements.**
**Required Parameters**
| Parameter | Type | Description |
@@ -791,7 +793,7 @@ To receive order updates via [Order Response Stream](https://docs.standx.com/sta
| Parameter | Type | Description |
| --- | --- | --- |
| countBack | u64 | The required amount of bars to load |
| countback | u64 | The required amount of bars to load |
**Response Example**:
@@ -840,4 +842,4 @@ For enums, constants, and error codes, see [API Reference](https://docs.standx.c
Last updated on
[Perps Auth](https://docs.standx.com/standx-api/perps-auth "Perps Auth") [Perps WebSocket API](https://docs.standx.com/standx-api/perps-ws "Perps WebSocket API")
[Perps Auth SVM Example](https://docs.standx.com/standx-api/perps-auth-svm-example "Perps Auth SVM Example") [Perps WebSocket API](https://docs.standx.com/standx-api/perps-ws "Perps WebSocket API")
+9
View File
@@ -8,6 +8,12 @@ The WebSocket API provides two streams: **Market Stream** for market data and us
Both WebSocket streams implement the following connection management behavior:
### Connection Duration Limit
- **Maximum Duration**: A single WebSocket connection can be maintained for a maximum of **24 hours**
- After 24 hours, the connection will be automatically terminated
- Clients should implement reconnection logic to handle this gracefully
### Ping/Pong Mechanism
- **Server Ping Interval**: The server sends a WebSocket Ping frame every 10 seconds
@@ -45,6 +51,7 @@ Base Endpoint: `wss://perps.standx.com/ws-stream/v1`
// public channels
{ channel: "price", symbol: "<symbol>" },
{ channel: "depth_book", symbol: "<symbol>" },
{ channel: "public_trade", symbol: "<symbol>" },
// user-level authenticated channels
{ channel: "order" },
{ channel: "position" },
@@ -55,6 +62,8 @@ Base Endpoint: `wss://perps.standx.com/ws-stream/v1`
### Subscribe to Depth Book
**⚠️ Note: The sequence of price levels in the asks and bids arrays is not guaranteed. Please implement local sorting on the client side based on your specific requirements.**
- Request:
- Response:
```