wiz-trader 0.38.0__tar.gz → 0.39.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.38.0
3
+ Version: 0.39.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
@@ -2632,7 +2632,7 @@ def analyze_stock(symbol):
2632
2632
  print(f"=== Analysis for {symbol} ===\n")
2633
2633
 
2634
2634
  # Fundamentals
2635
- print("📊 FUNDAMENTALS:")
2635
+ print("[FUNDAMENTALS]:")
2636
2636
  try:
2637
2637
  margin = client.get_net_profit_margin(symbol)
2638
2638
  print(f" Net Profit Margin: {margin.get('netProfitMargin', 'N/A')}%")
@@ -2649,7 +2649,7 @@ def analyze_stock(symbol):
2649
2649
  print(f" Error fetching fundamentals: {e}")
2650
2650
 
2651
2651
  # Valuation
2652
- print("\n💰 VALUATION:")
2652
+ print("\n[VALUATION]:")
2653
2653
  try:
2654
2654
  pe = client.get_pe_ratio(symbol)
2655
2655
  print(f" P/E Ratio: {pe.get('peRatio', 'N/A')}")
@@ -2677,7 +2677,7 @@ def analyze_stock(symbol):
2677
2677
  print(f" Error fetching returns: {e}")
2678
2678
 
2679
2679
  # Ownership
2680
- print("\n🏛️ OWNERSHIP:")
2680
+ print("\n[OWNERSHIP]:")
2681
2681
  try:
2682
2682
  fii_dii = client.get_fii_dii_holdings(symbol)
2683
2683
  print(f" FII Holdings: {fii_dii.get('fiiPercent', 'N/A')}%")
@@ -2689,7 +2689,7 @@ def analyze_stock(symbol):
2689
2689
  print(f" Error fetching ownership: {e}")
2690
2690
 
2691
2691
  # Market Cap
2692
- print("\n🏢 MARKET DATA:")
2692
+ print("\n[MARKET DATA]:")
2693
2693
  try:
2694
2694
  mcap = client.get_free_float_market_cap(symbol)
2695
2695
  print(f" Market Cap: ₹{mcap.get('marketCap', 'N/A')} Crores")
@@ -2699,7 +2699,7 @@ def analyze_stock(symbol):
2699
2699
  print(f" Error fetching market data: {e}")
2700
2700
 
2701
2701
  # Risk Analysis
2702
- print("\n⚠️ RISK ANALYSIS:")
2702
+ print("\n[RISK ANALYSIS]:")
2703
2703
  try:
