Real-time forex tick streaming from cTrader Open API with Node.js.
# Install dependencies
npm install
# Configure credentials
Copy-Item .env.example .env
# Edit .env with your cTrader credentialsBasic Stream (Console Output):
node streamLive Terminal Display (Rich UI):
node bin/live-display.js --symbols EURUSD,GBPUSDTest Subscription System:
npm run test-subscriptionCreate .env file:
CTRADER_ACCESS_TOKEN=your_access_token_here
CTRADER_ACCOUNT_ID=your_account_id_here
HOST=demo.ctraderapi.com
PORT=5035
SYMBOLS=USDJPY,EURUSD,AUDUSD
src/
├── display/ # UI components
│ ├── TerminalDisplay.js
│ └── PriceTable.js
└── subscription/ # Symbol subscription logic
└── SymbolSubscription.js
bin/
├── live-display.js # Terminal UI entry point
└── stream.js # Core streaming app
- SymbolSubscription.js: Core subscription management
- CTraderConnection: External dependency for API connection
- EventEmitter: Used for tick data propagation
CTraderConnection → SymbolSubscription → Display/UI
- Connection failures handled with retry logic
- Authentication errors logged to console
- Symbol validation before subscription
- Mock connection available for isolated testing
- Test suite covers subscription lifecycle
- Debug mode available for troubleshooting
- "Cannot read properties of undefined": Check .env configuration
- Connection timeout: Verify network access to cTrader API
- Authentication failed: Validate access token and account ID
node debug.js@reiryoku/ctrader-layer: cTrader API wrapperblessed: Terminal UI frameworkdotenv: Environment configurationevents: Event handling
- Use PowerShell 7+ for best compatibility
- Ensure Node.js 16+ is installed
- Run commands from project root directory