cleaning in spot client

This commit is contained in:
tiagosiebler
2022-09-17 11:36:57 +01:00
parent c02a2f0c75
commit 679e54eb42
4 changed files with 13 additions and 8 deletions

View File

@@ -11,6 +11,7 @@ import {
SpotLeveragedTokenPRHistoryRequest,
SpotCrossMarginBorrowingInfoRequest,
SpotCrossMarginRepaymentHistoryRequest,
SpotCancelOrderBatchRequest,
} from './types';
import { REST_CLIENT_TYPE_ENUM } from './util';
import BaseRestClient from './util/BaseRestClient';
@@ -119,11 +120,9 @@ export class SpotClientV3 extends BaseRestClient {
}
/** Batch cancel orders */
cancelOrderBatch(params: {
symbol: string;
side?: OrderSide;
orderTypes: OrderTypeSpot[];
}): Promise<APIResponseV3<any>> {
cancelOrderBatch(
params: SpotCancelOrderBatchRequest
): Promise<APIResponseV3<any>> {
const orderTypes = params.orderTypes
? params.orderTypes.join(',')
: undefined;

View File

@@ -25,6 +25,12 @@ export interface NewSpotOrderV3 {
triggerPrice?: string;
}
export interface SpotCancelOrderBatchRequest {
symbol: string;
side?: OrderSide;
orderTypes: OrderTypeSpot[];
}
export interface SpotOrderQueryById {
orderId?: string;
orderLinkId?: string;

View File

@@ -6,7 +6,7 @@ import {
serializeParams,
RestClientType,
REST_CLIENT_TYPE_ENUM,
agentSource,
APIID,
getRestBaseUrl,
} from './requestUtils';
@@ -98,7 +98,7 @@ export default abstract class BaseRestClient {
// custom request options based on axios specs - see: https://github.com/axios/axios#request-config
...requestOptions,
headers: {
'x-referer': agentSource,
'x-referer': APIID,
},
};

View File

@@ -85,7 +85,7 @@ export function isWsPong(msg: any): boolean {
);
}
export const agentSource = 'bybitapinode';
export const APIID = 'bybitapinode';
/**
* Used to switch how authentication/requests work under the hood (primarily for SPOT since it's different there)