From 67b39de7e1842378c55755768a7fb0d7110de2df Mon Sep 17 00:00:00 2001 From: Jerko J <83344666+JJ-Cro@users.noreply.github.com> Date: Thu, 27 Jun 2024 16:59:24 +0200 Subject: [PATCH] Fixed deprecated ednpoints. ## Summary ## Additional Information --- .gitignore | 2 + src/copy-trading-client.ts | 4 -- src/unified-margin-client.ts | 56 ++++++++++++------------- test/copy-trading/public.read.test.ts | 4 -- test/unified-margin/public.read.test.ts | 4 -- 5 files changed, 28 insertions(+), 42 deletions(-) diff --git a/.gitignore b/.gitignore index b7cab4a..c982dee 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,5 @@ lib bundleReport.html .history/ rawReq.ts +localtest.sh + diff --git a/src/copy-trading-client.ts b/src/copy-trading-client.ts index 9a1e31c..c8425d3 100644 --- a/src/copy-trading-client.ts +++ b/src/copy-trading-client.ts @@ -152,8 +152,4 @@ export class CopyTradingClient extends BaseRestClient { getServerTime(): Promise { return this.get('/v2/public/time'); } - - getAnnouncements(): Promise> { - return this.get('/v2/public/announcement'); - } } diff --git a/src/unified-margin-client.ts b/src/unified-margin-client.ts index 37afba9..0e172ef 100644 --- a/src/unified-margin-client.ts +++ b/src/unified-margin-client.ts @@ -57,7 +57,7 @@ export class UnifiedMarginClient extends BaseRestClient { getOrderBook( symbol: string, category: string, - limit?: number + limit?: number, ): Promise> { return this.get('/derivatives/v3/public/order-book/L2', { category, @@ -74,14 +74,14 @@ export class UnifiedMarginClient extends BaseRestClient { /** Get a symbol price/statistics ticker */ getSymbolTicker( category: UMCategory, - symbol?: string + symbol?: string, ): Promise> { return this.get('/derivatives/v3/public/tickers', { category, symbol }); } /** Get trading rules per symbol/contract, incl price/amount/value/leverage filters */ getInstrumentInfo( - params: UMInstrumentInfoRequest + params: UMInstrumentInfoRequest, ): Promise>> { return this.get('/derivatives/v3/public/instruments-info', params); } @@ -101,18 +101,18 @@ export class UnifiedMarginClient extends BaseRestClient { * For example, if a request is sent at 12:00 UTC, the funding rate generated earlier that day at 08:00 UTC will be sent. */ getFundingRateHistory( - params: UMFundingRateHistoryRequest + params: UMFundingRateHistoryRequest, ): Promise> { return this.get( '/derivatives/v3/public/funding/history-funding-rate', - params + params, ); } /** Get Risk Limit */ getRiskLimit( category: UMCategory, - symbol: string + symbol: string, ): Promise> { return this.get('/derivatives/v3/public/risk-limit/list', { category, @@ -122,7 +122,7 @@ export class UnifiedMarginClient extends BaseRestClient { /** Get option delivery price */ getOptionDeliveryPrice( - params: UMOptionDeliveryPriceRequest + params: UMOptionDeliveryPriceRequest, ): Promise> { return this.get('/derivatives/v3/public/delivery-price', params); } @@ -170,7 +170,7 @@ export class UnifiedMarginClient extends BaseRestClient { /** Query order history. As order creation/cancellation is asynchronous, the data returned from the interface may be delayed. To access order information in real-time, call getActiveOrders() */ getHistoricOrders( - params: UMHistoricOrdersRequest + params: UMHistoricOrdersRequest, ): Promise>> { return this.getPrivate('/unified/v3/private/order/list', params); } @@ -181,7 +181,7 @@ export class UnifiedMarginClient extends BaseRestClient { */ batchSubmitOrders( category: UMCategory, - orders: UMBatchOrder[] + orders: UMBatchOrder[], ): Promise> { return this.postPrivate('/unified/v3/private/order/create-batch', { category, @@ -197,7 +197,7 @@ export class UnifiedMarginClient extends BaseRestClient { */ batchReplaceOrders( category: UMCategory, - orders: UMBatchOrderReplace[] + orders: UMBatchOrderReplace[], ): Promise> { return this.postPrivate('/unified/v3/private/order/replace-batch', { category, @@ -212,7 +212,7 @@ export class UnifiedMarginClient extends BaseRestClient { */ batchCancelOrders( category: UMCategory, - orders: UMBatchOrderCancel[] + orders: UMBatchOrderCancel[], ): Promise> { return this.postPrivate('/unified/v3/private/order/cancel-batch', { category, @@ -226,7 +226,7 @@ export class UnifiedMarginClient extends BaseRestClient { * If both futures and options orders are in one request, only the orders matching the category will be operated according to the category type. */ cancelAllOrders( - params: UMCancelAllOrdersRequest + params: UMCancelAllOrdersRequest, ): Promise> { return this.postPrivate('/unified/v3/private/order/cancel-all', params); } @@ -246,7 +246,7 @@ export class UnifiedMarginClient extends BaseRestClient { category: UMCategory, symbol: string, buyLeverage: number, - sellLeverage: number + sellLeverage: number, ): Promise> { return this.postPrivate('/unified/v3/private/position/set-leverage', { category, @@ -263,7 +263,7 @@ export class UnifiedMarginClient extends BaseRestClient { setTPSLMode( category: UMCategory, symbol: string, - tpSlMode: 1 | 0 + tpSlMode: 1 | 0, ): Promise> { return this.postPrivate('/unified/v3/private/position/tpsl/switch-mode', { category, @@ -277,7 +277,7 @@ export class UnifiedMarginClient extends BaseRestClient { category: UMCategory, symbol: string, riskId: number, - positionIdx: number + positionIdx: number, ): Promise> { return this.postPrivate('/unified/v3/private/position/set-risk-limit', { category, @@ -295,7 +295,7 @@ export class UnifiedMarginClient extends BaseRestClient { setTPSL(params: UMSetTPSLRequest): Promise> { return this.postPrivate( '/unified/v3/private/position/trading-stop', - params + params, ); } @@ -304,21 +304,21 @@ export class UnifiedMarginClient extends BaseRestClient { * There might be multiple filled histories for an order. */ get7DayTradingHistory( - params: UM7DayTradingHistoryRequest + params: UM7DayTradingHistoryRequest, ): Promise> { return this.getPrivate('/unified/v3/private/execution/list', params); } /** Query the settlement history, ranked by time in descending order. */ getOptionsSettlementHistory( - params: UMOptionsSettlementHistoryRequest + params: UMOptionsSettlementHistoryRequest, ): Promise> { return this.getPrivate('/unified/v3/private/delivery-record', params); } /** Query session settlement records, only for USDC perpetual */ getUSDCPerpetualSettlementHistory( - params: UMPerpSettlementHistoryRequest + params: UMPerpSettlementHistoryRequest, ): Promise> { return this.getPrivate('/unified/v3/private/settlement-record', params); } @@ -338,17 +338,17 @@ export class UnifiedMarginClient extends BaseRestClient { */ upgradeToUnifiedMargin(): Promise> { return this.postPrivate( - '/unified/v3/private/account/upgrade-unified-account' + '/unified/v3/private/account/upgrade-unified-account', ); } /** Query trading history */ getTransactionLog( - params: UMTransactionLogRequest + params: UMTransactionLogRequest, ): Promise> { return this.getPrivate( '/unified/v3/private/account/transaction-log', - params + params, ); } @@ -359,21 +359,21 @@ export class UnifiedMarginClient extends BaseRestClient { /** Exchange Coins */ getCoinExchangeHistory( - params?: UMExchangeCoinsRequest + params?: UMExchangeCoinsRequest, ): Promise> { return this.getPrivate( '/asset/v2/private/exchange/exchange-order-all', - params + params, ); } /** Get Borrow History */ getBorrowHistory( - params?: UMBorrowHistoryRequest + params?: UMBorrowHistoryRequest, ): Promise> { return this.getPrivate( '/unified/v3/private/account/borrow-history', - params + params, ); } @@ -393,8 +393,4 @@ export class UnifiedMarginClient extends BaseRestClient { getServerTime(): Promise { return this.get('/v2/public/time'); } - - getAnnouncements(): Promise> { - return this.get('/v2/public/announcement'); - } } diff --git a/test/copy-trading/public.read.test.ts b/test/copy-trading/public.read.test.ts index ec35b1a..e42dcc9 100644 --- a/test/copy-trading/public.read.test.ts +++ b/test/copy-trading/public.read.test.ts @@ -26,8 +26,4 @@ describe('Public Copy Trading REST API Endpoints', () => { it('getServerTime()', async () => { expect(await api.getServerTime()).toMatchObject(successResponseObject()); }); - - it('getAnnouncements()', async () => { - expect(await api.getAnnouncements()).toMatchObject(successResponseObject()); - }); }); diff --git a/test/unified-margin/public.read.test.ts b/test/unified-margin/public.read.test.ts index 28f944a..5e3cdc0 100644 --- a/test/unified-margin/public.read.test.ts +++ b/test/unified-margin/public.read.test.ts @@ -104,8 +104,4 @@ describe('Public Unified Margin REST API Endpoints', () => { it('getServerTime()', async () => { expect(await api.getServerTime()).toMatchObject(successResponseObject()); }); - - it('getAnnouncements()', async () => { - expect(await api.getAnnouncements()).toMatchObject(successResponseObject()); - }); });