Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Websockets (Verbose Control)

The verbose parameter manages SDK-level logging for WebSocket feed operations (LTP, Quote, Depth and order updates). This helps developers toggle between silent mode, basic logs, or full debug-level market data streaming.


Verbose Levels

Level
Value
Description

Silent

False or 0

No SDK output, not even errors (default)

Basic

True or 1

Connection, authentication, subscription and error logs

Debug

2

All updates: LTP, Quote, Depth and order updates

verbose only controls what the SDK prints. Your own on_data_received callbacks always run, and every method still returns its result, so a silent client is not a blind one. Set verbose=1 while you are wiring up a feed: at level 0 a failed authentication or a rejected subscription is silent.


Usage

from openalgo import api

# Silent mode (default) - no SDK output
client = api(api_key="...", host="...", ws_url="...", verbose=False)

# Basic logging - connection/subscription info
client = api(api_key="...", host="...", ws_url="...", verbose=True)

# Full debug - all data updates
client = api(api_key="...", host="...", ws_url="...", verbose=2)

ws_url is optional. When it is omitted the SDK derives the WebSocket URL from host and ws_port (default 8765), so a local install can simply use api(api_key="...", verbose=2).


Auto Reconnect

auto_reconnect defaults to True. After a dropped connection the SDK reconnects with exponential backoff (1, 2, 5, 10, 30, 60 seconds, capped at 60), re-authenticates, and replays every active LTP, Quote and Depth subscription plus the account-level order-update subscription. Your existing callbacks are preserved, so they resume firing without any extra code.

With verbose=1 or higher the reconnect attempts and the replayed subscriptions are logged under the [WS] and [SUB] tags.


Test Example


Expected Output

verbose=False (Silent)


verbose=True (Basic)


verbose=2 (Full Debug)


Log Categories

Tag
Meaning

[WS]

WebSocket connection events

[AUTH]

Authentication requests & responses

[SUB]

Subscription operations

[UNSUB]

Unsubscription logs

[LTP]

LTP updates (verbose=2)

[QUOTE]

Quote updates (verbose=2)

[DEPTH]

Market depth updates (verbose=2)

[ORDER]

Order status updates via subscribe_orders() (verbose=2)

[ERROR]

Error messages (verbose=1 and above)

Last updated