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
+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:
```