Skip to content

Testing environments ​

Available environments ​

The SDK uses KuCoin's live services. It does not expose a testnet, useTestnet or demoTrading constructor flag. The apiRegion option selects global, EU or AU routing, not simulated trading.

Validate a Spot order ​

SpotClient.submitHFOrderTest() calls the Spot test-order endpoint. It uses live API credentials but does not submit the order to the matching engine. Test orders cannot be queried later and do not produce a simulated order lifecycle.

Configure the credential helper and the price, size and client identifier described in Order management. Save this as test-order.ts beside the helper, then follow the compile instructions:

ts
import { client, requiredEnv } from './authenticated-client.js';

async function main() {
  await client.submitHFOrderTest({
    symbol: 'BTC-USDT',
    clientOid: requiredEnv('KUCOIN_CLIENT_ORDER_ID'),
    side: 'buy',
    type: 'limit',
    price: requiredEnv('KUCOIN_LIMIT_PRICE'),
    size: requiredEnv('KUCOIN_ORDER_SIZE'),
    timeInForce: 'GTC',
    postOnly: true,
  });
  console.log('Test request accepted. No matching-engine order was created.');
}

main().catch(() => {
  console.error(
    'Order validation failed. Check parameters and authentication.',
  );
  process.exitCode = 1;
});
sh
node --env-file=.env dist/test-order.js

This tests request acceptance and signing. It does not prove that a real order will fill, that a live account has enough funds for the intended trade, or that cancellation, private events and recovery work. See KuCoin's Spot test-order reference for its validation scope.

Testing without orders ​

Use recorded or synthetic responses to exercise reconnects, timeouts, duplicate events and uncertain order outcomes without submitting trades. Keep these fixtures separate from production clients and credentials.

Validate public connectivity, permissions and order-management behavior separately. If you choose to test real orders, use explicit limits and monitor their status.

Coverage and limitations ​

KuCoin's sandbox notice describes its independent sandbox as temporarily offline with maintenance stopped. Do not rely on old sandbox URLs. The test-order endpoint above validates a request, not a simulated trading environment.

The general guidance below applies when an exchange provides a supported testnet or demo environment; it does not imply this KuCoin SDK offers one.

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.