IB@stoqey/ib
@stoqey/ibkr (High-Level Wrapper)Getting Started

Environment Configuration

Full reference of environment variables supported by @stoqey/ibkr.

@stoqey/ibkr supports zero-code configuration via .env environment variables.


Environment Variables Reference

VariableDefaultDescription
IBKR_HOST"127.0.0.1"IP address or hostname of TWS / IB Gateway.
IBKR_PORT7497TCP socket port (7497 for paper TWS, 4002 for paper Gateway).
IBKR_CLIENT_ID0Unique client ID for the socket session.
DEBUG""Set to ibkr:* for verbose logs, or ibkr:info for info logs.
IBKR_RECONNECT_INTERVAL5000Milliseconds to wait before attempting socket auto-reconnection.
IBKR_WATCHDOG_INTERVAL1Watchdog timer interval in minutes to monitor connection health.
IBKR_MD_ONLY / MD_ONLYfalseSet to true to enable Market-Data-Only mode (disables order/account caching overhead).
IBKR_CONTRACTS""Comma-separated allowlist of contracts (e.g. AAPL-STK,NQ-FUT).

Example .env File

# Connection Settings
IBKR_HOST=127.0.0.1
IBKR_PORT=7497
IBKR_CLIENT_ID=1

# Reconnection & Watchdog
IBKR_RECONNECT_INTERVAL=3000
IBKR_WATCHDOG_INTERVAL=2

# Debug Logging (uses debug npm module)
DEBUG=ibkr:*

Debug Logging

@stoqey/ibkr uses the standard debug package for detailed operational logs.

# View all @stoqey/ibkr logs
DEBUG=ibkr:* node index.js

# View only info logs
DEBUG=ibkr:info node index.js

On this page