You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `MarketDataStreamerV3` interface is designed for effortless connection to the market WebSocket, enabling users to receive instantaneous updates on various instruments. The following example demonstrates how to quickly set up and start receiving market updates for selected instrument keys:
In this example, you first authenticate using an access token, then instantiate MarketDataStreamerV3 with specific instrument keys and a subscription mode. Upon connecting, the streamer listens for market updates, which are logged to the console as they arrive.
152
+
153
+
Feel free to adjust the access token placeholder and any other specifics to better fit your actual implementation or usage scenario.
154
+
155
+
### Exploring the MarketDataStreamerV3 Functionality
156
+
157
+
#### Modes
158
+
-**ltpc**: ltpc provides information solely about the most recent trade, encompassing details such as the last trade price, time of the last trade, quantity traded, and the closing price from the previous day.
159
+
-**full**: The full option offers comprehensive information, including the latest trade prices, D5 depth, 1-minute, 30-minute, and daily candlestick data, along with some additional details.
160
+
-**full_d30**: full_d30 includes Full mode data plus 30 market level quotes.
161
+
-**option_greeks**: Contains only option greeks.
162
+
163
+
#### Functions
164
+
1.**constructor MarketDataStreamerV3(apiClient, instrumentKeys, mode)**: Initializes the streamer with optional instrument keys and mode (`full`, `ltpc`, `option_greeks` or `full_d30`).
165
+
2.**connect()**: Establishes the WebSocket connection.
166
+
3.**subscribe(instrumentKeys, mode)**: Subscribes to updates for given instrument keys in the specified mode. Both parameters are mandatory.
167
+
4.**unsubscribe(instrumentKeys)**: Stops updates for the specified instrument keys.
168
+
5.**changeMode(instrumentKeys, mode)**: Switches the mode for already subscribed instrument keys.
169
+
6.**disconnect()**: Ends the active WebSocket connection.
170
+
7.**auto_reconnect(enable, interval, retryCount)**: Customizes auto-reconnect functionality. Parameters include a flag to enable/disable it, the interval(in seconds) between attempts, and the maximum number of retries.
171
+
172
+
#### Events
173
+
-**open**: Emitted upon successful connection establishment.
174
+
-**close**: Indicates the WebSocket connection has been closed.
175
+
-**message**: Delivers market updates.
176
+
-**error**: Signals an error has occurred.
177
+
-**reconnecting**: Announced when a reconnect attempt is initiated.
178
+
-**autoReconnectStopped**: Informs when auto-reconnect efforts have ceased after exhausting the retry count.
179
+
180
+
The following documentation includes examples to illustrate the usage of these functions and events, providing a practical understanding of how to interact with the MarketDataStreamerV3 effectively.
181
+
182
+
<br/>
183
+
184
+
1. Subscribing to Market Data on Connection Open with MarketDataStreamerV3
The `MarketDataStreamer` interface is designed for effortless connection to the market WebSocket, enabling users to receive instantaneous updates on various instruments. The following example demonstrates how to quickly set up and start receiving market updates for selected instrument keys:
123
404
124
405
```python
@@ -388,6 +669,8 @@ if __name__ == "__main__":
388
669
```
389
670
390
671
<br/>
672
+
</p>
673
+
</details>
391
674
392
675
### PortfolioDataStreamer
393
676
@@ -451,8 +734,6 @@ if __name__ == "__main__":
451
734
452
735
<br/>
453
736
454
-
This example demonstrates initializing the PortfolioDataStreamer, connecting it to the WebSocket, and setting up an event listener to receive and print order updates. Replace <ACCESS_TOKEN> with your valid access token to authenticate the session.
455
-
456
737
### Exploring the PortfolioDataStreamer Functionality
457
738
458
739
#### Functions
@@ -569,3 +850,4 @@ This example demonstrates initializing the PortfolioDataStreamer, connecting it
0 commit comments