feat: add useDemoTrading flag to BaseRestClient for demo mode support
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "bitget-api",
|
"name": "bitget-api",
|
||||||
"version": "2.3.0",
|
"version": "2.3.1",
|
||||||
"description": "Node.js & JavaScript SDK for Bitget REST APIs & WebSockets, with TypeScript & end-to-end tests.",
|
"description": "Node.js & JavaScript SDK for Bitget REST APIs & WebSockets, with TypeScript & end-to-end tests.",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"types": "lib/index.d.ts",
|
"types": "lib/index.d.ts",
|
||||||
|
|||||||
@@ -1262,7 +1262,7 @@ export class RestClientV2 extends BaseRestClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getFuturesContractConfig(params: {
|
getFuturesContractConfig(params: {
|
||||||
symbol: string;
|
symbol?: string;
|
||||||
productType: FuturesProductTypeV2;
|
productType: FuturesProductTypeV2;
|
||||||
}): Promise<APIResponse<FuturesContractConfigV2[]>> {
|
}): Promise<APIResponse<FuturesContractConfigV2[]>> {
|
||||||
return this.get('/api/v2/mix/market/contracts', params);
|
return this.get('/api/v2/mix/market/contracts', params);
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ export default abstract class BaseRestClient {
|
|||||||
constructor(
|
constructor(
|
||||||
restOptions: RestClientOptions = {},
|
restOptions: RestClientOptions = {},
|
||||||
networkOptions: AxiosRequestConfig = {},
|
networkOptions: AxiosRequestConfig = {},
|
||||||
|
useDemoTrading: boolean = false,
|
||||||
) {
|
) {
|
||||||
this.options = {
|
this.options = {
|
||||||
recvWindow: 5000,
|
recvWindow: 5000,
|
||||||
@@ -110,6 +111,7 @@ export default abstract class BaseRestClient {
|
|||||||
'X-CHANNEL-API-CODE': 'hbnni',
|
'X-CHANNEL-API-CODE': 'hbnni',
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
locale: 'en-US',
|
locale: 'en-US',
|
||||||
|
...(useDemoTrading ? { paptrading: '1' } : {}),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user