wiz-trader 0.30.0__py3-none-any.whl → 0.31.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.30.0"
6
+ __version__ = "0.31.0"
7
7
 
8
8
  __all__ = ["QuotesClient", "WizzerClient"]
wiz_trader/apis/client.py CHANGED
@@ -205,7 +205,11 @@ class WizzerClient:
205
205
  "indices.filter": "/datahub/indices/filter",
206
206
  "instruments.filter": "/datahub/instruments/filter",
207
207
  "instruments.filter_with_index": "/datahub/indices/{id}/instruments",
208
- "instruments.filter_by_derivatives": "/datahub/instruments/filter-by-derivatives"
208
+ "instruments.filter_by_derivatives": "/datahub/instruments/filter-by-derivatives",
209
+
210
+ # Screener API endpoints
211
+ "screener.run": "/datahub/screener",
212
+ "screener.fields": "/datahub/screener/metadata"
209
213
  }
210
214
 
211
215
  def __init__(
@@ -1709,9 +1713,47 @@ class WizzerClient:
1709
1713
  logger.debug(f"Filtering instruments by derivatives with payload: {data}")
1710
1714
  return self._make_request("POST", endpoint, json=data)
1711
1715
 
1716
+ def run_screener(
1717
+ self,
1718
+ filters: Dict[str, Any],
1719
+ sort: Optional[List[Dict[str, int]]] = None,
1720
+ limit: Optional[int] = None,
1721
+ ) -> List[Dict[str, Any]]:
1722
+ """
1723
+ Run an instrument screener with specified filters.
1724
+
1725
+ Args:
1726
+ filters (Dict[str, Any]): The filter conditions for the screener.
1727
+ sort (Optional[List[Dict[str, int]]]): The sort order for the results.
1728
+ limit (Optional[int]): The maximum number of results to return.
1729
+
1730
+ Returns:
1731
+ List[Dict[str, Any]]: A list of instruments that match the screener criteria.
1732
+ """
1733
+ endpoint = self._routes["screener.run"]
1734
+ data = {"filters": filters}
1735
+ if sort is not None:
1736
+ data["sort"] = sort
1737
+ if limit is not None:
1738
+ data["limit"] = limit
1739
+
1740
+ logger.debug(f"Running screener with payload: {data}")
1741
+ return self._make_request("POST", endpoint, json=data)
1742
+
1743
+ def get_screener_fields(self) -> List[Dict[str, Any]]:
1744
+ """
1745
+ Get the list of available fields and supported operations for the screener.
1746
+
1747
+ Returns:
1748
+ List[Dict[str, Any]]: A list of available screener fields.
1749
+ """
1750
+ endpoint = self._routes["screener.fields"]
1751
+ logger.debug("Fetching screener fields.")
1752
+ return self._make_request("GET", endpoint)
1753
+
1712
1754
  def _make_request(
1713
- self,
1714
- method: str,
1755
+ self,
1756
+ method: str,
1715
1757
  endpoint: str,
1716
1758
  params: Optional[Dict[str, str]] = None,
1717
1759
  json: Optional[Dict[str, Any]] = None,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wiz_trader
3
- Version: 0.30.0
3
+ Version: 0.31.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
@@ -543,6 +543,152 @@ fno_stocks = client.filter_instruments_by_derivatives(hasOptions=True, hasFuture
543
543
  all_derivative_stocks = client.filter_instruments_by_derivatives()
544
544
  ```
545
545
 
546
+ ### Instrument Screener
547
+
548
+ The SDK provides a powerful instrument screener to filter and sort instruments based on a wide range of criteria using a simple and expressive Domain Specific Language (DSL).
549
+
550
+ #### `get_screener_fields()`
551
+
552
+ This method returns a list of all available filterable fields and their supported operations.
553
+
554
+ ```python
555
+ # Get all available screener fields
556
+ fields = client.get_screener_fields()
557
+ print(json.dumps(fields, indent=2))
558
+ ```
559
+
560
+ #### `run_screener(filters, sort=None, limit=None, as_of=None)`
561
+
562
+ This is the main method for the instrument screener. It accepts a dictionary with a `filters` object to define the screening criteria.
563
+
564
+ **Arguments:**
565
+
566
+ * `filters` (dict, required): An object containing the filter conditions.
567
+ * `sort` (list, optional): A list of objects to define the sort order.
568
+ * `limit` (int, optional): The maximum number of results to return.
569
+
570
+ #### Filter DSL (Domain Specific Language)
571
+
572
+ The `filters` object uses a simple DSL to define the screening criteria.
573
+
574
+ ##### Operators
575
+
576
+ | Operator | Description | Example |
577
+ | :-------- | :----------------------- | :------------------------------------ |
578
+ | `$eq` | Equal to | `{ "sector": { "$eq": "Finance" } }` |
579
+ | `$ne` | Not equal to | `{ "sector": { "$ne": "Finance" } }` |
580
+ | `$gt` | Greater than | `{ "roe": { "$gt": 0.15 } }` |
581
+ | `$gte` | Greater than or equal to | `{ "roe": { "$gte": 0.15 } }` |
582
+ | `$lt` | Less than | `{ "roe": { "$lt": 0.15 } }` |
583
+ | `$lte` | Less than or equal to | `{ "roe": { "$lte": 0.15 } }` |
584
+ | `$in` | In a list of values | `{ "sector": { "$in": ["Information Technology", "Finance"] } }` |
585
+ | `$nin` | Not in a list of values| `{ "sector": { "$nin": ["Information Technology", "Finance"] } }` |
586
+ | `$like` | Like (case-sensitive) | `{ "companyName": { "$like": "%Bank%" } }` |
587
+ | `$nlike` | Not like (case-sensitive)| `{ "companyName": { "$nlike": "%Bank%" } }` |
588
+ | `$ilike` | Like (case-insensitive) | `{ "companyName": { "$ilike": "%bank%" } }` |
589
+ | `$between`| Between two values | `{ "roe": { "$between": [0.10, 0.20] } }` |
590
+
591
+ ##### Logical Operators
592
+
593
+ * `$and`: A list of filter conditions that must all be true.
594
+ * `$or`: A list of filter conditions where at least one must be true.
595
+
596
+ #### Screener Examples
597
+
598
+ ##### Basic Filters
599
+
600
+ 1. **Find all instruments in the 'Finance' sector.**
601
+ ```python
602
+ client.run_screener(filters={"sector": {"$eq": "Finance"}})
603
+ ```
604
+
605
+ 2. **Find all instruments on the 'NSE' exchange.**
606
+ ```python
607
+ client.run_screener(filters={"exchange": {"$eq": "NSE"}})
608
+ ```
609
+
610
+ 3. **Find all instruments with a Return on Equity (ROE) greater than 15%.**
611
+ ```python
612
+ client.run_screener(filters={"roe": {"$gt": 0.15}})
613
+ ```
614
+
615
+ ##### Set and Range Operators
616
+
617
+ 4. **Find all instruments in the 'Energy' or 'Healthcare' sectors.**
618
+ ```python
619
+ client.run_screener(filters={"sector": {"$in": ["Energy", "Healthcare"]}})
620
+ ```
621
+
622
+ 5. **Find instruments with a PAT Margin between 5% and 10%.**
623
+ ```python
624
+ client.run_screener(filters={"patMargin": {"$between": [0.05, 0.10]}})
625
+ ```
626
+
627
+ ##### Pattern Matching
628
+
629
+ 6. **Find all instruments with 'Bank' in their name (case-insensitive).**
630
+ ```python
631
+ client.run_screener(filters={"companyName": {"$ilike": "%bank%"}})
632
+ ```
633
+
634
+ ##### Logical Combinations
635
+
636
+ 7. **Find instruments in the 'IT' sector with a ROE greater than 20%.**
637
+ ```python
638
+ client.run_screener(
639
+ filters={
640
+ "$and": [
641
+ {"sector": {"$eq": "Information Technology"}},
642
+ {"roe": {"$gt": 0.20}}
643
+ ]
644
+ }
645
+ )
646
+ ```
647
+
648
+ 8. **Complex Nested Query:** Find instruments in the 'Automobile' sector that have (a ROE > 18% AND a low Debt/Equity) OR have a high Asset Turnover.
649
+ ```python
650
+ client.run_screener(
651
+ filters={
652
+ "$and": [
653
+ {"sector": {"$eq": "Automobile"}},
654
+ {
655
+ "$or": [
656
+ {
657
+ "$and": [
658
+ {"roe": {"$gt": 0.18}},
659
+ {"debtEquity": {"$lt": 0.3}}
660
+ ]
661
+ },
662
+ {"assetTurnover": {"$gt": 1.5}}
663
+ ]
664
+ }
665
+ ]
666
+ }
667
+ )
668
+ ```
669
+
670
+ ##### Sort and Limit
671
+
672
+ 9. **Find the top 10 companies by highest ROE.**
673
+ ```python
674
+ client.run_screener(
675
+ filters={},
676
+ sort=[{"roe": -1}],
677
+ limit=10
678
+ )
679
+ ```
680
+
681
+ 10. **Find companies in the 'Pharmaceuticals' sector, sort them by the highest PAT margin, and then by the lowest Debt-to-Equity ratio.**
682
+ ```python
683
+ client.run_screener(
684
+ filters={"sector": {"$eq": "Pharmaceuticals"}},
685
+ sort=[
686
+ {"patMargin": -1},
687
+ {"debtEquity": 1}
688
+ ]
689
+ )
690
+ ```
691
+
546
692
  #### Get Historical OHLCV Data
547
693
  ## Overview
548
694
 
@@ -3132,3 +3278,89 @@ All supported environment variables:
3132
3278
  | | | | Multi Utilities |
3133
3279
  | | | | Other Utilities |
3134
3280
  | Diversified | Diversified | Diversified | Diversified |
3281
+
3282
+ ## Available Screener Fields
3283
+
3284
+ The screener supports filtering instruments using various financial, technical, and fundamental data points. Use `client.get_screener_fields()` to get the complete list of available fields with their metadata.
3285
+
3286
+ ### Instrument Properties
3287
+
3288
+ | Field | Description | Data Type | Supported Operations |
3289
+ |-------|-------------|-----------|---------------------|
3290
+ | `exchange` | Stock exchange where the instrument is traded | String | `$eq`, `$ne`, `$in`, `$nin`, `$like`, `$nlike`, `$ilike` |
3291
+ | `tradingSymbol` | Trading symbol of the instrument | String | `$eq`, `$ne`, `$in`, `$nin`, `$like`, `$nlike`, `$ilike` |
3292
+ | `macroEconomicSector` | Macro economic sector classification | String | `$eq`, `$ne`, `$in`, `$nin`, `$like`, `$nlike`, `$ilike` |
3293
+ | `sector` | Sector classification | String | `$eq`, `$ne`, `$in`, `$nin`, `$like`, `$nlike`, `$ilike` |
3294
+ | `industry` | Industry classification | String | `$eq`, `$ne`, `$in`, `$nin`, `$like`, `$nlike`, `$ilike` |
3295
+ | `basicIndustry` | Basic industry classification | String | `$eq`, `$ne`, `$in`, `$nin`, `$like`, `$nlike`, `$ilike` |
3296
+ | `indices` | List of indices the instrument belongs to | Array(String) | `$in`, `$nin` |
3297
+
3298
+ ### Financial Data
3299
+
3300
+ | Field | Description | Data Type | Unit | Supported Operations |
3301
+ |-------|-------------|-----------|------|---------------------|
3302
+ | `reportDate` | Date of the financial report | Date | - | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
3303
+ | `companyName` | Company name | String | - | `$eq`, `$ne`, `$like`, `$nlike`, `$ilike` |
3304
+ | `period` | Financial reporting period (Q1, Q2, Q3, Q4, FY) | String | - | `$eq`, `$ne`, `$in`, `$nin` |
3305
+ | `filingDate` | Date when the report was filed | Date | - | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
3306
+ | `natureOfReport` | Type of financial report (Annual, Quarterly, etc.) | String | - | `$eq`, `$ne`, `$in`, `$nin` |
3307
+ | `auditedUnaudited` | Audited or Unaudited status of the financial report | String | - | `$eq`, `$ne`, `$in`, `$nin` |
3308
+
3309
+ ### Financial Ratios
3310
+
3311
+ | Field | Description | Data Type | Unit | Supported Operations |
3312
+ |-------|-------------|-----------|------|---------------------|
3313
+ | `roe` | Return on Equity | Float | % | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
3314
+ | `patMargin` | Profit After Tax Margin | Float | % | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
3315
+ | `debtEquity` | Debt to Equity Ratio | Float | ratio | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
3316
+ | `ocfPat` | Operating Cash Flow to PAT Ratio | Float | ratio | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
3317
+ | `gnpaPct` | Gross Non-Performing Assets Percentage | Float | % | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
3318
+ | `interestCov` | Interest Coverage Ratio | Float | ratio | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
3319
+ | `assetTurnover` | Asset Turnover Ratio | Float | ratio | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
3320
+ | `netCash` | Net Cash Position | Float | currency | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
3321
+ | `currentRatio` | Current Ratio | Float | ratio | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
3322
+
3323
+ ### Historical Market Data
3324
+
3325
+ | Field | Description | Data Type | Unit | Supported Operations |
3326
+ |-------|-------------|-----------|------|---------------------|
3327
+ | `hmdOpen` | Opening price of the trading session | Float | currency | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
3328
+ | `hmdHigh` | Highest price during the trading session | Float | currency | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
3329
+ | `hmdLow` | Lowest price during the trading session | Float | currency | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
3330
+ | `hmdClose` | Closing price of the trading session | Float | currency | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
3331
+ | `hmdLtp` | Last Traded Price | Float | currency | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
3332
+ | `hmdPrevClose` | Previous day closing price | Float | currency | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
3333
+ | `hmdVolume` | Trading volume (number of shares traded) | UInt64 | shares | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
3334
+ | `hmdTurnover` | Trading turnover (total value of shares traded) | Float | currency | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
3335
+ | `hmdTotalTrades` | Total number of trades executed | UInt64 | count | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
3336
+ | `hmdPriceBandLower` | Lower price band limit | Float | currency | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
3337
+ | `hmdPriceBandUpper` | Upper price band limit | Float | currency | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
3338
+ | `hmdDate` | Trading date | Date | - | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
3339
+
3340
+ ### Supported Operations
3341
+
3342
+ - **Comparison**: `$eq` (equal), `$ne` (not equal), `$gt` (greater than), `$gte` (greater than or equal), `$lt` (less than), `$lte` (less than or equal)
3343
+ - **Range**: `$between` (between two values)
3344
+ - **Array**: `$in` (in array), `$nin` (not in array)
3345
+ - **Pattern**: `$like` (case-sensitive pattern), `$nlike` (case-sensitive not pattern), `$ilike` (case-insensitive pattern)
3346
+ - **Logical**: `$and` (all conditions must be true), `$or` (at least one condition must be true)
3347
+
3348
+ ### Example Usage
3349
+
3350
+ ```python
3351
+ # Get all available screener fields
3352
+ fields = client.get_screener_fields()
3353
+ print(json.dumps(fields, indent=2))
3354
+
3355
+ # Screen for high ROE companies in Finance sector
3356
+ results = client.run_screener(
3357
+ filters={
3358
+ "$and": [
3359
+ {"sector": {"$eq": "Finance"}},
3360
+ {"roe": {"$gt": 0.15}}
3361
+ ]
3362
+ },
3363
+ sort=[{"roe": -1}],
3364
+ limit=10
3365
+ )
3366
+ ```
@@ -0,0 +1,9 @@
1
+ wiz_trader/__init__.py,sha256=JENNr-G__7-zFCQkA3DrG98uvCmkOU8rssu31GnJxgA,183
2
+ wiz_trader/apis/__init__.py,sha256=6sUr1nzmplNdld0zryMrQSt0jHT2GhOiFYgKKVHzk8U,133
3
+ wiz_trader/apis/client.py,sha256=WzsKxrNi9T-xbtXWBT2J41bJ-sz0KsGFYV5Oyddo3gg,65487
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.31.0.dist-info/METADATA,sha256=egRqWuYOGalAtWDGOlsjfxkl5RTg86--hDaJO8mjUTc,110671
7
+ wiz_trader-0.31.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
8
+ wiz_trader-0.31.0.dist-info/top_level.txt,sha256=lnYS_g8LlA6ryKYnvY8xIQ6K2K-xzOsd-99AWgnW6VY,11
9
+ wiz_trader-0.31.0.dist-info/RECORD,,
@@ -1,9 +0,0 @@
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,,