Skip to content

Demo trading ​

Available environments ​

Bitget supports production and demo trading. The SDK uses demoTrading, not a testnet flag. Demo configuration is available for both Unified Trading Account (UTA) and Classic clients; endpoint availability still depends on the account and product.

Demo trading ​

Complete Bitget's account requirements, switch to Demo mode and create a demo API key, secret and passphrase. The official setup currently requires KYC. Do not reuse production credentials.

Set demoTrading: true on each REST and WebSocket client. This UTA example only constructs clients and makes no requests:

ts
import { RestClientV3, WebsocketClientV3 } from 'bitget-api';

function requiredEnv(name: string): string {
  const value = process.env[name];
  if (!value) throw new Error(`Set ${name} in your server environment.`);
  return value;
}

// Configure clients only. No requests, subscriptions or orders are sent.
const options = {
  apiKey: requiredEnv('BITGET_DEMO_API_KEY'),
  apiSecret: requiredEnv('BITGET_DEMO_API_SECRET'),
  apiPass: requiredEnv('BITGET_DEMO_API_PASSPHRASE'),
  demoTrading: true,
};

export const rest = new RestClientV3(options);
export const ws = new WebsocketClientV3(options);

For Classic APIs, use RestClientV2 and WebsocketClient with the same explicit demo option and the appropriate demo credentials. See Choose UTA or Classic before selecting a client.

Coverage and limitations ​

The SDK supplies the REST paptrading header and selects demo WebSocket routes. Do not add simulation headers or hardcode URLs alongside the option. Omitting demoTrading selects production, and configuring REST does not change a separate WebSocket client.

Check the current instructions for your API family:

Demo trading does not imply that every account, transfer or trading endpoint available in production is supported in simulation.

What these environments can prove ​

Use test environments to check request formats, credentials, order handling and reconnect recovery within the features they support. Testnet liquidity, prices, fills, fees and availability can differ substantially from production. Accounts, balances and order history may also be reset.

Testnet is not a reliable place to evaluate strategy performance. Demo trading may use production market data, but simulated fills do not establish live profitability, slippage, execution quality or capacity. Treat both as integration tests, not evidence that a strategy will succeed with real funds. See the CEX testnet overview for the distinction between testnet and demo trading.

Before switching environments ​

  • Keep credentials and configuration separate for each account, product and environment. Never fall back to live credentials when a test key is missing.
  • Configure every REST, subscription and WebSocket API client separately. Changing one client does not reconfigure another.
  • Check the selected environment's supported endpoints and instruments before sending a request. Similar method signatures do not imply identical availability.
  • Keep authenticated requests on your server. Confirm the destination and account before enabling any write operation.

Production remains the default. Selecting a test environment is an explicit choice for each client; it is not a global SDK setting.

Configuration · Authentication · Production usage

Built by Siebly. Open source SDKs for exchange APIs.