wiz-trader 0.28.0__py3-none-any.whl → 0.30.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.28.0"
6
+ __version__ = "0.30.0"
7
7
 
8
8
  __all__ = ["QuotesClient", "WizzerClient"]
wiz_trader/apis/client.py CHANGED
@@ -204,7 +204,8 @@ class WizzerClient:
204
204
  "classification.values": "/datahub/classifications/{type}",
205
205
  "indices.filter": "/datahub/indices/filter",
206
206
  "instruments.filter": "/datahub/instruments/filter",
207
- "instruments.filter_with_index": "/datahub/indices/{id}/instruments"
207
+ "instruments.filter_with_index": "/datahub/indices/{id}/instruments",
208
+ "instruments.filter_by_derivatives": "/datahub/instruments/filter-by-derivatives"
208
209
  }
209
210
 
210
211
  def __init__(
@@ -1683,6 +1684,31 @@ class WizzerClient:
1683
1684
 
1684
1685
  return self._make_request("POST", endpoint, json=data)
1685
1686
 
1687
+ def filter_instruments_by_derivatives(
1688
+ self,
1689
+ hasOptions: Optional[bool] = None,
1690
+ hasFutures: Optional[bool] = None
1691
+ ) -> list:
1692
+ """
1693
+ Filter instruments based on the existence of derivatives (options or futures).
1694
+
1695
+ Args:
1696
+ hasOptions (Optional[bool]): If True, returns instruments that have options.
1697
+ hasFutures (Optional[bool]): If True, returns instruments that have futures.
1698
+
1699
+ Returns:
1700
+ list: A list of instruments that match the criteria.
1701
+ """
1702
+ endpoint = self._routes["instruments.filter_by_derivatives"]
1703
+ data = {}
1704
+ if hasOptions is not None:
1705
+ data["hasOptions"] = hasOptions
1706
+ if hasFutures is not None:
1707
+ data["hasFutures"] = hasFutures
1708
+
1709
+ logger.debug(f"Filtering instruments by derivatives with payload: {data}")
1710
+ return self._make_request("POST", endpoint, json=data)
1711
+
1686
1712
  def _make_request(
1687
1713
  self,
1688
1714
  method: str,
@@ -7,6 +7,7 @@ from typing import Callable, List, Optional, Any, Iterator
7
7
 
8
8
  import websockets
9
9
  from websockets.exceptions import ConnectionClosed
10
+ from websockets.protocol import State
10
11
 
11
12
  # Setup module‐level logger with a default handler if none exists.
12
13
  logger = logging.getLogger(__name__)
@@ -210,7 +211,7 @@ class QuotesClient:
210
211
  # -- Async core methods (for internal use) --
211
212
 
212
213
  async def _subscribe_async(self, instruments: List[str], mode: str = MODE_TICKS) -> None:
213
- if self.ws and self.ws.open:
214
+ if self.ws and self.ws.state == State.OPEN:
214
215
  new = set(instruments) - self.subscribed_instruments
215
216
  if new:
216
217
  self.subscribed_instruments |= new
@@ -235,7 +236,7 @@ class QuotesClient:
235
236
  self.subscription_modes[instrument] = mode
236
237
 
237
238
  async def _unsubscribe_async(self, instruments: List[str]) -> None:
238
- if self.ws and self.ws.open:
239
+ if self.ws and self.ws.state == State.OPEN:
239
240
  to_remove = set(instruments) & self.subscribed_instruments
240
241
  if to_remove:
241
242
  self.subscribed_instruments -= to_remove
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wiz_trader
3
- Version: 0.28.0
3
+ Version: 0.30.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
@@ -525,6 +525,24 @@ filtered_instruments = client.filter_instruments(
525
525
  )
526
526
  ```
527
527
 
528
+ #### Filter Instruments by Derivatives
529
+
530
+ Filter instruments based on whether they have associated futures or options contracts.
531
+
532
+ ```python
533
+ # Find all instruments that have options
534
+ optionable_stocks = client.filter_instruments_by_derivatives(hasOptions=True)
535
+
536
+ # Find all instruments that have futures
537
+ futures_stocks = client.filter_instruments_by_derivatives(hasFutures=True)
538
+
539
+ # Find all instruments that have both options and futures
540
+ fno_stocks = client.filter_instruments_by_derivatives(hasOptions=True, hasFutures=True)
541
+
542
+ # Find all instruments that have either options or futures
543
+ all_derivative_stocks = client.filter_instruments_by_derivatives()
544
+ ```
545
+
528
546
  #### Get Historical OHLCV Data
529
547
  ## Overview
530
548
 
@@ -0,0 +1,9 @@
1
+ wiz_trader/__init__.py,sha256=DqIoZxsr_Z6oAU4tha4WcQHVr0KmX5cSc8W_9z6JHt4,183
2
+ wiz_trader/apis/__init__.py,sha256=6sUr1nzmplNdld0zryMrQSt0jHT2GhOiFYgKKVHzk8U,133
3
+ wiz_trader/apis/client.py,sha256=gWTv6GW0zFyQCNGo0Q_vAfF91H6Ec84AWDVHQZPXdq8,64100
4
+ wiz_trader/quotes/__init__.py,sha256=RF9g9CNP6bVWlmCh_ad8krm3-EWOIuVfLp0-H9fAeEM,108
5
+ wiz_trader/quotes/client.py,sha256=aZ5LVlrj0mKfgHgFxERmk2HDZraB6RMaormTOMlqWZc,14915
6
+ wiz_trader-0.30.0.dist-info/METADATA,sha256=-7GKukzGeoecYLN6oLeLa3q0PylFwqQzh6VLnduwhc8,99947
7
+ wiz_trader-0.30.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
8
+ wiz_trader-0.30.0.dist-info/top_level.txt,sha256=lnYS_g8LlA6ryKYnvY8xIQ6K2K-xzOsd-99AWgnW6VY,11
9
+ wiz_trader-0.30.0.dist-info/RECORD,,
@@ -1,9 +0,0 @@
1
- wiz_trader/__init__.py,sha256=cVYj3vesO084MUP2n_72WDH_YJ3pwVh7GJEuhkxHGWA,183
2
- wiz_trader/apis/__init__.py,sha256=6sUr1nzmplNdld0zryMrQSt0jHT2GhOiFYgKKVHzk8U,133
3
- wiz_trader/apis/client.py,sha256=VEotcYfPkjmpp2seJtTWyEdppa6q9NecX89iWxnFQf0,63154
4
- wiz_trader/quotes/__init__.py,sha256=RF9g9CNP6bVWlmCh_ad8krm3-EWOIuVfLp0-H9fAeEM,108
5
- wiz_trader/quotes/client.py,sha256=VZhWbXns6o46efLx2_buBP-MI_obEd_UWNTL2lDwHGI,14847
6
- wiz_trader-0.28.0.dist-info/METADATA,sha256=nqXqELIc2_FOiMp_Iv_NUPqvX90YcgIzCw6qmxoQObY,99294
7
- wiz_trader-0.28.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
8
- wiz_trader-0.28.0.dist-info/top_level.txt,sha256=lnYS_g8LlA6ryKYnvY8xIQ6K2K-xzOsd-99AWgnW6VY,11
9
- wiz_trader-0.28.0.dist-info/RECORD,,