mirror of
https://github.com/discountry/ritmex-bot.git
synced 2026-09-11 01:08:07 +00:00
feat: enhance order handling in LighterGateway and introduce order identity normalization for improved precision and consistency
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
function isPlainObject(value: unknown): value is Record<string, unknown> {
|
||||
return typeof value === "object" && value != null && !Array.isArray(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether a per-market websocket payload should reset the cached
|
||||
* orders before applying its contents.
|
||||
*/
|
||||
export function shouldResetMarketOrders(bucket: unknown, snapshot: boolean): boolean {
|
||||
if (snapshot) return true;
|
||||
if (bucket == null) return false;
|
||||
if (Array.isArray(bucket)) {
|
||||
return bucket.length === 0;
|
||||
}
|
||||
if (isPlainObject(bucket)) {
|
||||
return Object.keys(bucket).length === 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
Reference in New Issue
Block a user