Blog
Testing environmentsNode.js

Testnet, Demo, and Local Simulation in Node.js

Choose testnet, demo, validation endpoints, or local replay according to the integration behaviour being tested, and verify each SDK environment explicitly.

Siebly.io3 min readMarkdown

Match the Test to the Question

Make a fake exchange client time out to see what the application records. Use the exchange's test environment to check credentials and requests against its supported endpoints. Market behaviour there can differ from production. For simulated fills, use a local paper executor.

Select the environment for the failure being investigated. Then record the key origin, client option, and resolved route together.

EnvironmentUseful evidenceImportant limit
Recorded fixtures or replayParser, state transitions, deterministic failure cases.Does not test exchange authentication or routing.
Local paper executorApplication behaviour under explicit fill assumptions.Its fills are outputs of a model.
Validation endpointThe checks documented for that specific endpoint.May not exercise matching or the full order lifecycle.
Exchange testnet or demoReal protocol calls on the supported non-production surface.Coverage, liquidity, limits, and timing can differ.

The paper executor example keeps its assumptions explicit. The connector tests inject failure cases without depending on a remote outage.

Separate Bybit Demo and Testnet

In bybit-api, testnet: true selects testnet. demoTrading: true selects the separate demo service. Credentials must originate from the selected environment; those flags are not synonyms.

Bybit's demo documentation lists its supported APIs and distinguishes private demo streams from public mainnet data. It also documents that WebSocket Trade is unsupported there. A successful demo REST request therefore does not prove that a WebSocket order example can run in demo.

The Bybit tutorial provides the current constructor options. Other exchange clients use their own options and environment capabilities. Do not infer a universal sandbox flag from one package.

Prove the Route Before a Command

Start with a public read on the intended route. Then make a private read using a key created for that environment and inspect the exchange's business response. Log the selected environment and endpoint identity without logging the secret.

The testnet and demo key examples show how to configure the Bybit and OKX clients with separate credentials.

If the required validation or non-production operation is unavailable, report that limitation. Falling back to the production host changes the test's meaning and must never be an invisible convenience.

Exercise Recovery Separately

A happy-path testnet order does not establish what the application does when a reply is lost, a private event repeats, or the process restarts with unresolved work. Use fixtures and controlled interruptions for those cases.

Record the SDK version, environment, requests, responses, and state assertions with the result. A later package upgrade can change the client path even when the strategy code is unchanged. Re-run the affected integration checks rather than treating one earlier connection as permanent evidence.

Related articles

Continue from here

Related Siebly resources

All articles

Subscribe on Substack

Complete the Substack form below to join our newsletter. Substack handles all subscriber data directly.