feat(): mark optional params
This commit is contained in:
@@ -382,10 +382,6 @@ export class RestClientV2 extends BaseRestClient {
|
||||
return this.get(`/api/v2/mix/market/vip-fee-rate`);
|
||||
}
|
||||
|
||||
getFuturesMergeDepth(params: object): Promise<APIResponse<any>> {
|
||||
return this.get(`/api/v2/mix/market/merge-depth`, params);
|
||||
}
|
||||
|
||||
getFuturesTicker(params: object): Promise<APIResponse<any>> {
|
||||
return this.get(`/api/v2/mix/market/ticker`, params);
|
||||
}
|
||||
@@ -394,12 +390,8 @@ export class RestClientV2 extends BaseRestClient {
|
||||
return this.get(`/api/v2/mix/market/tickers`, params);
|
||||
}
|
||||
|
||||
getFuturesRecentTrades(params: object): Promise<APIResponse<any>> {
|
||||
return this.get(`/api/v2/mix/market/fills`, params);
|
||||
}
|
||||
|
||||
getFuturesHistoricTrades(params: object): Promise<APIResponse<any>> {
|
||||
return this.get(`/api/v2/mix/market/fills-history`, params);
|
||||
getFuturesMergeDepth(params: object): Promise<APIResponse<any>> {
|
||||
return this.get(`/api/v2/mix/market/merge-depth`, params);
|
||||
}
|
||||
|
||||
getFuturesCandlestickData(params: object): Promise<APIResponse<any>> {
|
||||
@@ -422,6 +414,14 @@ export class RestClientV2 extends BaseRestClient {
|
||||
return this.get(`/api/v2/mix/market/history-mark-candles`, params);
|
||||
}
|
||||
|
||||
getFuturesRecentTrades(params: object): Promise<APIResponse<any>> {
|
||||
return this.get(`/api/v2/mix/market/fills`, params);
|
||||
}
|
||||
|
||||
getFuturesHistoricTrades(params: object): Promise<APIResponse<any>> {
|
||||
return this.get(`/api/v2/mix/market/fills-history`, params);
|
||||
}
|
||||
|
||||
getFuturesOpenInterest(params: object): Promise<APIResponse<any>> {
|
||||
return this.get(`/api/v2/mix/market/open-interest`, params);
|
||||
}
|
||||
@@ -472,7 +472,7 @@ export class RestClientV2 extends BaseRestClient {
|
||||
return this.postPrivate(`/api/v2/mix/account/set-leverage`, params);
|
||||
}
|
||||
|
||||
adjustFuturesPositionMargin(params: object): Promise<APIResponse<any>> {
|
||||
setFuturesPositionMargin(params: object): Promise<APIResponse<any>> {
|
||||
return this.postPrivate(`/api/v2/mix/account/set-margin`, params);
|
||||
}
|
||||
|
||||
@@ -520,7 +520,11 @@ export class RestClientV2 extends BaseRestClient {
|
||||
return this.postPrivate(`/api/v2/mix/order/place-order`, params);
|
||||
}
|
||||
|
||||
futuresSubmitReverseal(params: object): Promise<APIResponse<any>> {
|
||||
futuresCancelOrder(params: object): Promise<APIResponse<any>> {
|
||||
return this.postPrivate(`/api/v2/mix/order/cancel-order`, params);
|
||||
}
|
||||
|
||||
futuresSubmitReversal(params: object): Promise<APIResponse<any>> {
|
||||
return this.postPrivate(`/api/v2/mix/order/click-backhand`, params);
|
||||
}
|
||||
|
||||
@@ -532,10 +536,6 @@ export class RestClientV2 extends BaseRestClient {
|
||||
return this.postPrivate(`/api/v2/mix/order/modify-order`, params);
|
||||
}
|
||||
|
||||
futuresCancelOrder(params: object): Promise<APIResponse<any>> {
|
||||
return this.postPrivate(`/api/v2/mix/order/cancel-order`, params);
|
||||
}
|
||||
|
||||
futuresBatchCancelOrders(params: object): Promise<APIResponse<any>> {
|
||||
return this.postPrivate(`/api/v2/mix/order/batch-cancel-orders`, params);
|
||||
}
|
||||
@@ -544,11 +544,11 @@ export class RestClientV2 extends BaseRestClient {
|
||||
return this.postPrivate(`/api/v2/mix/order/close-positions`, params);
|
||||
}
|
||||
|
||||
getFuturesOrderDetail(params: object): Promise<APIResponse<any>> {
|
||||
getFuturesOrder(params: object): Promise<APIResponse<any>> {
|
||||
return this.getPrivate(`/api/v2/mix/order/detail`, params);
|
||||
}
|
||||
|
||||
getFuturesOrderFillDetails(params: object): Promise<APIResponse<any>> {
|
||||
getFuturesFills(params: object): Promise<APIResponse<any>> {
|
||||
return this.getPrivate(`/api/v2/mix/order/fills`, params);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,38 +19,25 @@ type NetworkMap<
|
||||
|
||||
export const WS_BASE_URL_MAP: Record<
|
||||
WsKey,
|
||||
Record<'all' | 'public' | 'private', NetworkMap<'livenet'>>
|
||||
Record<'all', NetworkMap<'livenet'>>
|
||||
> = {
|
||||
mixv1: {
|
||||
all: {
|
||||
livenet: 'wss://ws.bitget.com/mix/v1/stream',
|
||||
},
|
||||
public: {
|
||||
livenet: 'N/A',
|
||||
},
|
||||
private: {
|
||||
livenet: 'N/A',
|
||||
},
|
||||
},
|
||||
spotv1: {
|
||||
all: {
|
||||
livenet: 'wss://ws.bitget.com/spot/v1/stream',
|
||||
},
|
||||
public: {
|
||||
livenet: 'N/A',
|
||||
},
|
||||
private: {
|
||||
livenet: 'N/A',
|
||||
},
|
||||
},
|
||||
v2: {
|
||||
v2Public: {
|
||||
all: {
|
||||
livenet: 'N/A',
|
||||
},
|
||||
public: {
|
||||
livenet: 'wss://ws.bitget.com/v2/ws/public',
|
||||
},
|
||||
private: {
|
||||
},
|
||||
v2Private: {
|
||||
all: {
|
||||
livenet: 'wss://ws.bitget.com/v2/ws/private',
|
||||
},
|
||||
},
|
||||
@@ -60,13 +47,15 @@ export const WS_BASE_URL_MAP: Record<
|
||||
export const WS_KEY_MAP = {
|
||||
spotv1: 'spotv1',
|
||||
mixv1: 'mixv1',
|
||||
v2: 'v2',
|
||||
v2Public: 'v2Public',
|
||||
v2Private: 'v2Private',
|
||||
} as const;
|
||||
|
||||
/** Any WS keys in this list will trigger auth on connect, if credentials are available */
|
||||
export const WS_AUTH_ON_CONNECT_KEYS: WsKey[] = [
|
||||
WS_KEY_MAP.spotv1,
|
||||
WS_KEY_MAP.mixv1,
|
||||
WS_KEY_MAP.v2Private,
|
||||
];
|
||||
|
||||
/** Any WS keys in this list will ALWAYS skip the authentication process, even if credentials are available */
|
||||
@@ -113,7 +102,8 @@ export function getMaxTopicsPerSubscribeEvent(wsKey: WsKey): number | null {
|
||||
switch (wsKey) {
|
||||
case 'mixv1':
|
||||
case 'spotv1':
|
||||
case 'v2': {
|
||||
case 'v2Public':
|
||||
case 'v2Private': {
|
||||
// Technically there doesn't seem to be a documented cap, but there is a size limit per request. Doesn't hurt to batch requests.
|
||||
return 15;
|
||||
}
|
||||
|
||||
@@ -646,6 +646,12 @@ export class WebsocketClient extends EventEmitter {
|
||||
case WS_KEY_MAP.mixv1: {
|
||||
return WS_BASE_URL_MAP.mixv1.all[networkKey];
|
||||
}
|
||||
case WS_KEY_MAP.v2Private: {
|
||||
return WS_BASE_URL_MAP.v2Private.all[networkKey];
|
||||
}
|
||||
case WS_KEY_MAP.v2Public: {
|
||||
return WS_BASE_URL_MAP.v2Public.all[networkKey];
|
||||
}
|
||||
default: {
|
||||
this.logger.error('getWsUrl(): Unhandled wsKey: ', {
|
||||
...LOGGER_CATEGORY,
|
||||
|
||||
Reference in New Issue
Block a user