mirror of
https://github.com/discountry/ritmex-bot.git
synced 2026-09-11 01:08:07 +00:00
Enhance environment variable parsing and account snapshot validation
- Introduced `normalizeEnvValue` function to improve handling of environment variable values, including trimming, unquoting, and stripping inline comments. - Updated `resolveSymbolFromEnv` and parsing functions to utilize the new normalization logic. - Added `validateAccountSnapshotForSymbol` function to validate account snapshots, ensuring numeric fields are correctly formatted and flagging any issues. - Implemented tests for environment variable parsing and account snapshot validation to ensure robustness and correctness.
This commit is contained in:
@@ -37,6 +37,17 @@ export interface FundingRateListener {
|
||||
(snapshot: FundingRateSnapshot): void;
|
||||
}
|
||||
|
||||
export type RestHealthState = "healthy" | "unhealthy";
|
||||
export interface RestHealthInfo {
|
||||
consecutiveErrors: number;
|
||||
method?: string;
|
||||
path?: string;
|
||||
error?: string;
|
||||
}
|
||||
export interface RestHealthListener {
|
||||
(state: RestHealthState, info: RestHealthInfo): void;
|
||||
}
|
||||
|
||||
export interface ExchangePrecision {
|
||||
priceTick: number;
|
||||
qtyStep: number;
|
||||
@@ -69,6 +80,9 @@ export interface ExchangeAdapter {
|
||||
// 连接保护相关方法(可选,仅 StandX 支持)
|
||||
onConnectionEvent?(listener: ConnectionEventListener): void;
|
||||
offConnectionEvent?(listener: ConnectionEventListener): void;
|
||||
onRestHealthEvent?(listener: RestHealthListener): void;
|
||||
offRestHealthEvent?(listener: RestHealthListener): void;
|
||||
queryOpenOrders?(): Promise<AsterOrder[]>;
|
||||
queryAccountSnapshot?(): Promise<AsterAccountSnapshot | null>;
|
||||
forceCancelAllOrders?(): Promise<boolean>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user