2704
2704
  max_drawdown = client.get_max_drawdown(
2705
2705
  symbol=symbol,
@@ -2718,7 +2718,7 @@ def analyze_stock(symbol):
2718
2718
  print(f" Error fetching risk metrics: {e}")
2719
2719
 
2720
2720
  # Sector Classification
2721
- print("\n🏭 SECTOR CLASSIFICATION:")
2721
+ print("\n[SECTOR CLASSIFICATION]:")
2722
2722
  try:
2723
2723
  sector = client.get_sector_classification(symbol)
2724
2724
  print(f" Sector: {sector.get('sector', 'N/A')}")
@@ -2728,7 +2728,7 @@ def analyze_stock(symbol):
2728
2728
  print(f" Error fetching sector data: {e}")
2729
2729
 
2730
2730
  # Leverage Analysis
2731
- print("\n💳 LEVERAGE ANALYSIS:")
2731
+ print("\n[LEVERAGE ANALYSIS]:")
2732
2732
  try:
2733
2733
  debt_equity = client.get_debt_equity_ratio(symbol)
2734
2734
  print(f" Debt-to-Equity Ratio: {debt_equity.get('debtEquityRatio', 'N/A')}")
@@ -2742,8 +2742,102 @@ for stock in stocks:
2742
2742
  print("\n" + "="*50 + "\n")
2743
2743
  ```
2744
2744
 
2745
+ #### Advanced Market Data Analysis
2746
+
2747
+ Advanced volume and drawdown analysis:
2748
+
2749
+ ```python
2750
+ # Average Traded Volume
2751
+ volume_data = client.get_average_traded_volume(
2752
+ symbol="HDFCBANK",
2753
+ start_date="2024-04-01",
2754
+ end_date="2024-06-30",
2755
+ interval="daily"
2756
+ )
2757
+ print(f"Average Volume: {volume_data['averageVolume']} shares")
2758
+
2759
+ # Index Maximum Drawdown
2760
+ index_drawdown = client.get_index_max_drawdown(
2761
+ index_symbol="NIFTY50",
2762
+ start_date="2023-01-01",
2763
+ end_date="2024-01-01",
2764
+ interval="daily"
2765
+ )
2766
+ print(f"Max Drawdown: {index_drawdown['maxDrawdown']}%")
2767
+
2768
+ # Drawdown Duration Analysis
2769
+ drawdown_duration = client.get_drawdown_duration(
2770
+ symbol="INFY",
2771
+ start_date="2022-01-01",
2772
+ end_date="2024-01-01",
2773
+ interval="daily"
2774
+ )
2775
+ print(f"Max Drawdown Duration: {drawdown_duration['maxDrawdownDuration']} days")
2776
+ ```
2777
+
2778
+ #### Technical Price Analysis
2779
+
2780
+ Rolling price analysis and volatility:
2781
+
2782
+ ```python
2783
+ # Rolling Peak Price Analysis
2784
+ rolling_peak = client.get_rolling_peak_price(
2785
+ symbol="NSE:TCS",
2786
+ start_date="2024-01-01",
2787
+ end_date="2024-06-30",
2788
+ window=20,
2789
+ adjusted=True
2790
+ )
2791
+ print(f"Rolling peak data points: {len(rolling_peak['data'])}")
2792
+
2793
+ # Rolling Price Mean
2794
+ rolling_mean = client.get_rolling_price_mean(
2795
+ symbol="HDFCBANK",
2796
+ start_date="2024-01-01",
2797
+ end_date="2024-06-30",
2798
+ window=50,
2799
+ adjusted=True
2800
+ )
2801
+ print(f"Rolling mean data points: {len(rolling_mean['data'])}")
2802
+
2803
+ # Realized Volatility
2804
+ volatility = client.get_realized_volatility(
2805
+ symbol="NSE:ITC",
2806
+ start_date="2024-01-01",
2807
+ end_date="2024-06-30",
2808
+ adjusted=True
2809
+ )
2810
+ print(f"Realized Volatility: {volatility['realizedVolatility']}%")
2811
+ print(f"Annualized Volatility: {volatility['annualizedVolatility']}%")
2812
+ ```
2813
+
2814
+ #### Advanced Risk Metrics
2815
+
2816
+ CAMP Beta analysis:
2817
+
2818
+ ```python
2819
+ # 90-Day Beta Analysis
2820
+ beta_90d = client.get_beta_90d(
2821
+ symbol="ITC",
2822
+ benchmark="NIFTY50"
2823
+ )
2824
+ print(f"90-Day Beta: {beta_90d['beta']}")
2825
+ print(f"Correlation: {beta_90d['correlation']}")
2826
+ print(f"R-Squared: {beta_90d['rSquared']}")
2827
+
2828
+ # Custom Period Beta
2829
+ beta_custom = client.get_beta_custom_period(
2830
+ symbol="TCS",
2831
+ benchmark="NIFTY50",
2832
+ start_date="2020-01-01",
2833
+ end_date="2024-12-31"
2834
+ )
2835
+ print(f"Custom Period Beta: {beta_custom['beta']}")
2836
+ print(f"Alpha: {beta_custom['alpha']}")
2837
+ ```
2838
+
2745
2839
  **Key Features:**
2746
- - **Comprehensive Coverage**: 31+ analytics endpoints covering fundamentals, valuation, returns, market data, ownership, metrics, macro data, risk analysis, sector classification, and leverage analysis
2840
+ - **Comprehensive Coverage**: 39+ analytics endpoints covering fundamentals, valuation, returns, market data, ownership, metrics, macro data, risk analysis, sector classification, leverage analysis, and advanced technical analysis
2747
2841
  - **Fundamentals Analysis**: 9 methods including ROE, ROA, margins, ratios, book-to-market, market cap-to-sales, and cash-to-market cap
2748
2842
  - **Valuation Metrics**: P/E, P/B, EV/EBITDA, FCF yield with TTM and consolidated/standalone options
2749
2843
  - **Risk-Adjusted Metrics**: Sortino ratio, upside capture ratio, maximum drawdown, and returns volatility for comprehensive risk analysis
@@ -2605,7 +2605,7 @@ def analyze_stock(symbol):
2605
2605
  print(f"=== Analysis for {symbol} ===\n")
2606
2606
 
2607
2607
  # Fundamentals
2608
- print("📊 FUNDAMENTALS:")
2608
+ print("[FUNDAMENTALS]:")
2609
2609
  try:
2610
2610
  margin = client.get_net_profit_margin(symbol)
2611
2611
  print(f" Net Profit Margin: {margin.get('netProfitMargin', 'N/A')}%")
@@ -2622,7 +2622,7 @@ def analyze_stock(symbol):
2622
2622
  print(f" Error fetching fundamentals: {e}")
2623
2623
 
2624
2624
  # Valuation
2625
- print("\n💰 VALUATION:")
2625
+ print("\n[VALUATION]:")
2626
2626
  try:
2627
2627
  pe = client.get_pe_ratio(symbol)
2628
2628
  print(f" P/E Ratio: {pe.get('peRatio', 'N/A')}")
@@ -2650,7 +2650,7 @@ def analyze_stock(symbol):
2650
2650
  print(f" Error fetching returns: {e}")
2651
2651
 
2652
2652
  # Ownership
2653
- print("\n🏛️ OWNERSHIP:")
2653
+ print("\n[OWNERSHIP]:")
2654
2654
  try:
2655
2655
  fii_dii = client.get_fii_dii_holdings(symbol)
2656
2656
  print(f" FII Holdings: {fii_dii.get('fiiPercent', 'N/A')}%")
@@ -2662,7 +2662,7 @@ def analyze_stock(symbol):
2662
2662
  print(f" Error fetching ownership: {e}")
2663
2663
 
2664
2664
  # Market Cap
2665
- print("\n🏢 MARKET DATA:")
2665
+ print("\n[MARKET DATA]:")
2666
2666
  try:
2667
2667
  mcap = client.get_free_float_market_cap(symbol)
2668
2668
  print(f" Market Cap: ₹{mcap.get('marketCap', 'N/A')} Crores")
@@ -2672,7 +2672,7 @@ def analyze_stock(symbol):
2672
2672
  print(f" Error fetching market data: {e}")
2673
2673
 
2674
2674
  # Risk Analysis
2675
- print("\n⚠️ RISK ANALYSIS:")
2675
+ print("\n[RISK ANALYSIS]:")
2676
2676
  try:
2677
2677
  max_drawdown = client.get_max_drawdown(
2678
2678
  symbol=symbol,
@@ -2691,7 +2691,7 @@ def analyze_stock(symbol):
2691
2691
  print(f" Error fetching risk metrics: {e}")
2692
2692
 
2693
2693
  # Sector Classification
2694
- print("\n🏭 SECTOR CLASSIFICATION:")
2694
+ print("\n[SECTOR CLASSIFICATION]:")
2695
2695
  try:
2696
2696
  sector = client.get_sector_classification(symbol)
2697
2697
  print(f" Sector: {sector.get('sector', 'N/A')}")
@@ -2701,7 +2701,7 @@ def analyze_stock(symbol):
2701
2701
  print(f" Error fetching sector data: {e}")
2702
2702
 
2703
2703
  # Leverage Analysis
2704
- print("\n💳 LEVERAGE ANALYSIS:")
2704
+ print("\n[LEVERAGE ANALYSIS]:")
2705
2705
  try:
2706
2706
  debt_equity = client.get_debt_equity_ratio(symbol)
2707
2707
  print(f" Debt-to-Equity Ratio: {debt_equity.get('debtEquityRatio', 'N/A')}")
@@ -2715,8 +2715,102 @@ for stock in stocks:
2715
2715
  print("\n" + "="*50 + "\n")
2716
2716
  ```
2717
2717
 
2718
+ #### Advanced Market Data Analysis
2719
+
2720
+ Advanced volume and drawdown analysis:
2721
+
2722
+ ```python
2723
+ # Average Traded Volume
2724
+ volume_data = client.get_average_traded_volume(
2725
+ symbol="HDFCBANK",
2726
+ start_date="2024-04-01",
2727
+ end_date="2024-06-30",
2728
+ interval="daily"
2729
+ )
2730
+ print(f"Average Volume: {volume_data['averageVolume']} shares")
2731
+
2732
+ # Index Maximum Drawdown
2733
+ index_drawdown = client.get_index_max_drawdown(
2734
+ index_symbol="NIFTY50",
2735
+ start_date="2023-01-01",
2736
+ end_date="2024-01-01",
2737
+ interval="daily"
2738
+ )
2739
+ print(f"Max Drawdown: {index_drawdown['maxDrawdown']}%")
2740
+
2741
+ # Drawdown Duration Analysis
2742
+ drawdown_duration = client.get_drawdown_duration(
2743
+ symbol="INFY",
2744
+ start_date="2022-01-01",
2745
+ end_date="2024-01-01",
2746
+ interval="daily"
2747
+ )
2748
+ print(f"Max Drawdown Duration: {drawdown_duration['maxDrawdownDuration']} days")
2749
+ ```
2750
+
2751
+ #### Technical Price Analysis
2752
+
2753
+ Rolling price analysis and volatility:
2754
+
2755
+ ```python
2756
+ # Rolling Peak Price Analysis
2757
+ rolling_peak = client.get_rolling_peak_price(
2758
+ symbol="NSE:TCS",
2759
+ start_date="2024-01-01",
2760
+ end_date="2024-06-30",
2761
+ window=20,
2762
+ adjusted=True
2763
+ )
2764
+ print(f"Rolling peak data points: {len(rolling_peak['data'])}")
2765
+
2766
+ # Rolling Price Mean
2767
+ rolling_mean = client.get_rolling_price_mean(
2768
+ symbol="HDFCBANK",
2769
+ start_date="2024-01-01",
2770
+ end_date="2024-06-30",
2771
+ window=50,
2772
+ adjusted=True
2773
+ )
2774
+ print(f"Rolling mean data points: {len(rolling_mean['data'])}")
2775
+
2776
+ # Realized Volatility
2777
+ volatility = client.get_realized_volatility(
2778
+ symbol="NSE:ITC",
2779
+ start_date="2024-01-01",
2780
+ end_date="2024-06-30",
2781
+ adjusted=True
2782
+ )
2783
+ print(f"Realized Volatility: {volatility['realizedVolatility']}%")
2784
+ print(f"Annualized Volatility: {volatility['annualizedVolatility']}%")
2785
+ ```
2786
+
2787
+ #### Advanced Risk Metrics
2788
+
2789
+ CAMP Beta analysis:
2790
+
2791
+ ```python
2792
+ # 90-Day Beta Analysis
2793
+ beta_90d = client.get_beta_90d(
2794
+ symbol="ITC",
2795
+ benchmark="NIFTY50"
2796
+ )
2797
+ print(f"90-Day Beta: {beta_90d['beta']}")
2798
+ print(f"Correlation: {beta_90d['correlation']}")
2799
+ print(f"R-Squared: {beta_90d['rSquared']}")
2800
+
2801
+ # Custom Period Beta
2802
+ beta_custom = client.get_beta_custom_period(
2803
+ symbol="TCS",
2804
+ benchmark="NIFTY50",
2805
+ start_date="2020-01-01",
2806
+ end_date="2024-12-31"
2807
+ )
2808
+ print(f"Custom Period Beta: {beta_custom['beta']}")
2809
+ print(f"Alpha: {beta_custom['alpha']}")
2810
+ ```
2811
+
2718
2812
  **Key Features:**
2719
- - **Comprehensive Coverage**: 31+ analytics endpoints covering fundamentals, valuation, returns, market data, ownership, metrics, macro data, risk analysis, sector classification, and leverage analysis
2813
+ - **Comprehensive Coverage**: 39+ analytics endpoints covering fundamentals, valuation, returns, market data, ownership, metrics, macro data, risk analysis, sector classification, leverage analysis, and advanced technical analysis
2720
2814
  - **Fundamentals Analysis**: 9 methods including ROE, ROA, margins, ratios, book-to-market, market cap-to-sales, and cash-to-market cap
2721
2815
  - **Valuation Metrics**: P/E, P/B, EV/EBITDA, FCF yield with TTM and consolidated/standalone options
2722
2816
  - **Risk-Adjusted Metrics**: Sortino ratio, upside capture ratio, maximum drawdown, and returns volatility for comprehensive risk analysis
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "wiz_trader"
7
- version = "0.38.0"
7
+ version = "0.39.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.29.0',
5
+ version='0.39.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.38.0"
6
+ __version__ = "0.39.0"
7
7
 
8
8
  __all__ = ["QuotesClient", "WizzerClient"]
@@ -278,6 +278,16 @@ class WizzerClient:
278
278
  # Analytics API endpoints - Leverage
279
279
  "analytics.leverage.debt_equity_ratio": "/analytics/leverage/debtEquityRatio",
280
280
 
281
+ # Analytics API endpoints - New Additions
282
+ "analytics.marketdata.average_volume": "/analytics/marketdata/averageVolume",
283
+ "analytics.index.max_drawdown": "/analytics/index/metrics/maxDrawdown",
284
+ "analytics.instrument.drawdown_duration": "/analytics/instrument/metrics/drawdownDuration",
285
+ "analytics.price.rolling_peak": "/analytics/analytics/price/rollingPeak",
286
+ "analytics.price.rolling_mean": "/analytics/analytics/price/rollingMean",
287
+ "analytics.volatility.realized": "/analytics/analytics/volatility/realized",
288
+ "analytics.risk.beta_90d": "/analytics/risk/beta90d",
289
+ "analytics.risk.beta_custom": "/analytics/risk/beta",
290
+
281
291
  }
