From d4ebc8227c393512052b25da24103a7bc1ae6a08 Mon Sep 17 00:00:00 2001 From: tiagosiebler Date: Tue, 7 May 2024 13:15:46 +0100 Subject: [PATCH] feat(#339): add longshort ratio v5 method --- src/rest-client-v5.ts | 8 ++++++++ src/types/request/v5-market.ts | 7 +++++++ src/types/response/v5-market.ts | 9 ++++++++- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/rest-client-v5.ts b/src/rest-client-v5.ts index 0fdc302..d053fb4 100644 --- a/src/rest-client-v5.ts +++ b/src/rest-client-v5.ts @@ -69,6 +69,7 @@ import { GetInternalDepositRecordParamsV5, GetInternalTransferParamsV5, GetKlineParamsV5, + GetLongShortRatioParamsV5, GetMarkPriceKlineParamsV5, GetOpenInterestParamsV5, GetOptionDeliveryPriceParamsV5, @@ -94,6 +95,7 @@ import { InternalTransferRecordV5, LeverageTokenInfoV5, LeveragedTokenMarketResultV5, + LongShortRatioV5, MMPModifyParamsV5, MMPStateV5, OHLCKlineV5, @@ -390,6 +392,12 @@ export class RestClientV5 extends BaseRestClient { return this.get('/v5/market/delivery-price', params); } + getLongShortRatio( + params: GetLongShortRatioParamsV5, + ): Promise> { + return this.get('/v5/market/account-ratio', params); + } + /** * ****** Trade APIs diff --git a/src/types/request/v5-market.ts b/src/types/request/v5-market.ts index 9e836b7..0619a32 100644 --- a/src/types/request/v5-market.ts +++ b/src/types/request/v5-market.ts @@ -125,3 +125,10 @@ export interface GetDeliveryPriceParamsV5 { limit?: number; cursor?: string; } + +export interface GetLongShortRatioParamsV5 { + category: 'linear' | 'inverse'; + symbol: string; + period: OpenInterestIntervalV5; + limit?: number; +} diff --git a/src/types/response/v5-market.ts b/src/types/response/v5-market.ts index b121e29..4a40982 100644 --- a/src/types/response/v5-market.ts +++ b/src/types/response/v5-market.ts @@ -120,7 +120,7 @@ export interface SpotInstrumentInfoV5 { riskParameters: { limitParameter: string; marketParameter: string; - } + }; } type InstrumentInfoV5Mapping = { @@ -290,3 +290,10 @@ export interface DeliveryPriceV5 { deliveryPrice: string; deliveryTime: string; } + +export interface LongShortRatioV5 { + symbol: string; + buyRatio: string; + sellRatio: string; + timestamp: string; +}