Registry / trading / iqoptionapi-node

iqoptionapi-node

JSON →
library1.1.4jsnpmunverified

Unofficial TypeScript SDK for the IQOption WebSocket API, currently at version 1.1.4. This package provides a typed, promise-based interface for real-time trading on IQOption, supporting binary and digital options, candle/tick streaming, and session management. It is actively maintained with monthly releases. Key differentiators include strict TypeScript support, auto-reconnect, a circuit breaker for failed trades, and enforced WSS security. Unlike other community SDKs, it uses a modern ESM-only design and requires Node.js >= 18. Caution: relies on reverse-engineered proprietary protocol that may break without notice.

npm install iqoptionapi-node
INSTALL
IMPORT
SIG · IQOPTIONAPI-NODE
I
iqoptionapi-node
tradingjavascriptv1.1.4
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

IQOptionClient
import { IQOptionClient } from 'iqoptionapi-node'
const IQOptionClient = require('iqoptionapi-node')
ESM-only; require() will not work. Use named export.
Direction
import { Direction } from 'iqoptionapi-node'
import Direction from 'iqoptionapi-node'
Direction is a named enum export, not default.
TimeFrame
import { TimeFrame } from 'iqoptionapi-node'
Named export for time frame constants.

Demonstrates connection, authentication, candle retrieval, binary option trading, and disconnection using environment variables for credentials.

import { IQOptionClient, Direction, TimeFrame } from 'iqoptionapi-node'; const client = new IQOptionClient(); await client.connect(); const profile = await client.login({ email: process.env.IQ_EMAIL ?? '', password: process.env.IQ_PASSWORD ?? '', }); console.log(`Balance: ${profile.balance} ${profile.currency}`); const candles = await client.getCandles('EURUSD', TimeFrame.M1, 10); const { orderId } = await client.buyBinaryOption({ symbol: 'EURUSD', direction: Direction.Call, amount: 1, durationSeconds: 60, }); const result = await client.checkBinaryOptionResult(orderId, 70_000); console.log(result.win, result.profitAmount); await client.disconnect();
Debug
Known issues
breakingThe SDK is ESM-only; require() will throw a Module not found error on import.
fix
Use import syntax and ensure Node.js >= 18 with type:"module" in package.json.
affects: >=1.0.0
gotchaAccount defaults to PRACTICE. REAL account requires explicit opt-in via client.login({ ... accountType: 'REAL' }) to avoid real money risk.
fix
Pass accountType: 'REAL' in the login options for real trading.
affects: >=1.0.0
gotchaTrading circuit breaker: after 5 consecutive failures, the client suspends trading for the session to prevent runaway losses.
fix
Handle errors gracefully and consider resetting the client state if needed.
affects: >=1.0.0
deprecatedcheckBinaryOptionResult and checkDigitalOptionResult use a poll interval in milliseconds (e.g., 70_000). This may be replaced by a promise-based event in future versions.
fix
Monitor release notes for changes; the API is stable but under development.
affects: >=1.0.0 <2.0.0
gotchaThe SDK uses reverse-engineered WebSocket messages. IQOption may change the protocol at any time without notice, breaking the SDK.
fix
Keep the SDK updated; subscribe to GitHub releases for compatibility fixes.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'iqoptionapi-node'
Installed with npm but Node.js is less than 18 or no ESM support.
fix
Upgrade Node.js to >=18 and verify package.json contains 'type': 'module' or use .mjs extension.
TypeError: client.login is not a function
Attempted to call login before client.connect() resolves.
fix
Ensure await client.connect() completes before calling client.login().
Error: Not authenticated
Making API calls (e.g., getCandles) without logging in first.
fix
Call await client.login() before any trading or data methods.
Error: Trading is disabled due to circuit breaker
Failed 5 consecutive trade attempts; client suspended further trades.
fix
Check trade parameters, handle errors, and create a new client instance if needed.
Error: SSID expired or invalid
Using an old or expired SSID in client.restoreSession().
fix
Renew the SSID by calling client.login() with email/password.
Upgrade
Version history
1.1.4latest on npm
Audit
Dependencies
wsrequiredWebSocket client for communicating with IQOption server
Agent activity
44 hits · last 30 days
node
38
Resources
iqoptionapi-node — npm install iqoptionapi-node · libregistry