282
292
 
283
293
  def __init__(
@@ -1822,6 +1832,7 @@ class WizzerClient:
1822
1832
  def _normalize_params(self, params: Optional[Dict[str, Any]]) -> Optional[Dict[str, str]]:
1823
1833
  """
1824
1834
  Normalize parameters for HTTP requests, converting booleans to lowercase strings.
1835
+ Preserves spaces in string values to prevent automatic URL encoding by requests library.
1825
1836
 
1826
1837
  Args:
1827
1838
  params (Optional[Dict[str, Any]]): Raw parameters dictionary.
@@ -1838,7 +1849,8 @@ class WizzerClient:
1838
1849
  # Convert Python boolean to lowercase string for API compatibility
1839
1850
  normalized[key] = "true" if value else "false"
1840
1851
  elif value is not None:
1841
- # Convert other values to strings
1852
+ # Convert other values to strings, preserving spaces
1853
+ # This prevents requests library from automatically URL-encoding spaces to '+'
1842
1854
  normalized[key] = str(value)
1843
1855
 
1844
1856
  return normalized
@@ -1867,12 +1879,28 @@ class WizzerClient:
1867
1879
  Raises:
1868
1880
  requests.RequestException: If the request fails.
1869
1881
  """
1882
+ import urllib.parse
1883
+
1870
1884
  url = f"{self.base_url}{endpoint}"
1871
1885
  request_headers = headers if headers else self.headers
1872
1886
 
1873
1887
  # Normalize parameters to handle booleans correctly
1874
1888
  normalized_params = self._normalize_params(params)
1875
1889
 
1890
+ # Handle URL construction manually to encode spaces as %20 instead of +
1891
+ if normalized_params and method.upper() == 'GET':
1892
+ # Construct query string manually to control encoding
1893
+ query_parts = []
1894
+ for key, value in normalized_params.items():
1895
+ # Use urllib.parse.quote to encode values, spaces become %20 instead of +
1896
+ encoded_key = urllib.parse.quote(str(key), safe='')
1897
+ encoded_value = urllib.parse.quote(str(value), safe='') # Properly encode all special chars
1898
+ query_parts.append(f"{encoded_key}={encoded_value}")
1899
+
1900
+ if query_parts:
1901
+ url = f"{url}?{'&'.join(query_parts)}"
1902
+ normalized_params = None # Don't pass params to requests since we built the URL manually
1903
+
1876
1904
  try:
1877
1905
  logger.debug("%s request to %s", method, url)
1878
1906
  response = requests.request(
@@ -2536,7 +2564,7 @@ class WizzerClient:
2536
2564
  self,
2537
2565
  symbol: str,
2538
2566
  as_of: str,
2539
- price_source: str = "avg_quarter",
2567
+ price_source: str = "avgQuarter",
2540
2568
  custom_price: Optional[float] = None,
2541
2569
  standalone: bool = False,
2542
2570
  currency: str = "INR"
@@ -2547,7 +2575,7 @@ class WizzerClient:
2547
2575
  Args:
2548
2576
  symbol (str): Stock symbol (e.g., "NSE:INFY").
2549
2577
  as_of (str): Reference date (YYYY-MM-DD).
2550
- price_source (str, optional): Price source: spot, avg_quarter, custom. Defaults to "avg_quarter".
2578
+ price_source (str, optional): Price source: spot, avgQuarter, custom. Defaults to "avgQuarter".
2551
2579
  custom_price (float, optional): Required if price_source=custom.
2552
2580
  standalone (bool, optional): Use standalone financials. Defaults to False.
2553
2581
  currency (str, optional): Output currency. Defaults to "INR".
@@ -2562,7 +2590,7 @@ class WizzerClient:
2562
2590
  "bookToMarket": 0.1234,
2563
2591
  "bookValuePerShare": 184.50,
2564
2592
  "marketPricePerShare": 1495.75,
2565
- "sourcePriceType": "avg_quarter",
2593
+ "sourcePriceType": "avgQuarter",
2566
2594
  "quarterRef": "Q4FY23",
2567
2595
  "standalone": false,
2568
2596
  "unit": "ratio"
@@ -2586,7 +2614,7 @@ class WizzerClient:
2586
2614
  self,
2587
2615
  symbol: str,
2588
2616
  as_of: str,
2589
- price_source: str = "avg_quarter",
2617
+ price_source: str = "avgQuarter",
2590
2618
  custom_price: Optional[float] = None,
2591
2619
  standalone: bool = False
2592
2620
  ) -> Dict[str, Any]:
@@ -2596,7 +2624,7 @@ class WizzerClient:
2596
2624
  Args:
2597
2625
  symbol (str): Stock symbol.
2598
2626
  as_of (str): Reference date (YYYY-MM-DD).
2599
- price_source (str, optional): Price source. Defaults to "avg_quarter".
2627
+ price_source (str, optional): Price source. Defaults to "avgQuarter".
2600
2628
  custom_price (float, optional): Custom price if price_source=custom.
2601
2629
  standalone (bool, optional): Use standalone financials. Defaults to False.
2602
2630
 
@@ -2634,7 +2662,7 @@ class WizzerClient:
2634
2662
  self,
2635
2663
  symbol: str,
2636
2664
  as_of: str,
2637
- price_source: str = "avg_quarter",
2665
+ price_source: str = "avgQuarter",
2638
2666
  custom_price: Optional[float] = None,
2639
2667
  standalone: bool = False
2640
2668
  ) -> Dict[str, Any]:
