diff --git a/package-lock.json b/package-lock.json index 5bf2ae6..2409492 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "bybit-api", - "version": "4.1.1", + "version": "4.1.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "bybit-api", - "version": "4.1.1", + "version": "4.1.2", "license": "MIT", "dependencies": { "axios": "^1.7.9", diff --git a/package.json b/package.json index 3260913..105f867 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bybit-api", - "version": "4.1.1", + "version": "4.1.2", "description": "Complete & robust Node.js SDK for Bybit's REST APIs and WebSockets, with TypeScript & strong end to end tests.", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/src/types/response/v5-market.ts b/src/types/response/v5-market.ts index 1a9cdee..cab8eaf 100644 --- a/src/types/response/v5-market.ts +++ b/src/types/response/v5-market.ts @@ -255,6 +255,7 @@ export interface PublicTradeV5 { side: OrderSideV5; time: string; isBlockTrade: boolean; + isRPITrade: boolean; mP?: string; iP?: string; mIv?: string; diff --git a/src/types/shared-v5.ts b/src/types/shared-v5.ts index b594b6d..f42352f 100644 --- a/src/types/shared-v5.ts +++ b/src/types/shared-v5.ts @@ -17,7 +17,7 @@ export type MarginTradingV5 = 'none' | 'both' | 'utaOnly' | 'normalSpotOnly'; export type OrderFilterV5 = 'Order' | 'tpslOrder' | 'StopOrder'; export type OrderSideV5 = 'Buy' | 'Sell'; export type OrderTypeV5 = 'Market' | 'Limit'; -export type OrderTimeInForceV5 = 'GTC' | 'IOC' | 'FOK' | 'PostOnly'; +export type OrderTimeInForceV5 = 'GTC' | 'IOC' | 'FOK' | 'PostOnly' | 'RPI'; export type OrderTriggerByV5 = 'LastPrice' | 'IndexPrice' | 'MarkPrice'; export type OCOTriggerTypeV5 = | 'OcoTriggerByUnknown' diff --git a/src/types/websockets/ws-events.ts b/src/types/websockets/ws-events.ts index a09e4a1..548fcef 100644 --- a/src/types/websockets/ws-events.ts +++ b/src/types/websockets/ws-events.ts @@ -84,6 +84,98 @@ export type WSOrderbookEventV5 = WSPublicTopicEventV5< WSOrderbookV5 >; +export interface WSTradeV5 { + T: number; + s: string; + S: OrderSideV5; + v: string; + p: string; + L?: string; + i: string; + BT: boolean; + RPI?: boolean; + mP?: string; + iP?: string; + mIv?: string; + iv?: string; +} + +export type WSTradeEventV5 = WSPublicTopicEventV5< + string, + 'snapshot', + WSTradeV5[] +>; + +export interface WSTickerV5 { + symbol: string; + tickDirection: string; + price24hPcnt: string; + lastPrice: string; + prevPrice24h: string; + highPrice24h: string; + lowPrice24h: string; + prevPrice1h: string; + markPrice: string; + indexPrice: string; + openInterest: string; + openInterestValue: string; + turnover24h: string; + volume24h: string; + nextFundingTime: string; + fundingRate: string; + bid1Price: string; + bid1Size: string; + ask1Price: string; + ask1Size: string; + deliveryTime?: string; + basisRate?: string; + deliveryFeeRate?: string; + predictedDeliveryPrice?: string; + preOpenPrice?: string; + preQty?: string; + curPreListingPhase?: string; +} + +export type WSTickerEventV5 = WSPublicTopicEventV5< + string, + 'snapshot' | 'delta', + WSTickerV5 +>; + +export interface WSKlineV5 { + start: number; + end: number; + interval: string; + open: string; + close: string; + high: string; + low: string; + volume: string; + turnover: string; + confirm: boolean; + timestamp: number; +} + +export type WSKlineEventV5 = WSPublicTopicEventV5< + string, + 'snapshot', + WSKlineV5[] +>; + +export interface WSLiquidationV5 { + T: number; + s: string; + S: OrderSideV5; + v: string; + p: string; +} + +export type WSLiquidationEventV5 = WSPublicTopicEventV5< + string, + 'snapshot', + WSLiquidationV5[] +>; + export interface WSPositionV5 { category: string; symbol: string; @@ -223,3 +315,71 @@ export type WSExecutionEventV5 = WSPrivateTopicEventV5< 'execution', WSExecutionV5[] >; + +export interface WSExecutionFastV5 { + category: CategoryV5; + symbol: string; + execId: string; + execPrice: string; + execQty: string; + orderId: string; + isMaker: boolean; + orderLinkId: string; + side: OrderSideV5; + execTime: string; + seq: number; +} + +export type WSExecutionFastEventV5 = WSPrivateTopicEventV5< + 'execution.fast', + WSExecutionFastV5[] +>; + +export interface WSCoinV5 { + coin: string; + equity: string; + usdValue: string; + walletBalance: string; + free?: string; + locked: string; + spotHedgingQty: string; + borrowAmount: string; + availableToBorrow: string; + availableToWithdraw: string; + accruedInterest: string; + totalOrderIM: string; + totalPositionIM: string; + totalPositionMM: string; + unrealisedPnl: string; + cumRealisedPnl: string; + bonus: string; + collateralSwitch: boolean; + marginCollateral: boolean; +} + +export interface WSWalletV5 { + accountType: string; + accountLTV: string; + accountIMRate: string; + accountMMRate: string; + totalEquity: string; + totalWalletBalance: string; + totalMarginBalance: string; + totalAvailableBalance: string; + totalPerpUPL: string; + totalInitialMargin: string; + totalMaintenanceMargin: string; + coin: WSCoinV5[]; +} + +export type WSWalletEventV5 = WSPrivateTopicEventV5<'wallet', WSWalletV5[]>; + +export interface WSGreeksV5 { + baseCoin: string; + totalDelta: string; + totalGamma: string; + totalVega: string; + totalTheta: string; +} + +export type WSGreeksEventV5 = WSPrivateTopicEventV5<'greeks', WSGreeksV5[]>;