Skip to content

Commit 8e35d6e

Browse files
authored
Merge pull request #56 from fireflies1988/feature/add-demo-trading-option
feat(v2.3.1): add demoTrading flag to REST Client for demo mode support
2 parents 59824c2 + 2c074b2 commit 8e35d6e

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bitget-api",
3-
"version": "2.3.0",
3+
"version": "2.3.1",
44
"description": "Node.js & JavaScript SDK for Bitget REST APIs & WebSockets, with TypeScript & end-to-end tests.",
55
"main": "lib/index.js",
66
"types": "lib/index.d.ts",

src/rest-client-v2.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1262,7 +1262,7 @@ export class RestClientV2 extends BaseRestClient {
12621262
}
12631263

12641264
getFuturesContractConfig(params: {
1265-
symbol: string;
1265+
symbol?: string;
12661266
productType: FuturesProductTypeV2;
12671267
}): Promise<APIResponse<FuturesContractConfigV2[]>> {
12681268
return this.get('/api/v2/mix/market/contracts', params);

src/util/BaseRestClient.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ export default abstract class BaseRestClient {
110110
'X-CHANNEL-API-CODE': 'hbnni',
111111
'Content-Type': 'application/json',
112112
locale: 'en-US',
113+
...(restOptions.demoTrading ? { paptrading: '1' } : {}),
113114
},
114115
};
115116

src/util/requestUtils.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ export interface RestClientOptions {
1111
/** Set to `true` to connect to testnet. Uses the live environment by default. */
1212
// testnet?: boolean;
1313

14+
/**
15+
* Set to `true` to use Bitget's demo trading: https://www.bitget.com/api-doc/common/demotrading/restapi.
16+
*
17+
* Disabled by default.
18+
*/
19+
demoTrading?: boolean;
20+
1421
/** Override the max size of the request window (in ms) */
1522
recvWindow?: number;
1623

0 commit comments

Comments
 (0)