@@ -2644,7 +2672,7 @@ class WizzerClient:
2644
2672
  Args:
2645
2673
  symbol (str): Stock symbol.
2646
2674
  as_of (str): Reference date (YYYY-MM-DD).
2647
- price_source (str, optional): Price source. Defaults to "avg_quarter".
2675
+ price_source (str, optional): Price source. Defaults to "avgQuarter".
2648
2676
  custom_price (float, optional): Custom price if price_source=custom.
2649
2677
  standalone (bool, optional): Use standalone financials. Defaults to False.
2650
2678
 
@@ -3148,7 +3176,7 @@ class WizzerClient:
3148
3176
  }
3149
3177
  """
3150
3178
  params = self._normalize_params({
3151
- "symbol": symbol,
3179
+ "index": symbol,
3152
3180
  "startDate": start_date,
3153
3181
  "endDate": end_date
3154
3182
  })
@@ -3504,3 +3532,346 @@ class WizzerClient:
3504
3532
 
3505
3533
  logger.debug("Fetching CAGR for %s from %s to %s", symbol, start_date, end_date)
3506
3534
  return self._make_request("GET", self._routes["analytics.returns.cagr"], params=params)
3535
+
3536
+ # --- New Analytics Methods ---
3537
+
3538
+ def get_average_traded_volume(
3539
+ self,
3540
+ symbol: str,
3541
+ start_date: str,
3542
+ end_date: str,
3543
+ interval: str = "daily"
3544
+ ) -> Dict[str, Any]:
3545
+ """
3546
+ Get average traded volume for a stock over a specified period.
3547
+
3548
+ Args:
3549
+ symbol (str): Stock symbol (e.g., HDFCBANK, NSE:RELIANCE).
3550
+ start_date (str): Period start date (YYYY-MM-DD).
3551
+ end_date (str): Period end date (YYYY-MM-DD).
3552
+ interval (str, optional): Time interval ('daily', 'weekly', 'monthly'). Defaults to 'daily'.
3553
+
3554
+ Returns:
3555
+ Dict[str, Any]: Average volume data.
3556
+
3557
+ Example Response:
3558
+ {
3559
+ "symbol": "HDFCBANK",
3560
+ "startDate": "2024-04-01",
3561
+ "endDate": "2024-06-30",
3562
+ "interval": "daily",
3563
+ "averageVolume": 1234567,
3564
+ "totalDays": 61,
3565
+ "unit": "shares"
3566
+ }
3567
+ """
3568
+ params = self._normalize_params({
3569
+ "symbol": symbol,
3570
+ "startDate": start_date,
3571
+ "endDate": end_date,
3572
+ "interval": interval
3573
+ })
3574
+
3575
+ logger.debug("Fetching average traded volume for %s from %s to %s", symbol, start_date, end_date)
3576
+ return self._make_request("GET", self._routes["analytics.marketdata.average_volume"], params=params)
3577
+
3578
+ def get_index_max_drawdown(
3579
+ self,
3580
+ index_symbol: str,
3581
+ start_date: str,
3582
+ end_date: str,
3583
+ interval: str = "daily"
3584
+ ) -> Dict[str, Any]:
3585
+ """
3586
+ Get maximum drawdown for an index over a specified period.
3587
+
3588
+ Args:
3589
+ index_symbol (str): Index symbol (e.g., NIFTY50, BANKNIFTY, SENSEX).
3590
+ start_date (str): Period start date (YYYY-MM-DD).
3591
+ end_date (str): Period end date (YYYY-MM-DD).
3592
+ interval (str, optional): Time interval ('daily', 'weekly', 'monthly'). Defaults to 'daily'.
3593
+
3594
+ Returns:
3595
+ Dict[str, Any]: Maximum drawdown data.
3596
+
3597
+ Example Response:
3598
+ {
3599
+ "indexSymbol": "NIFTY50",
3600
+ "startDate": "2023-01-01",
3601
+ "endDate": "2024-01-01",
3602
+ "interval": "daily",
3603
+ "maxDrawdown": -15.23,
3604
+ "drawdownDate": "2023-10-26",
3605
+ "peakDate": "2023-09-19",
3606
+ "unit": "%"
3607
+ }
3608
+ """
3609
+ params = self._normalize_params({
3610
+ "indexSymbol": index_symbol,
3611
+ "startDate": start_date,
3612
+ "endDate": end_date,
3613
+ "interval": interval
3614
+ })
3615
+
3616
+ logger.debug("Fetching index max drawdown for %s from %s to %s", index_symbol, start_date, end_date)
3617
+ return self._make_request("GET", self._routes["analytics.index.max_drawdown"], params=params)
3618
+
3619
+ def get_drawdown_duration(
3620
+ self,
3621
+ symbol: str,
3622
+ start_date: str,
3623
+ end_date: str,
3624
+ interval: str = "daily"
3625
+ ) -> Dict[str, Any]:
3626
+ """
3627
+ Get drawdown duration analysis for a stock or index.
3628
+
3629
+ Args:
3630
+ symbol (str): Stock or index symbol (e.g., INFY, NIFTY50).
3631
+ start_date (str): Start of analysis period (YYYY-MM-DD).
3632
+ end_date (str): End of analysis period (YYYY-MM-DD).
3633
+ interval (str, optional): Time interval ('daily', 'weekly', 'monthly'). Defaults to 'daily'.
3634
+
3635
+ Returns:
3636
+ Dict[str, Any]: Drawdown duration data.
3637
+
3638
+ Example Response:
3639
+ {
3640
+ "symbol": "INFY",
3641
+ "startDate": "2022-01-01",
3642
+ "endDate": "2024-01-01",
3643
+ "interval": "daily",
3644
+ "maxDrawdownDuration": 147,
3645
+ "averageDrawdownDuration": 23.5,
3646
+ "totalDrawdowns": 12,
3647
+ "unit": "days"
3648
+ }
3649
+ """
3650
+ params = self._normalize_params({
3651
+ "symbol": symbol,
3652
+ "startDate": start_date,
3653
+ "endDate": end_date,
3654
+ "interval": interval
3655
+ })
3656
+
3657
+ logger.debug("Fetching drawdown duration for %s from %s to %s", symbol, start_date, end_date)
3658
+ return self._make_request("GET", self._routes["analytics.instrument.drawdown_duration"], params=params)
3659
+
3660
+ def get_rolling_peak_price(
3661
+ self,
3662
+ symbol: str,
3663
+ start_date: str,
3664
+ end_date: str,
3665
+ window: int,
3666
+ adjusted: bool = True,
3667
+ interval: str = "daily"
3668
+ ) -> Dict[str, Any]:
3669
+ """
3670
+ Get rolling peak price analysis for a stock.
3671
+
3672
+ Args:
3673
+ symbol (str): Stock symbol (e.g., RELIANCE, NSE:TCS).
3674
+ start_date (str): Start of evaluation period (YYYY-MM-DD).
3675
+ end_date (str): End of evaluation period (YYYY-MM-DD).
3676
+ window (int): Rolling window size in days (1-252).
3677
+ adjusted (bool, optional): Adjust for corporate actions. Defaults to True.
3678
+ interval (str, optional): Time interval ('daily', 'weekly', 'monthly'). Defaults to 'daily'.
3679
+
3680
+ Returns:
3681
+ Dict[str, Any]: Rolling peak price data.
3682
+
3683
+ Example Response:
3684
+ {
3685
+ "symbol": "NSE:TCS",
3686
+ "startDate": "2024-01-01",
3687
+ "endDate": "2024-06-30",
3688
+ "window": 20,
3689
+ "interval": "daily",
3690
+ "adjusted": true,
3691
+ "data": [
3692
+ {"date": "2024-01-01", "price": 3500.0, "rollingPeak": 3500.0},
3693
+ {"date": "2024-01-02", "price": 3520.0, "rollingPeak": 3520.0}
3694
+ ]
3695
+ }
3696
+ """
3697
+ params = self._normalize_params({
3698
+ "symbol": symbol,
3699
+ "startDate": start_date,
3700
+ "endDate": end_date,
3701
+ "window": window,
3702
+ "adjusted": adjusted,
3703
+ "interval": interval
3704
+ })
3705
+
3706
+ logger.debug("Fetching rolling peak price for %s from %s to %s with window %d", symbol, start_date, end_date, window)
3707
+ return self._make_request("GET", self._routes["analytics.price.rolling_peak"], params=params)
3708
+
3709
+ def get_rolling_price_mean(
3710
+ self,
3711
+ symbol: str,
3712
+ start_date: str,
3713
+ end_date: str,
3714
+ window: int,
3715
+ adjusted: bool = True,
3716
+ interval: str = "daily"
3717
+ ) -> Dict[str, Any]:
3718
+ """
3719
+ Get rolling mean price analysis for a stock.
3720
+
3721
+ Args:
3722
+ symbol (str): Stock symbol (e.g., HDFCBANK, NSE:WIPRO).
3723
+ start_date (str): Start of evaluation period (YYYY-MM-DD).
3724
+ end_date (str): End of evaluation period (YYYY-MM-DD).
3725
+ window (int): Rolling window size in days (1-252).
3726
+ adjusted (bool, optional): Adjust for corporate actions. Defaults to True.
3727
+ interval (str, optional): Time interval ('daily', 'weekly', 'monthly'). Defaults to 'daily'.
3728
+
3729
+ Returns:
3730
+ Dict[str, Any]: Rolling mean price data.
3731
+
3732
+ Example Response:
3733
+ {
3734
+ "symbol": "NSE:HDFCBANK",
3735
+ "startDate": "2024-01-01",
3736
+ "endDate": "2024-06-30",
3737
+ "window": 20,
3738
+ "interval": "daily",
3739
+ "adjusted": true,
3740
+ "data": [
3741
+ {"date": "2024-01-01", "price": 1500.0, "rollingMean": 1500.0},
3742
+ {"date": "2024-01-02", "price": 1510.0, "rollingMean": 1505.0}
3743
+ ]
3744
+ }
3745
+ """
3746
+ params = self._normalize_params({
3747
+ "symbol": symbol,
3748
+ "startDate": start_date,
3749
+ "endDate": end_date,
3750
+ "window": window,
3751
+ "adjusted": adjusted,
3752
+ "interval": interval
3753
+ })
3754
+
3755
+ logger.debug("Fetching rolling mean price for %s from %s to %s with window %d", symbol, start_date, end_date, window)
3756
+ return self._make_request("GET", self._routes["analytics.price.rolling_mean"], params=params)
3757
+
3758
+ def get_realized_volatility(
3759
+ self,
3760
+ symbol: str,
3761
+ start_date: str,
3762
+ end_date: str,
3763
+ adjusted: bool = True,
3764
+ interval: str = "daily"
3765
+ ) -> Dict[str, Any]:
3766
+ """
3767
+ Get realized price volatility for a stock.
3768
+
3769
+ Args:
3770
+ symbol (str): Stock symbol or instrument ID (e.g., NSE:ITC, BHARTIARTL).
3771
+ start_date (str): Start of volatility calculation window (YYYY-MM-DD).
3772
+ end_date (str): End of volatility calculation window (YYYY-MM-DD).
3773
+ adjusted (bool, optional): Adjust prices for corporate actions. Defaults to True.
3774
+ interval (str, optional): Time interval ('daily', 'weekly', 'monthly'). Defaults to 'daily'.
3775
+
3776
+ Returns:
3777
+ Dict[str, Any]: Realized volatility data.
3778
+
3779
+ Example Response:
3780
+ {
3781
+ "symbol": "NSE:ITC",
3782
+ "startDate": "2024-01-01",
3783
+ "endDate": "2024-06-30",
3784
+ "interval": "daily",
3785
+ "adjusted": true,
3786
+ "realizedVolatility": 22.45,
3787
+ "annualizedVolatility": 35.67,
3788
+ "unit": "%"
3789
+ }
3790
+ """
3791
+ params = self._normalize_params({
3792
+ "symbol": symbol,
3793
+ "startDate": start_date,
3794
+ "endDate": end_date,
3795
+ "adjusted": adjusted,
3796
+ "interval": interval
3797
+ })
3798
+
3799
+ logger.debug("Fetching realized volatility for %s from %s to %s", symbol, start_date, end_date)
3800
+ return self._make_request("GET", self._routes["analytics.volatility.realized"], params=params)
3801
+
3802
+ def get_beta_90d(
3803
+ self,
3804
+ symbol: str,
3805
+ benchmark: str = "NIFTY50"
3806
+ ) -> Dict[str, Any]:
3807
+ """
3808
+ Get 90-day CAPM Beta for a stock relative to a benchmark.
3809
+
3810
+ Args:
3811
+ symbol (str): Stock symbol (e.g., RELIANCE, ITC).
3812
+ benchmark (str, optional): Benchmark index. Defaults to 'NIFTY50'.
3813
+
3814
+ Returns:
3815
+ Dict[str, Any]: 90-day beta data.
3816
+
3817
+ Example Response:
3818
+ {
3819
+ "symbol": "ITC",
3820
+ "benchmark": "NIFTY50",
3821
+ "period": "90d",
3822
+ "beta": 0.85,
3823
+ "correlation": 0.72,
3824
+ "rSquared": 0.52,
3825
+ "alpha": 0.03,
3826
+ "unit": "ratio"
3827
+ }
3828
+ """
3829
+ params = self._normalize_params({
3830
+ "symbol": symbol,
3831
+ "benchmark": benchmark
3832
+ })
3833
+
3834
+ logger.debug("Fetching 90d beta for %s vs %s", symbol, benchmark)
3835
+ return self._make_request("GET", self._routes["analytics.risk.beta_90d"], params=params)
3836
+
3837
+ def get_beta_custom_period(
3838
+ self,
3839
+ symbol: str,
3840
+ benchmark: str,
3841
+ start_date: str,
3842
+ end_date: str
3843
+ ) -> Dict[str, Any]:
3844
+ """
3845
+ Get CAPM Beta for a stock relative to a benchmark over a custom period.
3846
+
3847
+ Args:
3848
+ symbol (str): Stock symbol.
3849
+ benchmark (str): Benchmark index symbol.
3850
+ start_date (str): Start date (YYYY-MM-DD).
3851
+ end_date (str): End date (YYYY-MM-DD).
3852
+
3853
+ Returns:
3854
+ Dict[str, Any]: Custom period beta data.
3855
+
3856
+ Example Response:
3857
+ {
3858
+ "symbol": "ITC",
3859
+ "benchmark": "NIFTY50",
3860
+ "startDate": "2023-01-01",
3861
+ "endDate": "2025-01-01",
3862
+ "beta": 0.87,
3863
+ "correlation": 0.74,
3864
+ "rSquared": 0.55,
3865
+ "alpha": 0.02,
3866
+ "unit": "ratio"
3867
+ }
3868
+ """
3869
+ params = self._normalize_params({
3870
+ "symbol": symbol,
3871
+ "benchmark": benchmark,
3872
+ "startDate": start_date,
3873
+ "endDate": end_date
3874
+ })
3875
+
3876
+ logger.debug("Fetching custom period beta for %s vs %s from %s to %s", symbol, benchmark, start_date, end_date)
3877
+ return self._make_request("GET", self._routes["analytics.risk.beta_custom"], params=params)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wiz_trader
3
- Version: 0.38.0
3
+ Version: 0.39.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
@@ -2632,7 +2632,7 @@ def analyze_stock(symbol):
2632
2632
  print(f"=== Analysis for {symbol} ===\n")
2633
2633
 
2634
2634
  # Fundamentals
2635
- print("📊 FUNDAMENTALS:")
2635
+ print("[FUNDAMENTALS]:")
2636
2636
  try:
2637
2637
  margin = client.get_net_profit_margin(symbol)
2638
2638
  print(f" Net Profit Margin: {margin.get('netProfitMargin', 'N/A')}%")
@@ -2649,7 +2649,7 @@ def analyze_stock(symbol):
2649
2649
  print(f" Error fetching fundamentals: {e}")
2650
2650
 
2651
2651
  # Valuation
2652
- print("\n💰 VALUATION:")
2652
+ print("\n[VALUATION]:")
2653
2653
  try:
2654
2654
  pe = client.get_pe_ratio(symbol)
2655
2655
  print(f" P/E Ratio: {pe.get('peRatio', 'N/A')}")
@@ -2677,7 +2677,7 @@ def analyze_stock(symbol):
2677
2677
  print(f" Error fetching returns: {e}")
2678
2678
 
2679
2679
  # Ownership
2680
- print("\n🏛️ OWNERSHIP:")
2680
+ print("\n[OWNERSHIP]:")
2681
2681
  try:
2682
2682
  fii_dii = client.get_fii_dii_holdings(symbol)
2683
2683
  print(f" FII Holdings: {fii_dii.get('fiiPercent', 'N/A')}%")
@@ -2689,7 +2689,7 @@ def analyze_stock(symbol):
2689
2689
  print(f" Error fetching ownership: {e}")
2690
2690
 
2691
2691
  # Market Cap
2692
- print("\n🏢 MARKET DATA:")
2692
+ print("\n[MARKET DATA]:")
2693
2693
  try:
2694
2694
  mcap = client.get_free_float_market_cap(symbol)
2695
2695
  print(f" Market Cap: ₹{mcap.get('marketCap', 'N/A')} Crores")
@@ -2699,7 +2699,7 @@ def analyze_stock(symbol):
2699
2699
  print(f" Error fetching market data: {e}")
2700
2700
 
2701
2701
  # Risk Analysis
2702
- print("\n⚠️ RISK ANALYSIS:")
2702
+ print("\n[RISK ANALYSIS]:")
2703
2703
  try:
2704
2704
  max_drawdown = client.get_max_drawdown(
2705
2705
  symbol=symbol,
@@ -2718,7 +2718,7 @@ def analyze_stock(symbol):
2718
2718
  print(f" Error fetching risk metrics: {e}")
2719
2719
 
2720
2720
  # Sector Classification
2721
- print("\n🏭 SECTOR CLASSIFICATION:")
2721
+ print("\n[SECTOR CLASSIFICATION]:")
2722
2722
  try:
2723
2723
  sector = client.get_sector_classification(symbol)
2724
2724
  print(f" Sector: {sector.get('sector', 'N/A')}")
@@ -2728,7 +2728,7 @@ def analyze_stock(symbol):
2728
2728
  print(f" Error fetching sector data: {e}")
2729
2729
 
2730
2730
  # Leverage Analysis
2731
- print("\n💳 LEVERAGE ANALYSIS:")
2731
+ print("\n[LEVERAGE ANALYSIS]:")
2732
2732
  try:
2733
2733
  debt_equity = client.get_debt_equity_ratio(symbol)
2734
2734
  print(f" Debt-to-Equity Ratio: {debt_equity.get('debtEquityRatio', 'N/A')}")
@@ -2742,8 +2742,102 @@ for stock in stocks:
2742
2742
  print("\n" + "="*50 + "\n")
2743
2743
  ```
2744
2744
 
2745
+ #### Advanced Market Data Analysis
2746
+
2747
+ Advanced volume and drawdown analysis:
2748
+
2749
+ ```python
2750
+ # Average Traded Volume
2751
+ volume_data = client.get_average_traded_volume(
2752
+ symbol="HDFCBANK",
2753
+ start_date="2024-04-01",
2754
+ end_date="2024-06-30",
2755
+ interval="daily"
2756
+ )
2757
+ print(f"Average Volume: {volume_data['averageVolume']} shares")
2758
+
2759
+ # Index Maximum Drawdown
2760
+ index_drawdown = client.get_index_max_drawdown(
2761
+ index_symbol="NIFTY50",
2762
+ start_date="2023-01-01",
2763
+ end_date="2024-01-01",
2764
+ interval="daily"
2765
+ )
2766
+ print(f"Max Drawdown: {index_drawdown['maxDrawdown']}%")
2767
+
2768
+ # Drawdown Duration Analysis
2769
+ drawdown_duration = client.get_drawdown_duration(
2770
+ symbol="INFY",
2771
+ start_date="2022-01-01",
2772
+ end_date="2024-01-01",
2773
+ interval="daily"
2774
+ )
2775
+ print(f"Max Drawdown Duration: {drawdown_duration['maxDrawdownDuration']} days")
2776
+ ```
2777
+
2778
+ #### Technical Price Analysis
2779
+
2780
+ Rolling price analysis and volatility:
2781
+
2782
+ ```python
2783
+ # Rolling Peak Price Analysis
2784
+ rolling_peak = client.get_rolling_peak_price(
2785
+ symbol="NSE:TCS",
2786
+ start_date="2024-01-01",
2787
+ end_date="2024-06-30",
2788
+ window=20,
2789
+ adjusted=True
2790
+ )
2791
+ print(f"Rolling peak data points: {len(rolling_peak['data'])}")
2792
+
2793
+ # Rolling Price Mean
2794
+ rolling_mean = client.get_rolling_price_mean(
2795
+ symbol="HDFCBANK",
2796
+ start_date="2024-01-01",
2797
+ end_date="2024-06-30",
2798
+ window=50,
2799
+ adjusted=True
2800
+ )
2801
+ print(f"Rolling mean data points: {len(rolling_mean['data'])}")
2802
+
2803
+ # Realized Volatility
2804
+ volatility = client.get_realized_volatility(
2805
+ symbol="NSE:ITC",
2806
+ start_date="2024-01-01",
2807
+ end_date="2024-06-30",
2808
+ adjusted=True
2809
+ )
2810
+ print(f"Realized Volatility: {volatility['realizedVolatility']}%")
2811
+ print(f"Annualized Volatility: {volatility['annualizedVolatility']}%")
2812
+ ```
2813
+
2814
+ #### Advanced Risk Metrics
2815
+
2816
+ CAMP Beta analysis:
2817
+
2818
+ ```python
2819
+ # 90-Day Beta Analysis
2820
+ beta_90d = client.get_beta_90d(
2821
+ symbol="ITC",
2822
+ benchmark="NIFTY50"
2823
+ )
2824
+ print(f"90-Day Beta: {beta_90d['beta']}")
2825
+ print(f"Correlation: {beta_90d['correlation']}")
2826
+ print(f"R-Squared: {beta_90d['rSquared']}")
2827
+
2828
+ # Custom Period Beta
2829
+ beta_custom = client.get_beta_custom_period(
2830
+ symbol="TCS",
2831
+ benchmark="NIFTY50",
2832
+ start_date="2020-01-01",
2833
+ end_date="2024-12-31"
2834
+ )
2835
+ print(f"Custom Period Beta: {beta_custom['beta']}")
2836
+ print(f"Alpha: {beta_custom['alpha']}")
2837
+ ```
2838
+
2745
2839
  **Key Features:**
2746
- - **Comprehensive Coverage**: 31+ analytics endpoints covering fundamentals, valuation, returns, market data, ownership, metrics, macro data, risk analysis, sector classification, and leverage analysis
2840
+ - **Comprehensive Coverage**: 39+ analytics endpoints covering fundamentals, valuation, returns, market data, ownership, metrics, macro data, risk analysis, sector classification, leverage analysis, and advanced technical analysis
2747
2841
  - **Fundamentals Analysis**: 9 methods including ROE, ROA, margins, ratios, book-to-market, market cap-to-sales, and cash-to-market cap
2748
2842
  - **Valuation Metrics**: P/E, P/B, EV/EBITDA, FCF yield with TTM and consolidated/standalone options
2749
2843
  - **Risk-Adjusted Metrics**: Sortino ratio, upside capture ratio, maximum drawdown, and returns volatility for comprehensive risk analysis
File without changes
File without changes