diff --git a/src/util/BaseRestClient.ts b/src/util/BaseRestClient.ts index 9f407aa..e02be75 100644 --- a/src/util/BaseRestClient.ts +++ b/src/util/BaseRestClient.ts @@ -92,7 +92,6 @@ export default abstract class BaseRestClient { constructor( restOptions: RestClientOptions = {}, networkOptions: AxiosRequestConfig = {}, - useDemoTrading: boolean = false, ) { this.options = { recvWindow: 5000, @@ -111,7 +110,7 @@ export default abstract class BaseRestClient { 'X-CHANNEL-API-CODE': 'hbnni', 'Content-Type': 'application/json', locale: 'en-US', - ...(useDemoTrading ? { paptrading: '1' } : {}), + ...(restOptions.demoTrading ? { paptrading: '1' } : {}), }, }; diff --git a/src/util/requestUtils.ts b/src/util/requestUtils.ts index 90ea006..e4ed446 100644 --- a/src/util/requestUtils.ts +++ b/src/util/requestUtils.ts @@ -11,6 +11,13 @@ export interface RestClientOptions { /** Set to `true` to connect to testnet. Uses the live environment by default. */ // testnet?: boolean; + /** + * Set to `true` to use Bitget's demo trading: https://www.bitget.com/api-doc/common/demotrading/restapi. + * + * Disabled by default. + */ + demoTrading?: boolean; + /** Override the max size of the request window (in ms) */ recvWindow?: number;