Merge pull request #293 from tiagosiebler/next
v3.7.4: feat(#251, #291) add optional endpoint rate limit parsing, add deprecation warnings for v1/v2 rest clients, improve v5 types, bump dependencies
This commit is contained in:
@@ -155,6 +155,12 @@ const restClientOptions = {
|
||||
|
||||
/** Default: true. whether to try and post-process request exceptions. */
|
||||
parse_exceptions?: boolean;
|
||||
|
||||
/** Default: false. Enable to parse/include per-API/endpoint rate limits in responses. */
|
||||
parseAPIRateLimits?: boolean;
|
||||
|
||||
/** Default: false. Enable to throw error if rate limit parser fails */
|
||||
throwOnFailedRateLimitParse?: boolean;
|
||||
};
|
||||
|
||||
const API_KEY = 'xxx';
|
||||
|
||||
897
package-lock.json
generated
897
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "bybit-api",
|
||||
"version": "3.7.3",
|
||||
"version": "3.7.4",
|
||||
"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",
|
||||
|
||||
@@ -17,6 +17,10 @@ import BaseRestClient from './util/BaseRestClient';
|
||||
|
||||
/**
|
||||
* REST API client for Account Asset APIs
|
||||
*
|
||||
* @deprecated WARNING: V1/V2 private endpoints (Rest API & Websocket Stream) for mainnet
|
||||
* will be switched off gradually from 30 Oct 2023 UTC, so they are not promised a stability.
|
||||
* Please note that you are at your own risk of using old endpoints going forward, and please move to V5 ASAP.
|
||||
*/
|
||||
export class AccountAssetClient extends BaseRestClient {
|
||||
getClientType() {
|
||||
@@ -35,29 +39,29 @@ export class AccountAssetClient extends BaseRestClient {
|
||||
*/
|
||||
|
||||
createInternalTransfer(
|
||||
params: InternalTransferRequest
|
||||
params: InternalTransferRequest,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.postPrivate('/asset/v1/private/transfer', params);
|
||||
}
|
||||
|
||||
createSubAccountTransfer(
|
||||
params: SubAccountTransferRequest
|
||||
params: SubAccountTransferRequest,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.postPrivate('/asset/v1/private/sub-member/transfer', params);
|
||||
}
|
||||
|
||||
getInternalTransfers(
|
||||
params?: TransferQueryRequest
|
||||
params?: TransferQueryRequest,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.getPrivate('/asset/v1/private/transfer/list', params);
|
||||
}
|
||||
|
||||
getSubAccountTransfers(
|
||||
params?: TransferQueryRequest
|
||||
params?: TransferQueryRequest,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.getPrivate(
|
||||
'/asset/v1/private/sub-member/transfer/list',
|
||||
params
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -66,19 +70,19 @@ export class AccountAssetClient extends BaseRestClient {
|
||||
}
|
||||
|
||||
enableUniversalTransfer(
|
||||
params?: EnableUniversalTransferRequest
|
||||
params?: EnableUniversalTransferRequest,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.postPrivate('/asset/v1/private/transferable-subs/save', params);
|
||||
}
|
||||
|
||||
createUniversalTransfer(
|
||||
params: UniversalTransferRequest
|
||||
params: UniversalTransferRequest,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.postPrivate('/asset/v1/private/universal/transfer', params);
|
||||
}
|
||||
|
||||
getUniversalTransfers(
|
||||
params?: TransferQueryRequest
|
||||
params?: TransferQueryRequest,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.getPrivate('/asset/v1/private/universal/transfer/list', params);
|
||||
}
|
||||
@@ -90,19 +94,19 @@ export class AccountAssetClient extends BaseRestClient {
|
||||
*/
|
||||
|
||||
getSupportedDepositList(
|
||||
params?: SupportedDepositListRequest
|
||||
params?: SupportedDepositListRequest,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.get('/asset/v1/public/deposit/allowed-deposit-list', params);
|
||||
}
|
||||
|
||||
getDepositRecords(
|
||||
params?: DepositRecordsRequest
|
||||
params?: DepositRecordsRequest,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.getPrivate('/asset/v1/private/deposit/record/query', params);
|
||||
}
|
||||
|
||||
getWithdrawRecords(
|
||||
params?: WithdrawalRecordsRequest
|
||||
params?: WithdrawalRecordsRequest,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.getPrivate('/asset/v1/private/withdraw/record/query', params);
|
||||
}
|
||||
@@ -112,13 +116,13 @@ export class AccountAssetClient extends BaseRestClient {
|
||||
}
|
||||
|
||||
getAssetInformation(
|
||||
params?: AccountAssetInformationRequest
|
||||
params?: AccountAssetInformationRequest,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.getPrivate('/asset/v1/private/asset-info/query', params);
|
||||
}
|
||||
|
||||
submitWithdrawal(
|
||||
params: WithdrawalRequest
|
||||
params: WithdrawalRequest,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.postPrivate('/asset/v1/private/withdraw', params);
|
||||
}
|
||||
|
||||
@@ -32,6 +32,10 @@ import BaseRestClient from './util/BaseRestClient';
|
||||
|
||||
/**
|
||||
* REST API client for Inverse Perpetual Futures APIs (v2)
|
||||
*
|
||||
* @deprecated WARNING: V1/V2 private endpoints (Rest API & Websocket Stream) for mainnet
|
||||
* will be switched off gradually from 30 Oct 2023 UTC, so they are not promised a stability.
|
||||
* Please note that you are at your own risk of using old endpoints going forward, and please move to V5 ASAP.
|
||||
*/
|
||||
export class InverseClient extends BaseRestClient {
|
||||
getClientType() {
|
||||
@@ -54,7 +58,7 @@ export class InverseClient extends BaseRestClient {
|
||||
}
|
||||
|
||||
getKline(
|
||||
params: SymbolIntervalFromLimitParam
|
||||
params: SymbolIntervalFromLimitParam,
|
||||
): Promise<APIResponseWithTime<any[]>> {
|
||||
return this.get('v2/public/kline/list', params);
|
||||
}
|
||||
@@ -63,7 +67,7 @@ export class InverseClient extends BaseRestClient {
|
||||
* Get latest information for symbol
|
||||
*/
|
||||
getTickers(
|
||||
params?: Partial<SymbolParam>
|
||||
params?: Partial<SymbolParam>,
|
||||
): Promise<APIResponseWithTime<any[]>> {
|
||||
return this.get('v2/public/tickers', params);
|
||||
}
|
||||
@@ -77,19 +81,19 @@ export class InverseClient extends BaseRestClient {
|
||||
}
|
||||
|
||||
getMarkPriceKline(
|
||||
params: SymbolIntervalFromLimitParam
|
||||
params: SymbolIntervalFromLimitParam,
|
||||
): Promise<APIResponseWithTime<any[]>> {
|
||||
return this.get('v2/public/mark-price-kline', params);
|
||||
}
|
||||
|
||||
getIndexPriceKline(
|
||||
params: SymbolIntervalFromLimitParam
|
||||
params: SymbolIntervalFromLimitParam,
|
||||
): Promise<APIResponseWithTime<any[]>> {
|
||||
return this.get('v2/public/index-price-kline', params);
|
||||
}
|
||||
|
||||
getPremiumIndexKline(
|
||||
params: SymbolIntervalFromLimitParam
|
||||
params: SymbolIntervalFromLimitParam,
|
||||
): Promise<APIResponseWithTime<any[]>> {
|
||||
return this.get('v2/public/premium-index-kline', params);
|
||||
}
|
||||
@@ -101,19 +105,19 @@ export class InverseClient extends BaseRestClient {
|
||||
*/
|
||||
|
||||
getOpenInterest(
|
||||
params: SymbolPeriodLimitParam
|
||||
params: SymbolPeriodLimitParam,
|
||||
): Promise<APIResponseWithTime<any[]>> {
|
||||
return this.get('v2/public/open-interest', params);
|
||||
}
|
||||
|
||||
getLatestBigDeal(
|
||||
params: SymbolLimitParam
|
||||
params: SymbolLimitParam,
|
||||
): Promise<APIResponseWithTime<any[]>> {
|
||||
return this.get('v2/public/big-deal', params);
|
||||
}
|
||||
|
||||
getLongShortRatio(
|
||||
params: SymbolPeriodLimitParam
|
||||
params: SymbolPeriodLimitParam,
|
||||
): Promise<APIResponseWithTime<any[]>> {
|
||||
return this.get('v2/public/account-ratio', params);
|
||||
}
|
||||
@@ -135,25 +139,25 @@ export class InverseClient extends BaseRestClient {
|
||||
*/
|
||||
|
||||
getWalletBalance(
|
||||
params?: Partial<CoinParam>
|
||||
params?: Partial<CoinParam>,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.getPrivate('v2/private/wallet/balance', params);
|
||||
}
|
||||
|
||||
getWalletFundRecords(
|
||||
params?: WalletFundRecordsReq
|
||||
params?: WalletFundRecordsReq,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.getPrivate('v2/private/wallet/fund/records', params);
|
||||
}
|
||||
|
||||
getWithdrawRecords(
|
||||
params?: WithdrawRecordsReq
|
||||
params?: WithdrawRecordsReq,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.getPrivate('v2/private/wallet/withdraw/list', params);
|
||||
}
|
||||
|
||||
getAssetExchangeRecords(
|
||||
params?: AssetExchangeRecordsReq
|
||||
params?: AssetExchangeRecordsReq,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.getPrivate('v2/private/exchange-order/list', params);
|
||||
}
|
||||
@@ -183,37 +187,37 @@ export class InverseClient extends BaseRestClient {
|
||||
*/
|
||||
|
||||
placeActiveOrder(
|
||||
orderRequest: InverseOrderRequest
|
||||
orderRequest: InverseOrderRequest,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.postPrivate('v2/private/order/create', orderRequest);
|
||||
}
|
||||
|
||||
getActiveOrderList(
|
||||
params: InverseActiveOrdersRequest
|
||||
params: InverseActiveOrdersRequest,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.getPrivate('v2/private/order/list', params);
|
||||
}
|
||||
|
||||
cancelActiveOrder(
|
||||
params: InverseCancelOrderRequest
|
||||
params: InverseCancelOrderRequest,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.postPrivate('v2/private/order/cancel', params);
|
||||
}
|
||||
|
||||
cancelAllActiveOrders(
|
||||
params: SymbolParam
|
||||
params: SymbolParam,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.postPrivate('v2/private/order/cancelAll', params);
|
||||
}
|
||||
|
||||
replaceActiveOrder(
|
||||
params: InverseReplaceOrderRequest
|
||||
params: InverseReplaceOrderRequest,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.postPrivate('v2/private/order/replace', params);
|
||||
}
|
||||
|
||||
queryActiveOrder(
|
||||
params: InverseGetOrderRequest
|
||||
params: InverseGetOrderRequest,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.getPrivate('v2/private/order', params);
|
||||
}
|
||||
@@ -223,38 +227,38 @@ export class InverseClient extends BaseRestClient {
|
||||
*/
|
||||
|
||||
placeConditionalOrder(
|
||||
params: InverseConditionalOrderRequest
|
||||
params: InverseConditionalOrderRequest,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.postPrivate('v2/private/stop-order/create', params);
|
||||
}
|
||||
|
||||
/** get conditional order list. This may see delays, use queryConditionalOrder() for real-time queries */
|
||||
getConditionalOrder(
|
||||
params: InverseActiveConditionalOrderRequest
|
||||
params: InverseActiveConditionalOrderRequest,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.getPrivate('v2/private/stop-order/list', params);
|
||||
}
|
||||
|
||||
cancelConditionalOrder(
|
||||
params: InverseCancelConditionalOrderRequest
|
||||
params: InverseCancelConditionalOrderRequest,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.postPrivate('v2/private/stop-order/cancel', params);
|
||||
}
|
||||
|
||||
cancelAllConditionalOrders(
|
||||
params: SymbolParam
|
||||
params: SymbolParam,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.postPrivate('v2/private/stop-order/cancelAll', params);
|
||||
}
|
||||
|
||||
replaceConditionalOrder(
|
||||
params: InverseReplaceConditionalOrderRequest
|
||||
params: InverseReplaceConditionalOrderRequest,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.postPrivate('v2/private/stop-order/replace', params);
|
||||
}
|
||||
|
||||
queryConditionalOrder(
|
||||
params: InverseGetOrderRequest
|
||||
params: InverseGetOrderRequest,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.getPrivate('v2/private/stop-order', params);
|
||||
}
|
||||
@@ -264,49 +268,49 @@ export class InverseClient extends BaseRestClient {
|
||||
*/
|
||||
|
||||
getPosition(
|
||||
params?: Partial<SymbolParam>
|
||||
params?: Partial<SymbolParam>,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.getPrivate('v2/private/position/list', params);
|
||||
}
|
||||
|
||||
changePositionMargin(
|
||||
params: InverseChangePositionMarginRequest
|
||||
params: InverseChangePositionMarginRequest,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.postPrivate('position/change-position-margin', params);
|
||||
}
|
||||
|
||||
setTradingStop(
|
||||
params: InverseSetTradingStopRequest
|
||||
params: InverseSetTradingStopRequest,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.postPrivate('v2/private/position/trading-stop', params);
|
||||
}
|
||||
|
||||
setUserLeverage(
|
||||
params: InverseSetLeverageRequest
|
||||
params: InverseSetLeverageRequest,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.postPrivate('v2/private/position/leverage/save', params);
|
||||
}
|
||||
|
||||
getTradeRecords(
|
||||
params: InverseGetTradeRecordsRequest
|
||||
params: InverseGetTradeRecordsRequest,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.getPrivate('v2/private/execution/list', params);
|
||||
}
|
||||
|
||||
getClosedPnl(
|
||||
params: InverseGetClosedPnlRequest
|
||||
params: InverseGetClosedPnlRequest,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.getPrivate('v2/private/trade/closed-pnl/list', params);
|
||||
}
|
||||
|
||||
setSlTpPositionMode(
|
||||
params: InverseSetSlTpPositionModeRequest
|
||||
params: InverseSetSlTpPositionModeRequest,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.postPrivate('v2/private/tpsl/switch-mode', params);
|
||||
}
|
||||
|
||||
setMarginType(
|
||||
params: InverseSetMarginTypeRequest
|
||||
params: InverseSetMarginTypeRequest,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.postPrivate('v2/private/position/switch-isolated', params);
|
||||
}
|
||||
|
||||
@@ -16,6 +16,10 @@ import BaseRestClient from './util/BaseRestClient';
|
||||
|
||||
/**
|
||||
* REST API client for Inverse Futures APIs (e.g. quarterly futures) (v2)
|
||||
*
|
||||
* @deprecated WARNING: V1/V2 private endpoints (Rest API & Websocket Stream) for mainnet
|
||||
* will be switched off gradually from 30 Oct 2023 UTC, so they are not promised a stability.
|
||||
* Please note that you are at your own risk of using old endpoints going forward, and please move to V5 ASAP.
|
||||
*/
|
||||
export class InverseFuturesClient extends BaseRestClient {
|
||||
getClientType() {
|
||||
@@ -38,7 +42,7 @@ export class InverseFuturesClient extends BaseRestClient {
|
||||
}
|
||||
|
||||
getKline(
|
||||
params: SymbolIntervalFromLimitParam
|
||||
params: SymbolIntervalFromLimitParam,
|
||||
): Promise<APIResponseWithTime<any[]>> {
|
||||
return this.get('v2/public/kline/list', params);
|
||||
}
|
||||
@@ -47,7 +51,7 @@ export class InverseFuturesClient extends BaseRestClient {
|
||||
* Get latest information for symbol
|
||||
*/
|
||||
getTickers(
|
||||
params?: Partial<SymbolParam>
|
||||
params?: Partial<SymbolParam>,
|
||||
): Promise<APIResponseWithTime<any[]>> {
|
||||
return this.get('v2/public/tickers', params);
|
||||
}
|
||||
@@ -64,19 +68,19 @@ export class InverseFuturesClient extends BaseRestClient {
|
||||
}
|
||||
|
||||
getMarkPriceKline(
|
||||
params: SymbolIntervalFromLimitParam
|
||||
params: SymbolIntervalFromLimitParam,
|
||||
): Promise<APIResponseWithTime<any[]>> {
|
||||
return this.get('v2/public/mark-price-kline', params);
|
||||
}
|
||||
|
||||
getIndexPriceKline(
|
||||
params: SymbolIntervalFromLimitParam
|
||||
params: SymbolIntervalFromLimitParam,
|
||||
): Promise<APIResponseWithTime<any[]>> {
|
||||
return this.get('v2/public/index-price-kline', params);
|
||||
}
|
||||
|
||||
getPremiumIndexKline(
|
||||
params: SymbolIntervalFromLimitParam
|
||||
params: SymbolIntervalFromLimitParam,
|
||||
): Promise<APIResponseWithTime<any[]>> {
|
||||
return this.get('v2/public/premium-index-kline', params);
|
||||
}
|
||||
@@ -88,19 +92,19 @@ export class InverseFuturesClient extends BaseRestClient {
|
||||
*/
|
||||
|
||||
getOpenInterest(
|
||||
params: SymbolPeriodLimitParam
|
||||
params: SymbolPeriodLimitParam,
|
||||
): Promise<APIResponseWithTime<any[]>> {
|
||||
return this.get('v2/public/open-interest', params);
|
||||
}
|
||||
|
||||
getLatestBigDeal(
|
||||
params: SymbolLimitParam
|
||||
params: SymbolLimitParam,
|
||||
): Promise<APIResponseWithTime<any[]>> {
|
||||
return this.get('v2/public/big-deal', params);
|
||||
}
|
||||
|
||||
getLongShortRatio(
|
||||
params: SymbolPeriodLimitParam
|
||||
params: SymbolPeriodLimitParam,
|
||||
): Promise<APIResponseWithTime<any[]>> {
|
||||
return this.get('v2/public/account-ratio', params);
|
||||
}
|
||||
@@ -122,25 +126,25 @@ export class InverseFuturesClient extends BaseRestClient {
|
||||
*/
|
||||
|
||||
getWalletBalance(
|
||||
params?: Partial<CoinParam>
|
||||
params?: Partial<CoinParam>,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.getPrivate('v2/private/wallet/balance', params);
|
||||
}
|
||||
|
||||
getWalletFundRecords(
|
||||
params?: WalletFundRecordsReq
|
||||
params?: WalletFundRecordsReq,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.getPrivate('v2/private/wallet/fund/records', params);
|
||||
}
|
||||
|
||||
getWithdrawRecords(
|
||||
params?: WithdrawRecordsReq
|
||||
params?: WithdrawRecordsReq,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.getPrivate('v2/private/wallet/withdraw/list', params);
|
||||
}
|
||||
|
||||
getAssetExchangeRecords(
|
||||
params?: AssetExchangeRecordsReq
|
||||
params?: AssetExchangeRecordsReq,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.getPrivate('v2/private/exchange-order/list', params);
|
||||
}
|
||||
@@ -204,7 +208,7 @@ export class InverseFuturesClient extends BaseRestClient {
|
||||
}
|
||||
|
||||
cancelAllActiveOrders(
|
||||
params: SymbolParam
|
||||
params: SymbolParam,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.postPrivate('futures/private/order/cancelAll', params);
|
||||
}
|
||||
@@ -266,7 +270,7 @@ export class InverseFuturesClient extends BaseRestClient {
|
||||
}
|
||||
|
||||
cancelAllConditionalOrders(
|
||||
params: SymbolParam
|
||||
params: SymbolParam,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.postPrivate('futures/private/stop-order/cancelAll', params);
|
||||
}
|
||||
@@ -298,7 +302,7 @@ export class InverseFuturesClient extends BaseRestClient {
|
||||
* Get position list
|
||||
*/
|
||||
getPosition(
|
||||
params?: Partial<SymbolParam>
|
||||
params?: Partial<SymbolParam>,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.getPrivate('futures/private/position/list', params);
|
||||
}
|
||||
@@ -309,7 +313,7 @@ export class InverseFuturesClient extends BaseRestClient {
|
||||
}): Promise<APIResponseWithTime<any>> {
|
||||
return this.postPrivate(
|
||||
'futures/private/position/change-position-margin',
|
||||
params
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -42,6 +42,10 @@ import BaseRestClient from './util/BaseRestClient';
|
||||
|
||||
/**
|
||||
* REST API client for linear/USD perpetual futures APIs (v2)
|
||||
*
|
||||
* @deprecated WARNING: V1/V2 private endpoints (Rest API & Websocket Stream) for mainnet
|
||||
* will be switched off gradually from 30 Oct 2023 UTC, so they are not promised a stability.
|
||||
* Please note that you are at your own risk of using old endpoints going forward, and please move to V5 ASAP.
|
||||
*/
|
||||
export class LinearClient extends BaseRestClient {
|
||||
getClientType() {
|
||||
@@ -64,7 +68,7 @@ export class LinearClient extends BaseRestClient {
|
||||
}
|
||||
|
||||
getKline(
|
||||
params: SymbolIntervalFromLimitParam
|
||||
params: SymbolIntervalFromLimitParam,
|
||||
): Promise<APIResponseWithTime<any[]>> {
|
||||
return this.get('public/linear/kline', params);
|
||||
}
|
||||
@@ -73,7 +77,7 @@ export class LinearClient extends BaseRestClient {
|
||||
* Get latest information for symbol
|
||||
*/
|
||||
getTickers(
|
||||
params?: Partial<SymbolParam>
|
||||
params?: Partial<SymbolParam>,
|
||||
): Promise<APIResponseWithTime<any[]>> {
|
||||
return this.get('v2/public/tickers', params);
|
||||
}
|
||||
@@ -91,19 +95,19 @@ export class LinearClient extends BaseRestClient {
|
||||
}
|
||||
|
||||
getMarkPriceKline(
|
||||
params: SymbolIntervalFromLimitParam
|
||||
params: SymbolIntervalFromLimitParam,
|
||||
): Promise<APIResponseWithTime<any[]>> {
|
||||
return this.get('public/linear/mark-price-kline', params);
|
||||
}
|
||||
|
||||
getIndexPriceKline(
|
||||
params: SymbolIntervalFromLimitParam
|
||||
params: SymbolIntervalFromLimitParam,
|
||||
): Promise<APIResponseWithTime<any[]>> {
|
||||
return this.get('public/linear/index-price-kline', params);
|
||||
}
|
||||
|
||||
getPremiumIndexKline(
|
||||
params: SymbolIntervalFromLimitParam
|
||||
params: SymbolIntervalFromLimitParam,
|
||||
): Promise<APIResponseWithTime<any[]>> {
|
||||
return this.get('public/linear/premium-index-kline', params);
|
||||
}
|
||||
@@ -115,19 +119,19 @@ export class LinearClient extends BaseRestClient {
|
||||
*/
|
||||
|
||||
getOpenInterest(
|
||||
params: SymbolPeriodLimitParam
|
||||
params: SymbolPeriodLimitParam,
|
||||
): Promise<APIResponseWithTime<any[]>> {
|
||||
return this.get('v2/public/open-interest', params);
|
||||
}
|
||||
|
||||
getLatestBigDeal(
|
||||
params: SymbolLimitParam
|
||||
params: SymbolLimitParam,
|
||||
): Promise<APIResponseWithTime<any[]>> {
|
||||
return this.get('v2/public/big-deal', params);
|
||||
}
|
||||
|
||||
getLongShortRatio(
|
||||
params: SymbolPeriodLimitParam
|
||||
params: SymbolPeriodLimitParam,
|
||||
): Promise<APIResponseWithTime<any[]>> {
|
||||
return this.get('v2/public/account-ratio', params);
|
||||
}
|
||||
@@ -149,25 +153,25 @@ export class LinearClient extends BaseRestClient {
|
||||
*/
|
||||
|
||||
getWalletBalance(
|
||||
params?: Partial<CoinParam>
|
||||
params?: Partial<CoinParam>,
|
||||
): Promise<APIResponseWithTime<WalletBalances>> {
|
||||
return this.getPrivate('v2/private/wallet/balance', params);
|
||||
}
|
||||
|
||||
getWalletFundRecords(
|
||||
params?: WalletFundRecordsReq
|
||||
params?: WalletFundRecordsReq,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.getPrivate('v2/private/wallet/fund/records', params);
|
||||
}
|
||||
|
||||
getWithdrawRecords(
|
||||
params?: WithdrawRecordsReq
|
||||
params?: WithdrawRecordsReq,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.getPrivate('v2/private/wallet/withdraw/list', params);
|
||||
}
|
||||
|
||||
getAssetExchangeRecords(
|
||||
params?: AssetExchangeRecordsReq
|
||||
params?: AssetExchangeRecordsReq,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.getPrivate('v2/private/exchange-order/list', params);
|
||||
}
|
||||
@@ -193,37 +197,37 @@ export class LinearClient extends BaseRestClient {
|
||||
*/
|
||||
|
||||
placeActiveOrder(
|
||||
params: NewLinearOrder
|
||||
params: NewLinearOrder,
|
||||
): Promise<APIResponseWithTime<LinearOrder | null>> {
|
||||
return this.postPrivate('private/linear/order/create', params);
|
||||
}
|
||||
|
||||
getActiveOrderList(
|
||||
params: LinearGetOrdersRequest
|
||||
params: LinearGetOrdersRequest,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.getPrivate('private/linear/order/list', params);
|
||||
}
|
||||
|
||||
cancelActiveOrder(
|
||||
params: LinearCancelOrderRequest
|
||||
params: LinearCancelOrderRequest,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.postPrivate('private/linear/order/cancel', params);
|
||||
}
|
||||
|
||||
cancelAllActiveOrders(
|
||||
params: SymbolParam
|
||||
params: SymbolParam,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.postPrivate('private/linear/order/cancel-all', params);
|
||||
}
|
||||
|
||||
replaceActiveOrder(
|
||||
params: LinearReplaceOrderRequest
|
||||
params: LinearReplaceOrderRequest,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.postPrivate('private/linear/order/replace', params);
|
||||
}
|
||||
|
||||
queryActiveOrder(
|
||||
params: LinearGetOrderRequest
|
||||
params: LinearGetOrderRequest,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.getPrivate('private/linear/order/search', params);
|
||||
}
|
||||
@@ -233,37 +237,37 @@ export class LinearClient extends BaseRestClient {
|
||||
*/
|
||||
|
||||
placeConditionalOrder(
|
||||
params: LinearConditionalOrderRequest
|
||||
params: LinearConditionalOrderRequest,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.postPrivate('private/linear/stop-order/create', params);
|
||||
}
|
||||
|
||||
getConditionalOrder(
|
||||
params: LinearGetConditionalOrderRequest
|
||||
params: LinearGetConditionalOrderRequest,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.getPrivate('private/linear/stop-order/list', params);
|
||||
}
|
||||
|
||||
cancelConditionalOrder(
|
||||
params: LinearCancelConditionalOrderRequest
|
||||
params: LinearCancelConditionalOrderRequest,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.postPrivate('private/linear/stop-order/cancel', params);
|
||||
}
|
||||
|
||||
cancelAllConditionalOrders(
|
||||
params: SymbolParam
|
||||
params: SymbolParam,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.postPrivate('private/linear/stop-order/cancel-all', params);
|
||||
}
|
||||
|
||||
replaceConditionalOrder(
|
||||
params: LinearReplaceConditionalOrderRequest
|
||||
params: LinearReplaceConditionalOrderRequest,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.postPrivate('private/linear/stop-order/replace', params);
|
||||
}
|
||||
|
||||
queryConditionalOrder(
|
||||
params: LinearQueryConditionalOrderRequest
|
||||
params: LinearQueryConditionalOrderRequest,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.getPrivate('private/linear/stop-order/search', params);
|
||||
}
|
||||
@@ -275,26 +279,26 @@ export class LinearClient extends BaseRestClient {
|
||||
getPosition(): Promise<APIResponseWithTime<PerpPositionRoot[]>>;
|
||||
|
||||
getPosition(
|
||||
params: Partial<SymbolParam>
|
||||
params: Partial<SymbolParam>,
|
||||
): Promise<APIResponseWithTime<PerpPosition[]>>;
|
||||
|
||||
getPosition(
|
||||
params?: Partial<SymbolParam>
|
||||
params?: Partial<SymbolParam>,
|
||||
): Promise<APIResponseWithTime<PerpPosition[] | PerpPositionRoot[]>> {
|
||||
return this.getPrivate('private/linear/position/list', params);
|
||||
}
|
||||
|
||||
setAutoAddMargin(
|
||||
params?: LinearSetAutoAddMarginRequest
|
||||
params?: LinearSetAutoAddMarginRequest,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.postPrivate(
|
||||
'private/linear/position/set-auto-add-margin',
|
||||
params
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
setMarginSwitch(
|
||||
params?: LinearSetMarginSwitchRequest
|
||||
params?: LinearSetMarginSwitchRequest,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.postPrivate('private/linear/position/switch-isolated', params);
|
||||
}
|
||||
@@ -303,7 +307,7 @@ export class LinearClient extends BaseRestClient {
|
||||
* Switch between one-way vs hedge mode. Use `linearPositionModeEnum` for the mode parameter.
|
||||
*/
|
||||
setPositionMode(
|
||||
params: LinearSetPositionModeRequest
|
||||
params: LinearSetPositionModeRequest,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.postPrivate('private/linear/position/switch-mode', params);
|
||||
}
|
||||
@@ -313,46 +317,46 @@ export class LinearClient extends BaseRestClient {
|
||||
* This is set with the setTradingStop() method. Use `positionTpSlModeEnum` for the tp_sl_mode parameter.
|
||||
*/
|
||||
setPositionTpSlMode(
|
||||
params: LinearSetPositionTpSlModeRequest
|
||||
params: LinearSetPositionTpSlModeRequest,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.postPrivate('private/linear/tpsl/switch-mode', params);
|
||||
}
|
||||
|
||||
setAddReduceMargin(
|
||||
params?: LinearSetAddReduceMarginRequest
|
||||
params?: LinearSetAddReduceMarginRequest,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.postPrivate('private/linear/position/add-margin', params);
|
||||
}
|
||||
|
||||
setUserLeverage(
|
||||
params: LinearSetUserLeverageRequest
|
||||
params: LinearSetUserLeverageRequest,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.postPrivate('private/linear/position/set-leverage', params);
|
||||
}
|
||||
|
||||
setTradingStop(
|
||||
params: LinearSetTradingStopRequest
|
||||
params: LinearSetTradingStopRequest,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.postPrivate('private/linear/position/trading-stop', params);
|
||||
}
|
||||
|
||||
getTradeRecords(
|
||||
params: LinearGetTradeRecordsRequest
|
||||
params: LinearGetTradeRecordsRequest,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.getPrivate('private/linear/trade/execution/list', params);
|
||||
}
|
||||
|
||||
getHistoryTradeRecords(
|
||||
params: LinearGetHistoryTradeRecordsRequest
|
||||
params: LinearGetHistoryTradeRecordsRequest,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.getPrivate(
|
||||
'/private/linear/trade/execution/history-list',
|
||||
params
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
getClosedPnl(
|
||||
params: LinearGetClosedPnlRequest
|
||||
params: LinearGetClosedPnlRequest,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.getPrivate('private/linear/trade/closed-pnl/list', params);
|
||||
}
|
||||
@@ -366,7 +370,7 @@ export class LinearClient extends BaseRestClient {
|
||||
}
|
||||
|
||||
setRiskLimit(
|
||||
params: LinearSetRiskLimitRequest
|
||||
params: LinearSetRiskLimitRequest,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.postPrivate('private/linear/position/set-risk', params);
|
||||
}
|
||||
@@ -376,7 +380,7 @@ export class LinearClient extends BaseRestClient {
|
||||
*/
|
||||
|
||||
getPredictedFundingFee(
|
||||
params: SymbolParam
|
||||
params: SymbolParam,
|
||||
): Promise<APIResponseWithTime<any>> {
|
||||
return this.getPrivate('private/linear/funding/predicted-funding', params);
|
||||
}
|
||||
|
||||
@@ -136,6 +136,7 @@ import {
|
||||
WithdrawParamsV5,
|
||||
WithdrawalRecordV5,
|
||||
} from './types';
|
||||
|
||||
import { REST_CLIENT_TYPE_ENUM } from './util';
|
||||
import BaseRestClient from './util/BaseRestClient';
|
||||
|
||||
@@ -248,6 +249,22 @@ export class RestClientV5 extends BaseRestClient {
|
||||
return this.get('/v5/market/orderbook', params);
|
||||
}
|
||||
|
||||
getTickers(
|
||||
params: GetTickersParamsV5<'linear' | 'inverse'>,
|
||||
): Promise<
|
||||
APIResponseV3WithTime<
|
||||
CategoryListV5<TickerLinearInverseV5[], 'linear' | 'inverse'>
|
||||
>
|
||||
>;
|
||||
|
||||
getTickers(
|
||||
params: GetTickersParamsV5<'option'>,
|
||||
): Promise<APIResponseV3WithTime<CategoryListV5<TickerOptionV5[], 'option'>>>;
|
||||
|
||||
getTickers(
|
||||
params: GetTickersParamsV5<'spot'>,
|
||||
): Promise<APIResponseV3WithTime<CategoryListV5<TickerSpotV5[], 'spot'>>>;
|
||||
|
||||
/**
|
||||
* Query the latest price snapshot, best bid/ask price, and trading volume in the last 24 hours.
|
||||
*
|
||||
|
||||
@@ -14,8 +14,11 @@ import BaseRestClient from './util/BaseRestClient';
|
||||
import { REST_CLIENT_TYPE_ENUM } from './util/requestUtils';
|
||||
|
||||
/**
|
||||
* @deprecated Use SpotV3Client instead, which leverages the newer v3 APIs
|
||||
* REST API client for Spot APIs (v1)
|
||||
*
|
||||
* @deprecated WARNING: V1/V2 private endpoints (Rest API & Websocket Stream) for mainnet
|
||||
* will be switched off gradually from 30 Oct 2023 UTC, so they are not promised a stability.
|
||||
* Please note that you are at your own risk of using old endpoints going forward, and please move to V5 ASAP.
|
||||
*/
|
||||
export class SpotClient extends BaseRestClient {
|
||||
getClientType() {
|
||||
@@ -51,7 +54,7 @@ export class SpotClient extends BaseRestClient {
|
||||
getMergedOrderBook(
|
||||
symbol: string,
|
||||
scale?: number,
|
||||
limit?: number
|
||||
limit?: number,
|
||||
): Promise<APIResponse<any>> {
|
||||
return this.get('/spot/quote/v1/depth/merged', {
|
||||
symbol,
|
||||
@@ -72,7 +75,7 @@ export class SpotClient extends BaseRestClient {
|
||||
interval: KlineInterval,
|
||||
limit?: number,
|
||||
startTime?: number,
|
||||
endTime?: number
|
||||
endTime?: number,
|
||||
): Promise<APIResponse<any[]>> {
|
||||
return this.get('/spot/quote/v1/kline', {
|
||||
symbol,
|
||||
@@ -92,7 +95,7 @@ export class SpotClient extends BaseRestClient {
|
||||
getLastTradedPrice(symbol: string): Promise<APIResponse<SpotLastPrice>>;
|
||||
|
||||
getLastTradedPrice(
|
||||
symbol?: string
|
||||
symbol?: string,
|
||||
): Promise<APIResponse<SpotLastPrice | SpotLastPrice[]>> {
|
||||
return this.get('/spot/quote/v1/ticker/price', { symbol });
|
||||
}
|
||||
@@ -135,7 +138,7 @@ export class SpotClient extends BaseRestClient {
|
||||
getOpenOrders(
|
||||
symbol?: string,
|
||||
orderId?: string,
|
||||
limit?: number
|
||||
limit?: number,
|
||||
): Promise<APIResponse<any>> {
|
||||
return this.getPrivate('/spot/v1/open-orders', {
|
||||
symbol,
|
||||
@@ -147,7 +150,7 @@ export class SpotClient extends BaseRestClient {
|
||||
getPastOrders(
|
||||
symbol?: string,
|
||||
orderId?: string,
|
||||
limit?: number
|
||||
limit?: number,
|
||||
): Promise<APIResponse<any>> {
|
||||
return this.getPrivate('/spot/v1/history-orders', {
|
||||
symbol,
|
||||
@@ -160,7 +163,7 @@ export class SpotClient extends BaseRestClient {
|
||||
symbol?: string,
|
||||
limit?: number,
|
||||
fromId?: number,
|
||||
toId?: number
|
||||
toId?: number,
|
||||
): Promise<APIResponse<any>> {
|
||||
return this.getPrivate('/spot/v1/myTrades', {
|
||||
symbol,
|
||||
|
||||
@@ -52,8 +52,8 @@ export interface GetOrderbookParamsV5 {
|
||||
limit?: number;
|
||||
}
|
||||
|
||||
export interface GetTickersParamsV5 {
|
||||
category: CategoryV5;
|
||||
export interface GetTickersParamsV5<TCategory = CategoryV5> {
|
||||
category: TCategory;
|
||||
symbol?: string;
|
||||
baseCoin?: string;
|
||||
expDate?: string;
|
||||
|
||||
@@ -61,18 +61,33 @@ export interface APIResponse<T> {
|
||||
result: T;
|
||||
}
|
||||
|
||||
export interface APIRateLimit {
|
||||
/** Remaining requests to this endpoint before the next reset */
|
||||
remainingRequests: number;
|
||||
/** Max requests for this endpoint per rollowing window (before next reset) */
|
||||
maxRequests: number;
|
||||
/**
|
||||
* Timestamp when the rate limit resets if you have exceeded your current maxRequests.
|
||||
* Otherwise, this is approximately your current timestamp.
|
||||
*/
|
||||
resetAtTimestamp: number;
|
||||
}
|
||||
|
||||
export interface APIResponseV3<T> {
|
||||
retCode: number;
|
||||
retMsg: 'OK' | string;
|
||||
result: T;
|
||||
/**
|
||||
* These are per-UID per-endpoint rate limits, automatically parsed from response headers if available.
|
||||
*
|
||||
* Note:
|
||||
* - this is primarily for V5 (or newer) APIs.
|
||||
* - these rate limits are per-endpoint per-account, so will not appear for public API calls
|
||||
*/
|
||||
rateLimitApi?: APIRateLimit;
|
||||
}
|
||||
|
||||
export interface APIResponseV3WithTime<T> {
|
||||
retCode: number;
|
||||
retMsg: 'OK' | string;
|
||||
result: T;
|
||||
time: number;
|
||||
}
|
||||
export type APIResponseV3WithTime<T> = APIResponseV3<T> & { time: number };
|
||||
|
||||
export interface APIResponseWithTime<T = {}> extends APIResponse<T> {
|
||||
/** UTC timestamp */
|
||||
|
||||
@@ -25,6 +25,10 @@ import BaseRestClient from './util/BaseRestClient';
|
||||
|
||||
/**
|
||||
* REST API client for USDC Option APIs
|
||||
*
|
||||
* @deprecated WARNING: V1/V2 private endpoints (Rest API & Websocket Stream) for mainnet
|
||||
* will be switched off gradually from 30 Oct 2023 UTC, so they are not promised a stability.
|
||||
* Please note that you are at your own risk of using old endpoints going forward, and please move to V5 ASAP.
|
||||
*/
|
||||
export class USDCOptionClient extends BaseRestClient {
|
||||
getClientType() {
|
||||
@@ -49,7 +53,7 @@ export class USDCOptionClient extends BaseRestClient {
|
||||
|
||||
/** Fetch trading rules (such as min/max qty). Query for all if blank. */
|
||||
getContractInfo(
|
||||
params?: USDCOptionsContractInfoRequest
|
||||
params?: USDCOptionsContractInfoRequest,
|
||||
): Promise<APIResponseV3<any>> {
|
||||
return this.get('/option/usdc/openapi/public/v1/symbols', params);
|
||||
}
|
||||
@@ -61,18 +65,18 @@ export class USDCOptionClient extends BaseRestClient {
|
||||
|
||||
/** Get delivery information */
|
||||
getDeliveryPrice(
|
||||
params?: USDCOptionsDeliveryPriceRequest
|
||||
params?: USDCOptionsDeliveryPriceRequest,
|
||||
): Promise<APIResponseV3<any>> {
|
||||
return this.get('/option/usdc/openapi/public/v1/delivery-price', params);
|
||||
}
|
||||
|
||||
/** Returned records are Taker Buy in default. */
|
||||
getLast500Trades(
|
||||
params: USDCOptionsRecentTradesRequest
|
||||
params: USDCOptionsRecentTradesRequest,
|
||||
): Promise<APIResponseV3<any>> {
|
||||
return this.get(
|
||||
'/option/usdc/openapi/public/v1/query-trade-latest',
|
||||
params
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -84,11 +88,11 @@ export class USDCOptionClient extends BaseRestClient {
|
||||
* Both startTime & endTime entered together or both are left blank
|
||||
*/
|
||||
getHistoricalVolatility(
|
||||
params?: USDCOptionsHistoricalVolatilityRequest
|
||||
params?: USDCOptionsHistoricalVolatilityRequest,
|
||||
): Promise<APIResponseV3<any>> {
|
||||
return this.get(
|
||||
'/option/usdc/openapi/public/v1/query-historical-volatility',
|
||||
params
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -108,7 +112,7 @@ export class USDCOptionClient extends BaseRestClient {
|
||||
submitOrder(params: USDCOptionsOrderRequest): Promise<APIResponseV3<any>> {
|
||||
return this.postPrivate(
|
||||
'/option/usdc/openapi/private/v1/place-order',
|
||||
params
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -116,91 +120,91 @@ export class USDCOptionClient extends BaseRestClient {
|
||||
* Each request supports a max. of four orders. The reduceOnly parameter should be separate and unique for each order in the request.
|
||||
*/
|
||||
batchSubmitOrders(
|
||||
orderRequest: USDCOptionsOrderRequest[]
|
||||
orderRequest: USDCOptionsOrderRequest[],
|
||||
): Promise<APIResponseV3<any>> {
|
||||
return this.postPrivate(
|
||||
'/option/usdc/openapi/private/v1/batch-place-orders',
|
||||
{ orderRequest }
|
||||
{ orderRequest },
|
||||
);
|
||||
}
|
||||
|
||||
/** For Options, at least one of the three parameters — price, quantity or implied volatility — must be input. */
|
||||
modifyOrder(
|
||||
params: USDCOptionsModifyOrderRequest
|
||||
params: USDCOptionsModifyOrderRequest,
|
||||
): Promise<APIResponseV3<any>> {
|
||||
return this.postPrivate(
|
||||
'/option/usdc/openapi/private/v1/replace-order',
|
||||
params
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
/** Each request supports a max. of four orders. The reduceOnly parameter should be separate and unique for each order in the request. */
|
||||
batchModifyOrders(
|
||||
replaceOrderRequest: USDCOptionsModifyOrderRequest[]
|
||||
replaceOrderRequest: USDCOptionsModifyOrderRequest[],
|
||||
): Promise<APIResponseV3<any>> {
|
||||
return this.postPrivate(
|
||||
'/option/usdc/openapi/private/v1/batch-replace-orders',
|
||||
{ replaceOrderRequest }
|
||||
{ replaceOrderRequest },
|
||||
);
|
||||
}
|
||||
|
||||
/** Cancel order */
|
||||
cancelOrder(
|
||||
params: USDCOptionsCancelOrderRequest
|
||||
params: USDCOptionsCancelOrderRequest,
|
||||
): Promise<APIResponseV3<any>> {
|
||||
return this.postPrivate(
|
||||
'/option/usdc/openapi/private/v1/cancel-order',
|
||||
params
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
/** Batch cancel orders */
|
||||
batchCancelOrders(
|
||||
cancelRequest: USDCOptionsCancelOrderRequest[]
|
||||
cancelRequest: USDCOptionsCancelOrderRequest[],
|
||||
): Promise<APIResponseV3<any>> {
|
||||
return this.postPrivate(
|
||||
'/option/usdc/openapi/private/v1/batch-cancel-orders',
|
||||
{ cancelRequest }
|
||||
{ cancelRequest },
|
||||
);
|
||||
}
|
||||
|
||||
/** This is used to cancel all active orders. The real-time response indicates whether the request is successful, depending on retCode. */
|
||||
cancelActiveOrders(
|
||||
params?: USDCOptionsCancelAllOrdersRequest
|
||||
params?: USDCOptionsCancelAllOrdersRequest,
|
||||
): Promise<APIResponseV3<any>> {
|
||||
return this.postPrivate(
|
||||
'/option/usdc/openapi/private/v1/cancel-all',
|
||||
params
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
/** Query Unfilled/Partially Filled Orders(real-time), up to last 7 days of partially filled/unfilled orders */
|
||||
getActiveRealtimeOrders(
|
||||
params?: USDCOptionsActiveOrdersRealtimeRequest
|
||||
params?: USDCOptionsActiveOrdersRealtimeRequest,
|
||||
): Promise<APIResponseV3<any>> {
|
||||
return this.getPrivate(
|
||||
'/option/usdc/openapi/private/v1/trade/query-active-orders',
|
||||
params
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
/** Query Unfilled/Partially Filled Orders */
|
||||
getActiveOrders(
|
||||
params: USDCOptionsActiveOrdersRequest
|
||||
params: USDCOptionsActiveOrdersRequest,
|
||||
): Promise<APIResponseV3<any>> {
|
||||
return this.postPrivate(
|
||||
'/option/usdc/openapi/private/v1/query-active-orders',
|
||||
params
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
/** Query order history. The endpoint only supports up to 30 days of queried records */
|
||||
getHistoricOrders(
|
||||
params: USDCOptionsHistoricOrdersRequest
|
||||
params: USDCOptionsHistoricOrdersRequest,
|
||||
): Promise<APIResponseV3<any>> {
|
||||
return this.postPrivate(
|
||||
'/option/usdc/openapi/private/v1/query-order-history',
|
||||
params
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -210,11 +214,11 @@ export class USDCOptionClient extends BaseRestClient {
|
||||
* An error will be returned if startTime is more than 30 days.
|
||||
*/
|
||||
getOrderExecutionHistory(
|
||||
params: USDCOptionsOrderExecutionRequest
|
||||
params: USDCOptionsOrderExecutionRequest,
|
||||
): Promise<APIResponseV3<any>> {
|
||||
return this.postPrivate(
|
||||
'/option/usdc/openapi/private/v1/execution-list',
|
||||
params
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -222,18 +226,18 @@ export class USDCOptionClient extends BaseRestClient {
|
||||
|
||||
/** The endpoint only supports up to 30 days of queried records. An error will be returned if startTime is more than 30 days. */
|
||||
getTransactionLog(
|
||||
params: USDCTransactionLogRequest
|
||||
params: USDCTransactionLogRequest,
|
||||
): Promise<APIResponseV3<any>> {
|
||||
return this.postPrivate(
|
||||
'/option/usdc/openapi/private/v1/query-transaction-log',
|
||||
params
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
/** Wallet info for USDC account. */
|
||||
getBalances(): Promise<APIResponseV3<any>> {
|
||||
return this.postPrivate(
|
||||
'/option/usdc/openapi/private/v1/query-wallet-balance'
|
||||
'/option/usdc/openapi/private/v1/query-wallet-balance',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -241,7 +245,7 @@ export class USDCOptionClient extends BaseRestClient {
|
||||
getAssetInfo(baseCoin?: string): Promise<APIResponseV3<any>> {
|
||||
return this.postPrivate(
|
||||
'/option/usdc/openapi/private/v1/query-asset-info',
|
||||
{ baseCoin }
|
||||
{ baseCoin },
|
||||
);
|
||||
}
|
||||
|
||||
@@ -252,18 +256,18 @@ export class USDCOptionClient extends BaseRestClient {
|
||||
* Rest API returns the result of checking prerequisites. You could get the real status of margin mode change by subscribing margin mode.
|
||||
*/
|
||||
setMarginMode(
|
||||
newMarginMode: 'REGULAR_MARGIN' | 'PORTFOLIO_MARGIN'
|
||||
newMarginMode: 'REGULAR_MARGIN' | 'PORTFOLIO_MARGIN',
|
||||
): Promise<APIResponseV3<any>> {
|
||||
return this.postPrivate(
|
||||
'/option/usdc/private/asset/account/setMarginMode',
|
||||
{ setMarginMode: newMarginMode }
|
||||
{ setMarginMode: newMarginMode },
|
||||
);
|
||||
}
|
||||
|
||||
/** Query margin mode for USDC account. */
|
||||
getMarginMode(): Promise<APIResponseV3<any>> {
|
||||
return this.postPrivate(
|
||||
'/option/usdc/openapi/private/v1/query-margin-info'
|
||||
'/option/usdc/openapi/private/v1/query-margin-info',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -273,27 +277,27 @@ export class USDCOptionClient extends BaseRestClient {
|
||||
getPositions(params: USDCPositionsRequest): Promise<APIResponseV3<any>> {
|
||||
return this.postPrivate(
|
||||
'/option/usdc/openapi/private/v1/query-position',
|
||||
params
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
/** Query Delivery History */
|
||||
getDeliveryHistory(
|
||||
params: USDCOptionsDeliveryHistoryRequest
|
||||
params: USDCOptionsDeliveryHistoryRequest,
|
||||
): Promise<APIResponseV3<any>> {
|
||||
return this.postPrivate(
|
||||
'/option/usdc/openapi/private/v1/query-delivery-list',
|
||||
params
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
/** Query Positions Info Upon Expiry */
|
||||
getPositionsInfoUponExpiry(
|
||||
params?: USDCOptionsPositionsInfoExpiryRequest
|
||||
params?: USDCOptionsPositionsInfoExpiryRequest,
|
||||
): Promise<APIResponseV3<any>> {
|
||||
return this.postPrivate(
|
||||
'/option/usdc/openapi/private/v1/query-position-exp-date',
|
||||
params
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -303,7 +307,7 @@ export class USDCOptionClient extends BaseRestClient {
|
||||
modifyMMP(params: USDCOptionsModifyMMPRequest): Promise<APIResponseV3<any>> {
|
||||
return this.postPrivate(
|
||||
'/option/usdc/openapi/private/v1/mmp-modify',
|
||||
params
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,10 @@ import BaseRestClient from './util/BaseRestClient';
|
||||
|
||||
/**
|
||||
* REST API client for USDC Perpetual APIs
|
||||
*
|
||||
* @deprecated WARNING: V1/V2 private endpoints (Rest API & Websocket Stream) for mainnet
|
||||
* will be switched off gradually from 30 Oct 2023 UTC, so they are not promised a stability.
|
||||
* Please note that you are at your own risk of using old endpoints going forward, and please move to V5 ASAP.
|
||||
*/
|
||||
export class USDCPerpetualClient extends BaseRestClient {
|
||||
getClientType() {
|
||||
@@ -47,7 +51,7 @@ export class USDCPerpetualClient extends BaseRestClient {
|
||||
|
||||
/** Fetch trading rules (such as min/max qty). Query for all if blank. */
|
||||
getContractInfo(
|
||||
params?: USDCSymbolDirectionLimit
|
||||
params?: USDCSymbolDirectionLimit,
|
||||
): Promise<APIResponseV3<any>> {
|
||||
return this.get('/perpetual/usdc/openapi/public/v1/symbols', params);
|
||||
}
|
||||
@@ -64,48 +68,48 @@ export class USDCPerpetualClient extends BaseRestClient {
|
||||
getMarkPrice(params: USDCKlineRequest): Promise<APIResponseV3<any>> {
|
||||
return this.get(
|
||||
'/perpetual/usdc/openapi/public/v1/mark-price-kline',
|
||||
params
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
getIndexPrice(params: USDCKlineRequest): Promise<APIResponseV3<any>> {
|
||||
return this.get(
|
||||
'/perpetual/usdc/openapi/public/v1/index-price-kline',
|
||||
params
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
getIndexPremium(params: USDCKlineRequest): Promise<APIResponseV3<any>> {
|
||||
return this.get(
|
||||
'/perpetual/usdc/openapi/public/v1/premium-index-kline',
|
||||
params
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
getOpenInterest(
|
||||
params: USDCOpenInterestRequest
|
||||
params: USDCOpenInterestRequest,
|
||||
): Promise<APIResponseV3<any>> {
|
||||
return this.get('/perpetual/usdc/openapi/public/v1/open-interest', params);
|
||||
}
|
||||
|
||||
getLargeOrders(
|
||||
params: SymbolLimitParam<string>
|
||||
params: SymbolLimitParam<string>,
|
||||
): Promise<APIResponseV3<any>> {
|
||||
return this.get('/perpetual/usdc/openapi/public/v1/big-deal', params);
|
||||
}
|
||||
|
||||
getLongShortRatio(
|
||||
params: SymbolPeriodLimitParam<string>
|
||||
params: SymbolPeriodLimitParam<string>,
|
||||
): Promise<APIResponseV3<any>> {
|
||||
return this.get('/perpetual/usdc/openapi/public/v1/account-ratio', params);
|
||||
}
|
||||
|
||||
getLast500Trades(
|
||||
params: USDCLast500TradesRequest
|
||||
params: USDCLast500TradesRequest,
|
||||
): Promise<APIResponseV3<any>> {
|
||||
return this.get(
|
||||
'/option/usdc/openapi/public/v1/query-trade-latest',
|
||||
params
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -125,7 +129,7 @@ export class USDCPerpetualClient extends BaseRestClient {
|
||||
submitOrder(params: USDCPerpOrderRequest): Promise<APIResponseV3<any>> {
|
||||
return this.postPrivate(
|
||||
'/perpetual/usdc/openapi/private/v1/place-order',
|
||||
params
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -133,7 +137,7 @@ export class USDCPerpetualClient extends BaseRestClient {
|
||||
modifyOrder(params: USDCPerpModifyOrderRequest): Promise<APIResponseV3<any>> {
|
||||
return this.postPrivate(
|
||||
'/perpetual/usdc/openapi/private/v1/replace-order',
|
||||
params
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -141,14 +145,14 @@ export class USDCPerpetualClient extends BaseRestClient {
|
||||
cancelOrder(params: USDCPerpCancelOrderRequest): Promise<APIResponseV3<any>> {
|
||||
return this.postPrivate(
|
||||
'/perpetual/usdc/openapi/private/v1/cancel-order',
|
||||
params
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
/** Cancel all active orders. The real-time response indicates whether the request is successful, depending on retCode. */
|
||||
cancelActiveOrders(
|
||||
symbol: string,
|
||||
orderFilter: USDCOrderFilter
|
||||
orderFilter: USDCOrderFilter,
|
||||
): Promise<APIResponseV3<any>> {
|
||||
return this.postPrivate('/perpetual/usdc/openapi/private/v1/cancel-all', {
|
||||
symbol,
|
||||
@@ -158,31 +162,31 @@ export class USDCPerpetualClient extends BaseRestClient {
|
||||
|
||||
/** Query Unfilled/Partially Filled Orders */
|
||||
getActiveOrders(
|
||||
params: USDCPerpActiveOrdersRequest
|
||||
params: USDCPerpActiveOrdersRequest,
|
||||
): Promise<APIResponseV3<any>> {
|
||||
return this.postPrivate(
|
||||
'/option/usdc/openapi/private/v1/query-active-orders',
|
||||
params
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
/** Query order history. The endpoint only supports up to 30 days of queried records */
|
||||
getHistoricOrders(
|
||||
params: USDCPerpHistoricOrdersRequest
|
||||
params: USDCPerpHistoricOrdersRequest,
|
||||
): Promise<APIResponseV3<any>> {
|
||||
return this.postPrivate(
|
||||
'/option/usdc/openapi/private/v1/query-order-history',
|
||||
params
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
/** Query trade history. The endpoint only supports up to 30 days of queried records. An error will be returned if startTime is more than 30 days. */
|
||||
getOrderExecutionHistory(
|
||||
params: USDCPerpActiveOrdersRequest
|
||||
params: USDCPerpActiveOrdersRequest,
|
||||
): Promise<APIResponseV3<any>> {
|
||||
return this.postPrivate(
|
||||
'/option/usdc/openapi/private/v1/execution-list',
|
||||
params
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -190,18 +194,18 @@ export class USDCPerpetualClient extends BaseRestClient {
|
||||
|
||||
/** The endpoint only supports up to 30 days of queried records. An error will be returned if startTime is more than 30 days. */
|
||||
getTransactionLog(
|
||||
params: USDCTransactionLogRequest
|
||||
params: USDCTransactionLogRequest,
|
||||
): Promise<APIResponseV3<any>> {
|
||||
return this.postPrivate(
|
||||
'/option/usdc/openapi/private/v1/query-transaction-log',
|
||||
params
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
/** Wallet info for USDC account. */
|
||||
getBalances(): Promise<APIResponseV3<any>> {
|
||||
return this.postPrivate(
|
||||
'/option/usdc/openapi/private/v1/query-wallet-balance'
|
||||
'/option/usdc/openapi/private/v1/query-wallet-balance',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -209,7 +213,7 @@ export class USDCPerpetualClient extends BaseRestClient {
|
||||
getAssetInfo(baseCoin?: string): Promise<APIResponseV3<any>> {
|
||||
return this.postPrivate(
|
||||
'/option/usdc/openapi/private/v1/query-asset-info',
|
||||
{ baseCoin }
|
||||
{ baseCoin },
|
||||
);
|
||||
}
|
||||
|
||||
@@ -220,18 +224,18 @@ export class USDCPerpetualClient extends BaseRestClient {
|
||||
* Rest API returns the result of checking prerequisites. You could get the real status of margin mode change by subscribing margin mode.
|
||||
*/
|
||||
setMarginMode(
|
||||
newMarginMode: 'REGULAR_MARGIN' | 'PORTFOLIO_MARGIN'
|
||||
newMarginMode: 'REGULAR_MARGIN' | 'PORTFOLIO_MARGIN',
|
||||
): Promise<APIResponseV3<any>> {
|
||||
return this.postPrivate(
|
||||
'/option/usdc/private/asset/account/setMarginMode',
|
||||
{ setMarginMode: newMarginMode }
|
||||
{ setMarginMode: newMarginMode },
|
||||
);
|
||||
}
|
||||
|
||||
/** Query margin mode for USDC account. */
|
||||
getMarginMode(): Promise<APIResponseV3<any>> {
|
||||
return this.postPrivate(
|
||||
'/option/usdc/openapi/private/v1/query-margin-info'
|
||||
'/option/usdc/openapi/private/v1/query-margin-info',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -241,7 +245,7 @@ export class USDCPerpetualClient extends BaseRestClient {
|
||||
getPositions(params: USDCPositionsRequest): Promise<APIResponseV3<any>> {
|
||||
return this.postPrivate(
|
||||
'/option/usdc/openapi/private/v1/query-position',
|
||||
params
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -249,17 +253,17 @@ export class USDCPerpetualClient extends BaseRestClient {
|
||||
setLeverage(symbol: string, leverage: string): Promise<APIResponseV3<any>> {
|
||||
return this.postPrivate(
|
||||
'/perpetual/usdc/openapi/private/v1/position/leverage/save',
|
||||
{ symbol, leverage }
|
||||
{ symbol, leverage },
|
||||
);
|
||||
}
|
||||
|
||||
/** Query Settlement History */
|
||||
getSettlementHistory(
|
||||
params?: USDCSymbolDirectionLimitCursor
|
||||
params?: USDCSymbolDirectionLimitCursor,
|
||||
): Promise<APIResponseV3<any>> {
|
||||
return this.postPrivate(
|
||||
'/option/usdc/openapi/private/v1/session-settlement',
|
||||
params
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -271,7 +275,7 @@ export class USDCPerpetualClient extends BaseRestClient {
|
||||
'/perpetual/usdc/openapi/public/v1/risk-limit/list',
|
||||
{
|
||||
symbol,
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -279,7 +283,7 @@ export class USDCPerpetualClient extends BaseRestClient {
|
||||
setRiskLimit(symbol: string, riskId: number): Promise<APIResponseV3<any>> {
|
||||
return this.postPrivate(
|
||||
'/perpetual/usdc/openapi/private/v1/position/set-risk-limit',
|
||||
{ symbol, riskId }
|
||||
{ symbol, riskId },
|
||||
);
|
||||
}
|
||||
|
||||
@@ -296,7 +300,7 @@ export class USDCPerpetualClient extends BaseRestClient {
|
||||
getPredictedFundingRate(symbol: string): Promise<APIResponseV3<any>> {
|
||||
return this.postPrivate(
|
||||
'/perpetual/usdc/openapi/private/v1/predicted-funding',
|
||||
{ symbol }
|
||||
{ symbol },
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
RestClientOptions,
|
||||
RestClientType,
|
||||
getRestBaseUrl,
|
||||
parseRateLimitHeaders,
|
||||
serializeParams,
|
||||
} from './requestUtils';
|
||||
import { signMessage } from './node-support';
|
||||
@@ -98,7 +99,7 @@ export default abstract class BaseRestClient {
|
||||
|
||||
/**
|
||||
* Create an instance of the REST client. Pass API credentials in the object in the first parameter.
|
||||
* @param {RestClientOptions} [restClientOptions={}] options to configure REST API connectivity
|
||||
* @param {RestClientOptions} [restOptions={}] options to configure REST API connectivity
|
||||
* @param {AxiosRequestConfig} [networkOptions={}] HTTP networking options for axios
|
||||
*/
|
||||
constructor(
|
||||
@@ -323,7 +324,17 @@ export default abstract class BaseRestClient {
|
||||
return axios(options)
|
||||
.then((response) => {
|
||||
if (response.status == 200) {
|
||||
return response.data;
|
||||
const perAPIRateLimits = this.options.parseAPIRateLimits
|
||||
? parseRateLimitHeaders(
|
||||
response.headers,
|
||||
this.options.throwOnFailedRateLimitParse === true,
|
||||
)
|
||||
: undefined;
|
||||
|
||||
return {
|
||||
rateLimitApi: perAPIRateLimits,
|
||||
...response.data,
|
||||
};
|
||||
}
|
||||
|
||||
throw response;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { APIRateLimit } from '../types';
|
||||
import { WebsocketSucceededTopicSubscriptionConfirmationEvent } from '../types/ws-events/succeeded-topic-subscription-confirmation';
|
||||
import { WebsocketTopicSubscriptionConfirmationEvent } from '../types/ws-events/topic-subscription-confirmation';
|
||||
|
||||
@@ -46,6 +47,12 @@ export interface RestClientOptions {
|
||||
|
||||
/** Default: true. whether to try and post-process request exceptions. */
|
||||
parse_exceptions?: boolean;
|
||||
|
||||
/** Default: false. Enable to parse/include per-API/endpoint rate limits in responses. */
|
||||
parseAPIRateLimits?: boolean;
|
||||
|
||||
/** Default: false. Enable to throw error if rate limit parser fails */
|
||||
throwOnFailedRateLimitParse?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -169,3 +176,54 @@ export const REST_CLIENT_TYPE_ENUM = {
|
||||
|
||||
export type RestClientType =
|
||||
(typeof REST_CLIENT_TYPE_ENUM)[keyof typeof REST_CLIENT_TYPE_ENUM];
|
||||
|
||||
/** Parse V5 rate limit response headers, if enabled */
|
||||
export function parseRateLimitHeaders(
|
||||
headers: Record<string, string | undefined> = {},
|
||||
throwOnFailedRateLimitParse: boolean,
|
||||
): APIRateLimit | undefined {
|
||||
try {
|
||||
const remaining = headers['x-bapi-limit-status'];
|
||||
const max = headers['x-bapi-limit'];
|
||||
const resetAt = headers['x-bapi-limit-reset-timestamp'];
|
||||
|
||||
if (
|
||||
typeof remaining === 'undefined' ||
|
||||
typeof max === 'undefined' ||
|
||||
typeof resetAt === 'undefined'
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
const result: APIRateLimit = {
|
||||
remainingRequests: Number(remaining),
|
||||
maxRequests: Number(max),
|
||||
resetAtTimestamp: Number(resetAt),
|
||||
};
|
||||
|
||||
if (
|
||||
isNaN(result.remainingRequests) ||
|
||||
isNaN(result.maxRequests) ||
|
||||
isNaN(result.resetAtTimestamp)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
return result;
|
||||
} catch (e) {
|
||||
if (throwOnFailedRateLimitParse) {
|
||||
console.log(
|
||||
new Date(),
|
||||
'parseRateLimitHeaders()',
|
||||
'Failed to parse rate limit headers',
|
||||
{
|
||||
headers,
|
||||
exception: e,
|
||||
},
|
||||
);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ import { InverseFuturesClient } from '../../src/inverse-futures-client';
|
||||
import { getTestProxy } from '../proxy.util';
|
||||
import { successResponseList, successResponseObject } from '../response.util';
|
||||
|
||||
describe('Private Inverse-Futures REST API GET Endpoints', () => {
|
||||
describe.skip('Private Inverse-Futures REST API GET Endpoints', () => {
|
||||
const API_KEY = process.env.API_KEY_COM;
|
||||
const API_SECRET = process.env.API_SECRET_COM;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import { API_ERROR_CODE, InverseFuturesClient } from '../../src';
|
||||
import { getTestProxy } from '../proxy.util';
|
||||
import { successResponseObject } from '../response.util';
|
||||
|
||||
describe('Private Inverse-Futures REST API POST Endpoints', () => {
|
||||
describe.skip('Private Inverse-Futures REST API POST Endpoints', () => {
|
||||
const API_KEY = process.env.API_KEY_COM;
|
||||
const API_SECRET = process.env.API_SECRET_COM;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
successResponseObject,
|
||||
} from '../response.util';
|
||||
|
||||
describe('Public Inverse-Futures REST API Endpoints', () => {
|
||||
describe.skip('Public Inverse-Futures REST API Endpoints', () => {
|
||||
const api = new InverseFuturesClient({}, getTestProxy());
|
||||
|
||||
const symbol = 'BTCUSD';
|
||||
|
||||
@@ -2,7 +2,7 @@ import { InverseClient } from '../../src/';
|
||||
import { getTestProxy } from '../proxy.util';
|
||||
import { successResponseList, successResponseObject } from '../response.util';
|
||||
|
||||
describe('Private Inverse REST API GET Endpoints', () => {
|
||||
describe.skip('Private Inverse REST API GET Endpoints', () => {
|
||||
const API_KEY = process.env.API_KEY_COM;
|
||||
const API_SECRET = process.env.API_SECRET_COM;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { InverseClient } from '../../src/inverse-client';
|
||||
import { getTestProxy } from '../proxy.util';
|
||||
import { successResponseObject } from '../response.util';
|
||||
|
||||
describe('Private Inverse REST API POST Endpoints', () => {
|
||||
describe.skip('Private Inverse REST API POST Endpoints', () => {
|
||||
const API_KEY = process.env.API_KEY_COM;
|
||||
const API_SECRET = process.env.API_SECRET_COM;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
successResponseObject,
|
||||
} from '../response.util';
|
||||
|
||||
describe('Public Inverse REST API Endpoints', () => {
|
||||
describe.skip('Public Inverse REST API Endpoints', () => {
|
||||
const api = new InverseClient({}, getTestProxy());
|
||||
|
||||
const symbol = 'BTCUSD';
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
waitForSocketEvent,
|
||||
} from '../ws.util';
|
||||
|
||||
describe('Private Inverse Perps Websocket Client', () => {
|
||||
describe.skip('Private Inverse Perps Websocket Client', () => {
|
||||
const API_KEY = process.env.API_KEY_COM;
|
||||
const API_SECRET = process.env.API_SECRET_COM;
|
||||
|
||||
@@ -27,7 +27,7 @@ describe('Private Inverse Perps Websocket Client', () => {
|
||||
key: 'bad',
|
||||
secret: 'bad',
|
||||
},
|
||||
getSilentLogger('expect401')
|
||||
getSilentLogger('expect401'),
|
||||
);
|
||||
|
||||
const wsOpenPromise = waitForSocketEvent(badClient, 'open', 2500);
|
||||
@@ -55,7 +55,7 @@ describe('Private Inverse Perps Websocket Client', () => {
|
||||
beforeAll(() => {
|
||||
wsClient = new WebsocketClient(
|
||||
wsClientOptions,
|
||||
getSilentLogger('expectSuccess')
|
||||
getSilentLogger('expectSuccess'),
|
||||
);
|
||||
wsClient.connectPrivate();
|
||||
});
|
||||
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
waitForSocketEvent,
|
||||
} from '../ws.util';
|
||||
|
||||
describe('Public Inverse Perps Websocket Client', () => {
|
||||
describe.skip('Public Inverse Perps Websocket Client', () => {
|
||||
let wsClient: WebsocketClient;
|
||||
|
||||
const wsClientOptions: WSClientConfigurableOptions = {
|
||||
@@ -66,7 +66,7 @@ describe('Public Inverse Perps Websocket Client', () => {
|
||||
} catch (e) {
|
||||
console.error(
|
||||
`Wait for "${wsTopic}" subscription response exception: `,
|
||||
e
|
||||
e,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import { LinearClient } from '../../src/linear-client';
|
||||
import { getTestProxy } from '../proxy.util';
|
||||
import { successResponseList, successResponseObject } from '../response.util';
|
||||
|
||||
describe('Private Linear REST API GET Endpoints', () => {
|
||||
describe.skip('Private Linear REST API GET Endpoints', () => {
|
||||
const API_KEY = process.env.API_KEY_COM;
|
||||
const API_SECRET = process.env.API_SECRET_COM;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import { LinearClient } from '../../src';
|
||||
import { getTestProxy } from '../proxy.util';
|
||||
import { successResponseObject } from '../response.util';
|
||||
|
||||
describe('Private Linear REST API POST Endpoints', () => {
|
||||
describe.skip('Private Linear REST API POST Endpoints', () => {
|
||||
const API_KEY = process.env.API_KEY_COM;
|
||||
const API_SECRET = process.env.API_SECRET_COM;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
successResponseObject,
|
||||
} from '../response.util';
|
||||
|
||||
describe('Public Linear REST API Endpoints', () => {
|
||||
describe.skip('Public Linear REST API Endpoints', () => {
|
||||
const api = new LinearClient({}, getTestProxy());
|
||||
|
||||
const symbol = 'BTCUSDT';
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
waitForSocketEvent,
|
||||
} from '../ws.util';
|
||||
|
||||
describe('Private Linear Perps Websocket Client', () => {
|
||||
describe.skip('Private Linear Perps Websocket Client', () => {
|
||||
const API_KEY = process.env.API_KEY_COM;
|
||||
const API_SECRET = process.env.API_SECRET_COM;
|
||||
|
||||
@@ -27,7 +27,7 @@ describe('Private Linear Perps Websocket Client', () => {
|
||||
key: 'bad',
|
||||
secret: 'bad',
|
||||
},
|
||||
getSilentLogger('expect401')
|
||||
getSilentLogger('expect401'),
|
||||
);
|
||||
|
||||
const wsOpenPromise = waitForSocketEvent(badClient, 'open', 2500);
|
||||
@@ -59,7 +59,7 @@ describe('Private Linear Perps Websocket Client', () => {
|
||||
beforeAll(() => {
|
||||
wsClient = new WebsocketClient(
|
||||
wsClientOptions,
|
||||
getSilentLogger('expectSuccess')
|
||||
getSilentLogger('expectSuccess'),
|
||||
);
|
||||
wsClient.connectPrivate();
|
||||
});
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
waitForSocketEvent,
|
||||
} from '../ws.util';
|
||||
|
||||
describe('Public Linear Perps Websocket Client', () => {
|
||||
describe.skip('Public Linear Perps Websocket Client', () => {
|
||||
let wsClient: WebsocketClient;
|
||||
|
||||
const wsClientOptions: WSClientConfigurableOptions = {
|
||||
|
||||
Reference in New Issue
Block a user