wiz-trader 0.20.0__py3-none-any.whl → 0.22.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
wiz_trader/__init__.py CHANGED
@@ -3,6 +3,6 @@
3
3
  from .quotes import QuotesClient
4
4
  from .apis import WizzerClient
5
5
 
6
- __version__ = "0.20.0"
6
+ __version__ = "0.22.0"
7
7
 
8
8
  __all__ = ["QuotesClient", "WizzerClient"]
@@ -193,6 +193,38 @@ class QuotesClient:
193
193
  asyncio.set_event_loop(loop)
194
194
  loop.create_task(self._subscribe_async(instruments))
195
195
 
196
+ async def _unsubscribe_async(self, instruments: List[str]) -> None:
197
+ """
198
+ Internal async unsubscription. Use `unsubscribe()` wrapper to schedule this.
199
+ """
200
+ # Only send unsubs if the socket is open
201
+ if self.ws and self.ws.state == State.OPEN:
202
+ to_remove = set(instruments) & self.subscribed_instruments
203
+ if to_remove:
204
+ for batch in self._chunk_list(list(to_remove), self.batch_size):
205
+ logger.info("Unsubscribing from %d instruments", len(batch))
206
+ await self.ws.send(json.dumps({
207
+ "action": self.ACTION_UNSUBSCRIBE,
208
+ "instruments": batch
209
+ }))
210
+ await asyncio.sleep(0.1)
211
+ # remove them from our local set
212
+ self.subscribed_instruments -= to_remove
213
+ else:
214
+ # if we're not connected yet, just remove from the queue
215
+ self.subscribed_instruments -= set(instruments)
216
+
217
+ def unsubscribe(self, instruments: List[str]) -> None:
218
+ """
219
+ Schedule an async unsubscribe so users can call this without 'await'.
220
+ """
221
+ try:
222
+ loop = asyncio.get_event_loop()
223
+ except RuntimeError:
224
+ loop = asyncio.new_event_loop()
225
+ asyncio.set_event_loop(loop)
226
+ loop.create_task(self._unsubscribe_async(instruments))
227
+
196
228
  # You could add a similar unsubscribe wrapper if needed
197
229
 
198
230
  async def close(self) -> None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wiz_trader
3
- Version: 0.20.0
3
+ Version: 0.22.0
4
4
  Summary: A Python SDK for connecting to the Wizzer.
5
5
  Home-page: https://bitbucket.org/wizzer-tech/quotes_sdk.git
6
6
  Author: Pawan Wagh
@@ -1628,6 +1628,58 @@ def visualize_option_chain(identifier, expiry):
1628
1628
  visualize_option_chain("NSE:NIFTY 50:26000", "2025-05-30")
