v3.8.1: feat() add type guard and type for ws orderbook events

This commit is contained in:
tiagosiebler
2024-01-17 11:41:36 +00:00
parent 1ac1aa5c2e
commit 9cb22d192e
5 changed files with 76 additions and 17 deletions

View File

@@ -13,6 +13,35 @@ import {
} from './v5-shared';
import { WsKey } from './websockets';
export interface WSOrderbookEventV5 {
topic: string;
/** Event timestamp */
ts: number;
type: 'delta' | 'snapshot';
data: {
/** Symbol */
s: string;
/** [price, qty][] */
b: [string, string][];
/** [price, qty][] */
a: [string, string][];
/** Update ID */
u: number;
/**
* Cross sequence
*/
seq: number;
};
/**
* matching engine timestamp (correlated with T from public trade channel)
*/
cts: number;
/**
* Internal reference, can be used to determine if this is spot/linear/inverse/etc
*/
wsKey: WsKey;
}
export interface WSAccountOrderV5 {
qty: string;
price: string;