mirror of
https://github.com/discountry/ritmex-bot.git
synced 2026-09-10 00:38:07 +00:00
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:
@@ -47,6 +47,11 @@ export interface ExchangePrecision {
|
||||
minQuoteAmount?: number;
|
||||
}
|
||||
|
||||
export type ConnectionEventType = "disconnected" | "reconnected";
|
||||
export interface ConnectionEventListener {
|
||||
(event: ConnectionEventType, symbol: string): void;
|
||||
}
|
||||
|
||||
export interface ExchangeAdapter {
|
||||
readonly id: string;
|
||||
supportsTrailingStops(): boolean;
|
||||
@@ -61,4 +66,9 @@ export interface ExchangeAdapter {
|
||||
cancelOrders(params: { symbol: string; orderIdList: Array<number | string> }): Promise<void>;
|
||||
cancelAllOrders(params: { symbol: string }): Promise<void>;
|
||||
getPrecision?(): Promise<ExchangePrecision | null>;
|
||||
// 连接保护相关方法(可选,仅 StandX 支持)
|
||||
onConnectionEvent?(listener: ConnectionEventListener): void;
|
||||
offConnectionEvent?(listener: ConnectionEventListener): void;
|
||||
queryOpenOrders?(): Promise<AsterOrder[]>;
|
||||
forceCancelAllOrders?(): Promise<boolean>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user