1629
1629
  ```
1630
1630
 
1631
+ #### Get Futures List
1632
+
1633
+ Fetch available futures contracts for an instrument:
1634
+
1635
+ ```python
1636
+ # Get futures for an equity stock
1637
+ sbin_futures = client.get_futures_list("NSE:SBIN:3045")
1638
+ print(f"Found {len(sbin_futures)} futures contracts for SBIN")
1639
+ for future in sbin_futures:
1640
+ print(f"{future['tradingSymbol']} - Expiry: {future['expiry']} ({future['contract']})")
1641
+
1642
+ # Get futures for an index
1643
+ nifty_futures = client.get_futures_list("NSE:NIFTY 50:26000")
1644
+ print(f"Found {len(nifty_futures)} futures contracts for NIFTY 50")
1645
+ for future in nifty_futures:
1646
+ print(f"{future['tradingSymbol']} - Expiry: {future['expiry']} ({future['contract']})")
1647
+ ```
1648
+
1649
+ #### Response Structure for Futures List
1650
+
1651
+ The `get_futures_list` method returns a list of dictionaries, each representing a futures contract:
1652
+
1653
+ ```python
1654
+ [
1655
+ {
1656
+ # Exchange where the future is traded
1657
+ "exchange": "NSE",
1658
+
1659
+ # Trading symbol of the futures contract
1660
+ "tradingSymbol": "SBIN25MAYFUT",
1661
+
1662
+ # Exchange token for the futures contract
1663
+ "exchangeToken": 57515,
1664
+
1665
+ # Complete identifier for the futures contract
1666
+ "identifier": "NSE:SBIN25MAYFUT:57515",
1667
+
1668
+ # Expiry date in YYYY-MM-DD format
1669
+ "expiry": "2025-05-29",
1670
+
1671
+ # Contract type (near_month, mid_month, far_month)
1672
+ "contract": "near_month"
1673
+ },
1674
+ # Additional futures contracts...
1675
+ ]
1676
+ ```
1677
+
1678
+ The `contract` field indicates the type of futures contract:
1679
+ - **`near_month`**: Current month's futures contract
1680
+ - **`mid_month`**: Next month's futures contract
1681
+ - **`far_month`**: Month after next futures contract
1682
+
1631
1683
  ### Wizzer Client Examples
1632
1684
 
1633
1685
  #### Market Data and Analysis Example
@@ -0,0 +1,9 @@
1
+ wiz_trader/__init__.py,sha256=P9duxOjg6Hdg46ZYq-qkqtq40XGZap7TDsGyxVG3ZEs,182
2
+ wiz_trader/apis/__init__.py,sha256=ItWKMOl4omiW0g2f-M7WRW3v-dss_ULd9vYnFyIIT9o,132
3
+ wiz_trader/apis/client.py,sha256=GY1aAaV4ia1tnFnB2qaNqnv-qeUvkVlvw9xOKN54qIs,59786
4
+ wiz_trader/quotes/__init__.py,sha256=RF9g9CNP6bVWlmCh_ad8krm3-EWOIuVfLp0-H9fAeEM,108
5
+ wiz_trader/quotes/client.py,sha256=NBWH1nxI-PKPjTxrU4ibl0xxKbchHm1pWA4JkMLvWBA,11125
6
+ wiz_trader-0.22.0.dist-info/METADATA,sha256=ZtYSZAMCOYs4ojPbZN5Shp0J2kthsdy7vUlfKFOa8og,87046
7
+ wiz_trader-0.22.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
8
+ wiz_trader-0.22.0.dist-info/top_level.txt,sha256=lnYS_g8LlA6ryKYnvY8xIQ6K2K-xzOsd-99AWgnW6VY,11
9
+ wiz_trader-0.22.0.dist-info/RECORD,,
@@ -1,9 +0,0 @@
1
- wiz_trader/__init__.py,sha256=YC94wlmPJK1p-MnOePHPiRYe2f9VeHkl0_eBNB77vD8,182
2
- wiz_trader/apis/__init__.py,sha256=ItWKMOl4omiW0g2f-M7WRW3v-dss_ULd9vYnFyIIT9o,132
3
- wiz_trader/apis/client.py,sha256=GY1aAaV4ia1tnFnB2qaNqnv-qeUvkVlvw9xOKN54qIs,59786
4
- wiz_trader/quotes/__init__.py,sha256=RF9g9CNP6bVWlmCh_ad8krm3-EWOIuVfLp0-H9fAeEM,108
5
- wiz_trader/quotes/client.py,sha256=LJeMcQPjJIRxrTIGalWsLYh_XfinDXBP5-4cNS7qCxc,9709
6
- wiz_trader-0.20.0.dist-info/METADATA,sha256=TmMAi3VtyYTwZSxbcNiQ7hsdDJgvNhAKrIhf7Vycp3A,85410
7
- wiz_trader-0.20.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
8
- wiz_trader-0.20.0.dist-info/top_level.txt,sha256=lnYS_g8LlA6ryKYnvY8xIQ6K2K-xzOsd-99AWgnW6VY,11
9
- wiz_trader-0.20.0.dist-info/RECORD,,