wiz-trader 0.20.0__tar.gz → 0.22.0__tar.gz

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.
@@ -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
@@ -1601,6 +1601,58 @@ def visualize_option_chain(identifier, expiry):
1601
1601
  visualize_option_chain("NSE:NIFTY 50:26000", "2025-05-30")
1602
1602
  ```
1603
1603
 
1604
+ #### Get Futures List
1605
+
1606
+ Fetch available futures contracts for an instrument:
1607
+
1608
+ ```python
1609
+ # Get futures for an equity stock
1610
+ sbin_futures = client.get_futures_list("NSE:SBIN:3045")
1611
+ print(f"Found {len(sbin_futures)} futures contracts for SBIN")
1612
+ for future in sbin_futures:
1613
+ print(f"{future['tradingSymbol']} - Expiry: {future['expiry']} ({future['contract']})")
1614
+
1615
+ # Get futures for an index
1616
+ nifty_futures = client.get_futures_list("NSE:NIFTY 50:26000")
1617
+ print(f"Found {len(nifty_futures)} futures contracts for NIFTY 50")
1618
+ for future in nifty_futures:
1619
+ print(f"{future['tradingSymbol']} - Expiry: {future['expiry']} ({future['contract']})")
1620
+ ```
1621
+
1622
+ #### Response Structure for Futures List
1623
+
1624
+ The `get_futures_list` method returns a list of dictionaries, each representing a futures contract:
1625
+
1626
+ ```python
1627
+ [
1628
+ {
1629
+ # Exchange where the future is traded
1630
+ "exchange": "NSE",
1631
+
1632
+ # Trading symbol of the futures contract
1633
+ "tradingSymbol": "SBIN25MAYFUT",
1634
+
1635
+ # Exchange token for the futures contract
1636
+ "exchangeToken": 57515,
1637
+
1638
+ # Complete identifier for the futures contract
1639
+ "identifier": "NSE:SBIN25MAYFUT:57515",
1640
+
1641
+ # Expiry date in YYYY-MM-DD format
1642
+ "expiry": "2025-05-29",
1643
+
1644
+ # Contract type (near_month, mid_month, far_month)
1645
+ "contract": "near_month"
1646
+ },
1647
+ # Additional futures contracts...
1648
+ ]
1649
+ ```
1650
+
1651
+ The `contract` field indicates the type of futures contract:
1652
+ - **`near_month`**: Current month's futures contract
1653
+ - **`mid_month`**: Next month's futures contract
1654
+ - **`far_month`**: Month after next futures contract
1655
+
1604
1656
  ### Wizzer Client Examples
1605
1657
 
1606
1658
  #### Market Data and Analysis Example
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "wiz_trader"
7
- version = "0.20.0"
7
+ version = "0.22.0"
8
8
  description = "A Python SDK for connecting to the Wizzer."
9
9
  readme = "README.md"
10
10
  authors = [
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='wiz_trader',
5
- version='0.20.0',
5
+ version='0.22.0',
6
6
  description='A Python SDK for connecting to the Wizzer.',
7
7
  long_description=open('README.md').read() if open('README.md') else "",
8
8
  long_description_content_type='text/markdown',
@@ -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
File without changes
File without changes