From ccaae1be1bacec5faeafaa77f8af1b655a027549 Mon Sep 17 00:00:00 2001 From: William Date: Thu, 25 Apr 2024 17:26:34 +0200 Subject: [PATCH] Adds `WSPositionEventV5` and `WSPositionV5` interfaces --- src/types/websocket.events.ts | 52 +++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/src/types/websocket.events.ts b/src/types/websocket.events.ts index 1fbbc6e..c9da412 100644 --- a/src/types/websocket.events.ts +++ b/src/types/websocket.events.ts @@ -12,8 +12,11 @@ import { OrderTriggerByV5, OrderTypeV5, PositionIdx, + PositionSideV5, + PositionStatusV5, StopOrderTypeV5, TPSLModeV5, + TradeModeV5, } from './v5-shared'; import { WsKey } from './websockets'; @@ -46,6 +49,55 @@ export interface WSOrderbookEventV5 { wsKey: WsKey; } +export interface WSPositionV5 { + category: string; + symbol: string; + side: PositionSideV5; + size: string; + positionIdx: PositionIdx; + tradeMode: TradeModeV5; + positionValue: string; + riskId: number; + riskLimitValue: string; + entryPrice: string; + markPrice: string; + leverage: string; + positionBalance: string; + autoAddMargin: number; + positionMM: string; + positionIM: string; + liqPrice: string; + bustPrice: string; + tpslMode: string; + takeProfit: string; + stopLoss: string; + trailingStop: string; + unrealisedPnl: string; + curRealisedPnl: string; + sessionAvgPrice: string; + delta: string; + gamma: string; + vega: string; + theta: string; + cumRealisedPnl: string; + positionStatus: PositionStatusV5; + adlRankIndicator: number; + isReduceOnly: boolean; + mmrSysUpdatedTime: string; + leverageSysUpdatedTime: string; + createdTime: string; + updatedTime: string; + seq: number; +} + +export interface WSPositionEventV5 { + id: string; + topic: 'position'; + creationTime: number; + data: WSPositionV5[]; + wsKey: WsKey; +} + export interface WSAccountOrderV5 { category: CategoryV5; orderId: string;