wiz-trader 0.37.0__tar.gz → 0.38.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.
- {wiz_trader-0.37.0/src/wiz_trader.egg-info → wiz_trader-0.38.0}/PKG-INFO +478 -19
- {wiz_trader-0.37.0 → wiz_trader-0.38.0}/README.md +478 -19
- {wiz_trader-0.37.0 → wiz_trader-0.38.0}/pyproject.toml +1 -1
- {wiz_trader-0.37.0 → wiz_trader-0.38.0}/src/wiz_trader/__init__.py +1 -1
- {wiz_trader-0.37.0 → wiz_trader-0.38.0}/src/wiz_trader/apis/client.py +1274 -4
- {wiz_trader-0.37.0 → wiz_trader-0.38.0/src/wiz_trader.egg-info}/PKG-INFO +478 -19
- {wiz_trader-0.37.0 → wiz_trader-0.38.0}/MANIFEST.in +0 -0
- {wiz_trader-0.37.0 → wiz_trader-0.38.0}/setup.cfg +0 -0
- {wiz_trader-0.37.0 → wiz_trader-0.38.0}/setup.py +0 -0
- {wiz_trader-0.37.0 → wiz_trader-0.38.0}/src/wiz_trader/apis/__init__.py +0 -0
- {wiz_trader-0.37.0 → wiz_trader-0.38.0}/src/wiz_trader/quotes/__init__.py +0 -0
- {wiz_trader-0.37.0 → wiz_trader-0.38.0}/src/wiz_trader/quotes/client.py +0 -0
- {wiz_trader-0.37.0 → wiz_trader-0.38.0}/src/wiz_trader.egg-info/SOURCES.txt +0 -0
- {wiz_trader-0.37.0 → wiz_trader-0.38.0}/src/wiz_trader.egg-info/dependency_links.txt +0 -0
- {wiz_trader-0.37.0 → wiz_trader-0.38.0}/src/wiz_trader.egg-info/requires.txt +0 -0
- {wiz_trader-0.37.0 → wiz_trader-0.38.0}/src/wiz_trader.egg-info/top_level.txt +0 -0
- {wiz_trader-0.37.0 → wiz_trader-0.38.0}/tests/test_apis.py +0 -0
- {wiz_trader-0.37.0 → wiz_trader-0.38.0}/tests/test_quotes.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: wiz_trader
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.38.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
|
@@ -50,6 +50,7 @@ Dynamic: requires-python
|
|
50
50
|
- [Basket Management](#basket-management)
|
51
51
|
- [Instrument Management](#instrument-management)
|
52
52
|
- [Instrument Screener](#instrument-screener)
|
53
|
+
- [Analytics API](#analytics-api)
|
53
54
|
- [Complete Examples](#wizzer-client-examples)
|
54
55
|
6. [Common Use Cases](#common-use-cases)
|
55
56
|
7. [Error Handling](#error-handling)
|
@@ -2327,6 +2328,434 @@ The `contract` field indicates the type of futures contract:
|
|
2327
2328
|
- **`mid_month`**: Next month's futures contract
|
2328
2329
|
- **`far_month`**: Month after next futures contract
|
2329
2330
|
|
2331
|
+
### Analytics API
|
2332
|
+
|
2333
|
+
The Analytics API provides comprehensive financial analysis and market data tools for stocks and indices. It includes fundamentals analysis, valuation metrics, returns calculation, market data, ownership analysis, metrics, and macro data.
|
2334
|
+
|
2335
|
+
#### Fundamentals Analysis
|
2336
|
+
|
2337
|
+
Get key financial metrics and ratios for stocks:
|
2338
|
+
|
2339
|
+
```python
|
2340
|
+
# Net Profit Margin
|
2341
|
+
margin = client.get_net_profit_margin("INFY", period="quarterly", quarter="Q1FY24")
|
2342
|
+
print(f"Net Profit Margin: {margin['netProfitMargin']}%")
|
2343
|
+
|
2344
|
+
# Return on Equity (ROE)
|
2345
|
+
roe = client.get_roe("TCS", period="annual", consolidated=True)
|
2346
|
+
print(f"ROE: {roe['roe']}%")
|
2347
|
+
|
2348
|
+
# Return on Assets (ROA)
|
2349
|
+
roa = client.get_roa("WIPRO", period="annual", consolidated=True)
|
2350
|
+
print(f"ROA: {roa['roa']}%")
|
2351
|
+
|
2352
|
+
# EBIT Margin
|
2353
|
+
ebit = client.get_ebit_margin("INFY", period="annual", consolidated=True)
|
2354
|
+
print(f"EBIT Margin: {ebit['ebitMargin']}%")
|
2355
|
+
|
2356
|
+
# Operating Cash Flow to Net Profit Ratio
|
2357
|
+
ocf_ratio = client.get_ocf_netprofit_ratio("TCS", period="annual")
|
2358
|
+
print(f"OCF/Net Profit Ratio: {ocf_ratio['ocfNetprofitRatio']}")
|
2359
|
+
|
2360
|
+
# EPS CAGR (Compound Annual Growth Rate)
|
2361
|
+
eps_cagr = client.get_eps_cagr("INFY", start_year=2019, end_year=2023)
|
2362
|
+
print(f"EPS CAGR (2019-2023): {eps_cagr['epsCagr']}%")
|
2363
|
+
|
2364
|
+
# Book to Market Ratio
|
2365
|
+
btm = client.get_book_to_market("NSE:INFY", as_of="2024-03-31")
|
2366
|
+
print(f"Book to Market: {btm['bookToMarket']}")
|
2367
|
+
|
2368
|
+
# Market Cap to Sales Ratio
|
2369
|
+
mts = client.get_marketcap_to_sales("RELIANCE", as_of="2024-03-31")
|
2370
|
+
print(f"Market Cap to Sales: {mts['marketcapToSales']}")
|
2371
|
+
|
2372
|
+
# Cash to Market Cap Ratio
|
2373
|
+
ctm = client.get_cash_to_marketcap("TCS", as_of="2024-03-31")
|
2374
|
+
print(f"Cash to Market Cap: {ctm['cashToMarketcap']}")
|
2375
|
+
```
|
2376
|
+
|
2377
|
+
#### Valuation Metrics
|
2378
|
+
|
2379
|
+
Get key valuation ratios:
|
2380
|
+
|
2381
|
+
```python
|
2382
|
+
# Price to Earnings (P/E) Ratio
|
2383
|
+
pe = client.get_pe_ratio("RELIANCE", date="2024-12-31", ttm=False, consolidated=True)
|
2384
|
+
print(f"P/E Ratio: {pe['peRatio']}")
|
2385
|
+
|
2386
|
+
# Price to Book (P/B) Ratio
|
2387
|
+
pb = client.get_pb_ratio("HDFC", date="2024-12-31", consolidated=True)
|
2388
|
+
print(f"P/B Ratio: {pb['pbRatio']}")
|
2389
|
+
|
2390
|
+
# Enterprise Value to EBITDA
|
2391
|
+
ev_ebitda = client.get_ev_ebitda("TCS", date="2024-06-30", ttm=False, consolidated=True)
|
2392
|
+
print(f"EV/EBITDA: {ev_ebitda['evEbitda']}")
|
2393
|
+
|
2394
|
+
# Free Cash Flow Yield
|
2395
|
+
fcf_yield = client.get_fcf_yield("HDFCAMC", date="2024-06-30", ttm=False, consolidated=True)
|
2396
|
+
print(f"FCF Yield: {fcf_yield['fcfYield']}%")
|
2397
|
+
```
|
2398
|
+
|
2399
|
+
#### Returns Analysis
|
2400
|
+
|
2401
|
+
Calculate returns over different time periods:
|
2402
|
+
|
2403
|
+
```python
|
2404
|
+
# CAGR (Compound Annual Growth Rate)
|
2405
|
+
cagr_data = client.get_cagr(
|
2406
|
+
symbol="RELIANCE",
|
2407
|
+
start_date="2020-01-01",
|
2408
|
+
end_date="2024-01-01",
|
2409
|
+
adjusted=True
|
2410
|
+
)
|
2411
|
+
print(f"Annual CAGR: {cagr_data['cagr']}%")
|
2412
|
+
print(f"Start Price: ₹{cagr_data['startPrice']}")
|
2413
|
+
print(f"End Price: ₹{cagr_data['endPrice']}")
|
2414
|
+
|
2415
|
+
# Quarterly Returns
|
2416
|
+
quarterly_returns = client.get_quarterly_returns(
|
2417
|
+
symbol="INFY",
|
2418
|
+
start_date="2024-01-01",
|
2419
|
+
end_date="2024-12-31",
|
2420
|
+
adjusted=True
|
2421
|
+
)
|
2422
|
+
|
2423
|
+
# Monthly Returns
|
2424
|
+
monthly_returns = client.get_monthly_returns(
|
2425
|
+
symbol="TCS",
|
2426
|
+
start_date="2024-01-01",
|
2427
|
+
end_date="2024-12-31",
|
2428
|
+
adjusted=True
|
2429
|
+
)
|
2430
|
+
```
|
2431
|
+
|
2432
|
+
#### Market Data
|
2433
|
+
|
2434
|
+
Get historical price data and market capitalization:
|
2435
|
+
|
2436
|
+
```python
|
2437
|
+
# Daily OHLCV Data
|
2438
|
+
ohlcv_data = client.get_analytics_ohlcv_daily(
|
2439
|
+
symbol="RELIANCE",
|
2440
|
+
start_date="2024-01-01",
|
2441
|
+
end_date="2024-01-31",
|
2442
|
+
adjusted=True
|
2443
|
+
)
|
2444
|
+
print(f"Retrieved {len(ohlcv_data['data'])} days of data")
|
2445
|
+
|
2446
|
+
# Historical Prices (same as OHLCV)
|
2447
|
+
historical_prices = client.get_analytics_historical_prices(
|
2448
|
+
symbol="SBIN",
|
2449
|
+
start_date="2024-01-01",
|
2450
|
+
end_date="2024-01-31",
|
2451
|
+
adjusted=True
|
2452
|
+
)
|
2453
|
+
|
2454
|
+
# Free-Float Market Capitalization
|
2455
|
+
free_float_mcap = client.get_free_float_market_cap("RELIANCE", date="2024-07-31")
|
2456
|
+
print(f"Free-Float Market Cap: ₹{free_float_mcap['freeFloatMarketCap']} Crores")
|
2457
|
+
print(f"Total Market Cap: ₹{free_float_mcap['marketCap']} Crores")
|
2458
|
+
print(f"Promoter Holding: {free_float_mcap['promoterHoldingPercent']}%")
|
2459
|
+
|
2460
|
+
# Index OHLC Daily Data
|
2461
|
+
index_data = client.get_index_ohlc_daily(
|
2462
|
+
symbol="NIFTY50",
|
2463
|
+
start_date="2024-01-01",
|
2464
|
+
end_date="2024-01-31"
|
2465
|
+
)
|
2466
|
+
print(f"Retrieved {len(index_data['data'])} days of index data")
|
2467
|
+
```
|
2468
|
+
|
2469
|
+
#### Ownership Analysis
|
2470
|
+
|
2471
|
+
Analyze institutional holdings and their changes:
|
2472
|
+
|
2473
|
+
```python
|
2474
|
+
# FII and DII Holdings
|
2475
|
+
fii_dii = client.get_fii_dii_holdings("RELIANCE", quarter="Q4FY23")
|
2476
|
+
print(f"FII Holdings: {fii_dii['fiiPercent']}%")
|
2477
|
+
print(f"DII Holdings: {fii_dii['diiPercent']}%")
|
2478
|
+
|
2479
|
+
# FII Change from Previous Quarter
|
2480
|
+
fii_change = client.get_fii_change("INFY")
|
2481
|
+
print(f"FII Change: {fii_change['fiiChange']}%")
|
2482
|
+
print(f"Current FII: {fii_change['currentFii']}%")
|
2483
|
+
print(f"Previous FII: {fii_change['previousFii']}%")
|
2484
|
+
|
2485
|
+
# DII Change from Previous Quarter
|
2486
|
+
dii_change = client.get_dii_change("INFY")
|
2487
|
+
print(f"DII Change: {dii_change['diiChange']}%")
|
2488
|
+
print(f"Current DII: {dii_change['currentDii']}%")
|
2489
|
+
print(f"Previous DII: {dii_change['previousDii']}%")
|
2490
|
+
```
|
2491
|
+
|
2492
|
+
#### Metrics (Risk-Adjusted Performance)
|
2493
|
+
|
2494
|
+
Get risk-adjusted performance metrics:
|
2495
|
+
|
2496
|
+
```python
|
2497
|
+
# Sortino Ratio
|
2498
|
+
sortino = client.get_sortino_ratio(
|
2499
|
+
symbol="HDFCBANK",
|
2500
|
+
start_date="2024-01-01",
|
2501
|
+
end_date="2024-12-31",
|
2502
|
+
rf=0.065,
|
2503
|
+
interval="daily"
|
2504
|
+
)
|
2505
|
+
print(f"Sortino Ratio: {sortino['sortinoRatio']}")
|
2506
|
+
print(f"Annualized Return: {sortino['annualizedReturn']}")
|
2507
|
+
print(f"Downside Deviation: {sortino['downsideDeviation']}")
|
2508
|
+
|
2509
|
+
# Upside Capture Ratio
|
2510
|
+
upside_capture = client.get_upside_capture(
|
2511
|
+
symbol="ICICIBANK",
|
2512
|
+
benchmark_symbol="NIFTY50",
|
2513
|
+
start_date="2024-01-01",
|
2514
|
+
end_date="2024-12-31"
|
2515
|
+
)
|
2516
|
+
print(f"Upside Capture Ratio: {upside_capture['upsideCaptureRatio']}%")
|
2517
|
+
print(f"Periods Analyzed: {upside_capture['periodsAnalyzed']}")
|
2518
|
+
```
|
2519
|
+
|
2520
|
+
#### Macro Economic Data
|
2521
|
+
|
2522
|
+
Get macroeconomic indicators:
|
2523
|
+
|
2524
|
+
```python
|
2525
|
+
# Risk-Free Rate
|
2526
|
+
risk_free_rate = client.get_risk_free_rate(
|
2527
|
+
start_date="2024-01-01",
|
2528
|
+
end_date="2024-12-31",
|
2529
|
+
tenor="10Y",
|
2530
|
+
country="IN",
|
2531
|
+
method="average"
|
2532
|
+
)
|
2533
|
+
print(f"Risk-Free Rate (10Y): {risk_free_rate['riskFreeRate']}")
|
2534
|
+
print(f"Country: {risk_free_rate['country']}")
|
2535
|
+
print(f"Source: {risk_free_rate['source']}")
|
2536
|
+
```
|
2537
|
+
|
2538
|
+
#### Risk Analysis
|
2539
|
+
|
2540
|
+
Get risk metrics and volatility measures:
|
2541
|
+
|
2542
|
+
```python
|
2543
|
+
# Maximum Drawdown (Peak-to-trough decline)
|
2544
|
+
max_drawdown = client.get_max_drawdown(
|
2545
|
+
symbol="RELIANCE",
|
2546
|
+
start_date="2024-01-01",
|
2547
|
+
end_date="2024-12-31"
|
2548
|
+
)
|
2549
|
+
print(f"Maximum Drawdown: {max_drawdown['maxDrawdown']}%")
|
2550
|
+
print(f"Drawdown Start Date: {max_drawdown['drawdownStartDate']}")
|
2551
|
+
print(f"Drawdown End Date: {max_drawdown['drawdownEndDate']}")
|
2552
|
+
print(f"Days in Drawdown: {max_drawdown['daysInDrawdown']}")
|
2553
|
+
|
2554
|
+
# Returns Volatility (Standard Deviation)
|
2555
|
+
volatility = client.get_returns_volatility(
|
2556
|
+
symbol="NIFTY50",
|
2557
|
+
start_date="2024-01-01",
|
2558
|
+
end_date="2024-12-31",
|
2559
|
+
interval="daily"
|
2560
|
+
)
|
2561
|
+
print(f"Volatility (Daily): {volatility['volatility']}%")
|
2562
|
+
print(f"Annualized Volatility: {volatility['annualizedVolatility']}%")
|
2563
|
+
print(f"Mean Return: {volatility['meanReturn']}%")
|
2564
|
+
```
|
2565
|
+
|
2566
|
+
#### Sector Classification
|
2567
|
+
|
2568
|
+
Get comprehensive sector and industry classification:
|
2569
|
+
|
2570
|
+
```python
|
2571
|
+
# Complete Sector Classification Data
|
2572
|
+
sector_data = client.get_sector_classification("RELIANCE")
|
2573
|
+
print(f"Company: {sector_data['companyName']}")
|
2574
|
+
print(f"Sector: {sector_data['sector']}")
|
2575
|
+
print(f"Industry: {sector_data['industry']}")
|
2576
|
+
print(f"Sub-Industry: {sector_data['subIndustry']}")
|
2577
|
+
print(f"GICS Sector Code: {sector_data['gicsSectorCode']}")
|
2578
|
+
print(f"Industry Group: {sector_data['industryGroup']}")
|
2579
|
+
print(f"Market Cap Tier: {sector_data['marketCapTier']}")
|
2580
|
+
```
|
2581
|
+
|
2582
|
+
#### Leverage Analysis
|
2583
|
+
|
2584
|
+
Analyze financial leverage and debt ratios:
|
2585
|
+
|
2586
|
+
```python
|
2587
|
+
# Debt-to-Equity Ratio
|
2588
|
+
debt_equity = client.get_debt_equity_ratio(
|
2589
|
+
symbol="RELIANCE",
|
2590
|
+
period="annual",
|
2591
|
+
consolidated=True
|
2592
|
+
)
|
2593
|
+
print(f"Debt-to-Equity Ratio: {debt_equity['debtEquityRatio']}")
|
2594
|
+
print(f"Total Debt: ₹{debt_equity['totalDebt']} Crores")
|
2595
|
+
print(f"Total Equity: ₹{debt_equity['totalEquity']} Crores")
|
2596
|
+
print(f"Period: {debt_equity['period']}")
|
2597
|
+
print(f"Data Date: {debt_equity['dataDate']}")
|
2598
|
+
```
|
2599
|
+
|
2600
|
+
#### Advanced Returns Analysis
|
2601
|
+
|
2602
|
+
Calculate compound annual growth rates:
|
2603
|
+
|
2604
|
+
```python
|
2605
|
+
# CAGR (Compound Annual Growth Rate)
|
2606
|
+
cagr = client.get_cagr(
|
2607
|
+
symbol="TCS",
|
2608
|
+
start_date="2020-01-01",
|
2609
|
+
end_date="2024-01-01",
|
2610
|
+
adjusted=True
|
2611
|
+
)
|
2612
|
+
print(f"CAGR (4-Year): {cagr['cagr']}%")
|
2613
|
+
print(f"Total Return: {cagr['totalReturn']}%")
|
2614
|
+
print(f"Start Price: ₹{cagr['startPrice']}")
|
2615
|
+
print(f"End Price: ₹{cagr['endPrice']}")
|
2616
|
+
print(f"Years: {cagr['years']}")
|
2617
|
+
```
|
2618
|
+
|
2619
|
+
#### Complete Analytics Example
|
2620
|
+
|
2621
|
+
Here's a comprehensive example that combines multiple analytics features:
|
2622
|
+
|
2623
|
+
```python
|
2624
|
+
from wiz_trader import WizzerClient
|
2625
|
+
|
2626
|
+
def analyze_stock(symbol):
|
2627
|
+
client = WizzerClient(
|
2628
|
+
base_url="https://api-url.in",
|
2629
|
+
token="your-jwt-token"
|
2630
|
+
)
|
2631
|
+
|
2632
|
+
print(f"=== Analysis for {symbol} ===\n")
|
2633
|
+
|
2634
|
+
# Fundamentals
|
2635
|
+
print("📊 FUNDAMENTALS:")
|
2636
|
+
try:
|
2637
|
+
margin = client.get_net_profit_margin(symbol)
|
2638
|
+
print(f" Net Profit Margin: {margin.get('netProfitMargin', 'N/A')}%")
|
2639
|
+
|
2640
|
+
roe = client.get_roe(symbol)
|
2641
|
+
print(f" ROE: {roe.get('roe', 'N/A')}%")
|
2642
|
+
|
2643
|
+
roa = client.get_roa(symbol)
|
2644
|
+
print(f" ROA: {roa.get('roa', 'N/A')}%")
|
2645
|
+
|
2646
|
+
eps_cagr = client.get_eps_cagr(symbol, start_year=2019, end_year=2023)
|
2647
|
+
print(f" EPS CAGR (5Y): {eps_cagr.get('epsCagr', 'N/A')}%")
|
2648
|
+
except Exception as e:
|
2649
|
+
print(f" Error fetching fundamentals: {e}")
|
2650
|
+
|
2651
|
+
# Valuation
|
2652
|
+
print("\n💰 VALUATION:")
|
2653
|
+
try:
|
2654
|
+
pe = client.get_pe_ratio(symbol)
|
2655
|
+
print(f" P/E Ratio: {pe.get('peRatio', 'N/A')}")
|
2656
|
+
|
2657
|
+
pb = client.get_pb_ratio(symbol)
|
2658
|
+
print(f" P/B Ratio: {pb.get('pbRatio', 'N/A')}")
|
2659
|
+
|
2660
|
+
ev_ebitda = client.get_ev_ebitda(symbol)
|
2661
|
+
print(f" EV/EBITDA: {ev_ebitda.get('evEbitda', 'N/A')}")
|
2662
|
+
except Exception as e:
|
2663
|
+
print(f" Error fetching valuation: {e}")
|
2664
|
+
|
2665
|
+
# Returns
|
2666
|
+
print("\n📈 RETURNS:")
|
2667
|
+
try:
|
2668
|
+
cagr_data = client.get_cagr(
|
2669
|
+
symbol=symbol,
|
2670
|
+
start_date="2020-01-01",
|
2671
|
+
end_date="2024-01-01"
|
2672
|
+
)
|
2673
|
+
print(f" 4-Year CAGR: {cagr_data.get('cagr', 'N/A')}%")
|
2674
|
+
print(f" Start Price: ₹{cagr_data.get('startPrice', 'N/A')}")
|
2675
|
+
print(f" End Price: ₹{cagr_data.get('endPrice', 'N/A')}")
|
2676
|
+
except Exception as e:
|
2677
|
+
print(f" Error fetching returns: {e}")
|
2678
|
+
|
2679
|
+
# Ownership
|
2680
|
+
print("\n🏛️ OWNERSHIP:")
|
2681
|
+
try:
|
2682
|
+
fii_dii = client.get_fii_dii_holdings(symbol)
|
2683
|
+
print(f" FII Holdings: {fii_dii.get('fiiPercent', 'N/A')}%")
|
2684
|
+
print(f" DII Holdings: {fii_dii.get('diiPercent', 'N/A')}%")
|
2685
|
+
|
2686
|
+
fii_change = client.get_fii_change(symbol)
|
2687
|
+
print(f" FII Change: {fii_change.get('fiiChange', 'N/A')}%")
|
2688
|
+
except Exception as e:
|
2689
|
+
print(f" Error fetching ownership: {e}")
|
2690
|
+
|
2691
|
+
# Market Cap
|
2692
|
+
print("\n🏢 MARKET DATA:")
|
2693
|
+
try:
|
2694
|
+
mcap = client.get_free_float_market_cap(symbol)
|
2695
|
+
print(f" Market Cap: ₹{mcap.get('marketCap', 'N/A')} Crores")
|
2696
|
+
print(f" Free-Float Market Cap: ₹{mcap.get('freeFloatMarketCap', 'N/A')} Crores")
|
2697
|
+
print(f" Promoter Holding: {mcap.get('promoterHoldingPercent', 'N/A')}%")
|
2698
|
+
except Exception as e:
|
2699
|
+
print(f" Error fetching market data: {e}")
|
2700
|
+
|
2701
|
+
# Risk Analysis
|
2702
|
+
print("\n⚠️ RISK ANALYSIS:")
|
2703
|
+
try:
|
2704
|
+
max_drawdown = client.get_max_drawdown(
|
2705
|
+
symbol=symbol,
|
2706
|
+
start_date="2024-01-01",
|
2707
|
+
end_date="2024-12-31"
|
2708
|
+
)
|
2709
|
+
print(f" Maximum Drawdown: {max_drawdown.get('maxDrawdown', 'N/A')}%")
|
2710
|
+
|
2711
|
+
volatility = client.get_returns_volatility(
|
2712
|
+
symbol=symbol,
|
2713
|
+
start_date="2024-01-01",
|
2714
|
+
end_date="2024-12-31"
|
2715
|
+
)
|
2716
|
+
print(f" Returns Volatility: {volatility.get('volatility', 'N/A')}%")
|
2717
|
+
except Exception as e:
|
2718
|
+
print(f" Error fetching risk metrics: {e}")
|
2719
|
+
|
2720
|
+
# Sector Classification
|
2721
|
+
print("\n🏭 SECTOR CLASSIFICATION:")
|
2722
|
+
try:
|
2723
|
+
sector = client.get_sector_classification(symbol)
|
2724
|
+
print(f" Sector: {sector.get('sector', 'N/A')}")
|
2725
|
+
print(f" Industry: {sector.get('industry', 'N/A')}")
|
2726
|
+
print(f" Market Cap Tier: {sector.get('marketCapTier', 'N/A')}")
|
2727
|
+
except Exception as e:
|
2728
|
+
print(f" Error fetching sector data: {e}")
|
2729
|
+
|
2730
|
+
# Leverage Analysis
|
2731
|
+
print("\n💳 LEVERAGE ANALYSIS:")
|
2732
|
+
try:
|
2733
|
+
debt_equity = client.get_debt_equity_ratio(symbol)
|
2734
|
+
print(f" Debt-to-Equity Ratio: {debt_equity.get('debtEquityRatio', 'N/A')}")
|
2735
|
+
except Exception as e:
|
2736
|
+
print(f" Error fetching leverage metrics: {e}")
|
2737
|
+
|
2738
|
+
# Analyze multiple stocks
|
2739
|
+
stocks = ["RELIANCE", "TCS", "INFY", "HDFC", "SBIN"]
|
2740
|
+
for stock in stocks:
|
2741
|
+
analyze_stock(stock)
|
2742
|
+
print("\n" + "="*50 + "\n")
|
2743
|
+
```
|
2744
|
+
|
2745
|
+
**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
|
2747
|
+
- **Fundamentals Analysis**: 9 methods including ROE, ROA, margins, ratios, book-to-market, market cap-to-sales, and cash-to-market cap
|
2748
|
+
- **Valuation Metrics**: P/E, P/B, EV/EBITDA, FCF yield with TTM and consolidated/standalone options
|
2749
|
+
- **Risk-Adjusted Metrics**: Sortino ratio, upside capture ratio, maximum drawdown, and returns volatility for comprehensive risk analysis
|
2750
|
+
- **Sector & Industry Analysis**: Complete GICS classification with sector, industry, sub-industry, and market cap tier data
|
2751
|
+
- **Leverage Analysis**: Debt-to-equity ratios and comprehensive financial leverage metrics
|
2752
|
+
- **Institutional Analysis**: Track FII/DII holdings and their quarterly changes
|
2753
|
+
- **Returns Calculation**: Calculate CAGR over custom time periods with flexible date ranges
|
2754
|
+
- **Macro Economic Data**: Risk-free rates for various tenors and countries
|
2755
|
+
- **Index Support**: Historical OHLC data for major indices like NIFTY50, SENSEX
|
2756
|
+
- **Error Handling**: Robust error handling with comprehensive parameter validation
|
2757
|
+
- **Modern API Design**: Updated parameter names following camelCase convention
|
2758
|
+
|
2330
2759
|
### Wizzer Client Examples
|
2331
2760
|
|
2332
2761
|
#### Market Data and Analysis Example
|
@@ -3628,24 +4057,6 @@ All supported environment variables:
|
|
3628
4057
|
|
3629
4058
|
## Available Screener Fields
|
3630
4059
|
|
3631
|
-
### Historical Market Data
|
3632
|
-
|
3633
|
-
| Field | Description | Data Type | Unit | Supported Operations |
|
3634
|
-
|--- |--- |--- |--- |--- |
|
3635
|
-
| `hmdOpen` | Opening price of the trading session | Float | currency | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
3636
|
-
| `hmdHigh` | Highest price during the trading session | Float | currency | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
3637
|
-
| `hmdLow` | Lowest price during the trading session | Float | currency | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
3638
|
-
| `hmdClose` | Closing price of the trading session | Float | currency | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
3639
|
-
| `hmdLtp` | Last Traded Price | Float | currency | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
3640
|
-
| `hmdPrevClose` | Previous day closing price | Float | currency | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
3641
|
-
| `hmdVolume` | Trading volume (number of shares traded) | UInt64 | shares | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
3642
|
-
| `hmdTurnover` | Trading turnover (total value of shares traded) | Float | currency | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
3643
|
-
| `hmdTotalTrades` | Total number of trades executed | UInt64 | count | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
3644
|
-
| `hmdPriceBandLower` | Lower price band limit | Float | currency | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
3645
|
-
| `hmdPriceBandUpper` | Upper price band limit | Float | currency | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
3646
|
-
| `hmdDate` | Trading date | Date | - | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
3647
|
-
| `MarketCap` | Logarithm of Market Capitalization | Float64 | log_currency | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
3648
|
-
|
3649
4060
|
### Instrument Properties
|
3650
4061
|
|
3651
4062
|
| Field | Description | Data Type | Supported Operations |
|
@@ -3689,6 +4100,7 @@ All supported environment variables:
|
|
3689
4100
|
| `grossNpaRatioAnnual` | Gross NPA Ratio - annual | Float64 | % | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
3690
4101
|
| `netNpaRatioQuarterly` | Net NPA Ratio - quarterly | Float64 | % | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
3691
4102
|
| `netNpaRatioAnnual` | Net NPA Ratio - annual | Float64 | % | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
4103
|
+
| `gnpaPct` | Gross Non-Performing Assets Percentage | Float | % | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
3692
4104
|
|
3693
4105
|
### Capital Adequacy
|
3694
4106
|
| Field | Description | Data Type | Unit | Supported Operations |
|
@@ -3745,6 +4157,8 @@ All supported environment variables:
|
|
3745
4157
|
### Total Assets & Equity
|
3746
4158
|
| Field | Description | Data Type | Unit | Supported Operations |
|
3747
4159
|
|--- |--- |--- |--- |--- |
|
4160
|
+
| `bookValue` | Book Value | Nullable(Float64) | currency | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
4161
|
+
| `shareholderEquity` | Shareholder Equity | Nullable(Float64) | currency | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
3748
4162
|
| `totalAssetsQuarterly` | Total Assets - quarterly | Float64 | currency | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
3749
4163
|
| `totalAssetsAnnual` | Total Assets - annual | Float64 | currency | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
3750
4164
|
| `totalEquityQuarterly` | Total Equity - quarterly | Float64 | currency | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
@@ -3754,11 +4168,18 @@ All supported environment variables:
|
|
3754
4168
|
| `totalLiabilitiesQuarterly` | Total Liabilities - quarterly | Float64 | currency | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
3755
4169
|
| `totalLiabilitiesAnnual` | Total Liabilities - annual | Float64 | currency | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
3756
4170
|
|
4171
|
+
### Debt & Cash
|
4172
|
+
| Field | Description | Data Type | Unit | Supported Operations |
|
4173
|
+
|--- |--- |--- |--- |--- |
|
4174
|
+
| `totalDebt` | Total Debt | Float64 | currency | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
4175
|
+
| `netCash` | Net Cash (Cash - Total Debt) | Float64 | currency | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
4176
|
+
|
3757
4177
|
## Income Statement Items
|
3758
4178
|
|
3759
4179
|
### Revenue & Income
|
3760
4180
|
| Field | Description | Data Type | Unit | Supported Operations |
|
3761
4181
|
|--- |--- |--- |--- |--- |
|
4182
|
+
| `revenue` | Total Revenue | Nullable(Float64) | currency | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
3762
4183
|
| `revenueOperationsQuarterly` | Revenue from Operations - quarterly | Float64 | currency | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
3763
4184
|
| `revenueOperationsAnnual` | Revenue from Operations - annual | Float64 | currency | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
3764
4185
|
| `otherIncomeQuarterly` | Other Income - quarterly | Float64 | currency | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
@@ -3795,6 +4216,7 @@ All supported environment variables:
|
|
3795
4216
|
| `deferredTaxAnnual` | Deferred Tax - annual | Float64 | currency | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
3796
4217
|
| `taxExpenseQuarterly` | Tax Expense - quarterly | Float64 | currency | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
3797
4218
|
| `taxExpenseAnnual` | Tax Expense - annual | Float64 | currency | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
4219
|
+
| `netIncome` | Net Income | Nullable(Float64) | currency | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
3798
4220
|
| `netProfitQuarterly` | Net Profit - quarterly | Float64 | currency | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
3799
4221
|
| `netProfitAnnual` | Net Profit - annual | Float64 | currency | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
3800
4222
|
|
@@ -3841,6 +4263,7 @@ All supported environment variables:
|
|
3841
4263
|
### Net Cash Changes
|
3842
4264
|
| Field | Description | Data Type | Unit | Supported Operations |
|
3843
4265
|
|--- |--- |--- |--- |--- |
|
4266
|
+
| `freeCashFlow` | Free Cash Flow | Nullable(Float64) | currency | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
3844
4267
|
| `netCashChangeQuarterly` | Net Cash Change - quarterly | Float64 | currency | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
3845
4268
|
| `netCashChangeAnnual` | Net Cash Change - annual | Float64 | currency | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
3846
4269
|
| `cashCashflowStmtQuarterly` | Cash from Cashflow Statement - quarterly | Float64 | currency | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
@@ -3908,6 +4331,14 @@ All supported environment variables:
|
|
3908
4331
|
| `interestCoverageRatioQuarterly` | Interest Coverage Ratio - quarterly | Float64 | ratio | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
3909
4332
|
| `interestCoverageRatioAnnual` | Interest Coverage Ratio - annual | Float64 | ratio | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
3910
4333
|
|
4334
|
+
### Valuation Ratios
|
4335
|
+
| Field | Description | Data Type | Unit | Supported Operations |
|
4336
|
+
|--- |--- |--- |--- |--- |
|
4337
|
+
| `peRatio` | Price to Earnings Ratio | Float | ratio | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
4338
|
+
| `pbRatio` | Price to Book Ratio | Float | ratio | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
4339
|
+
| `evEbitda` | Enterprise Value to EBITDA | Float | ratio | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
4340
|
+
| `fcfYield` | Free Cash Flow Yield | Float | % | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
4341
|
+
|
3911
4342
|
### Profitability Ratios
|
3912
4343
|
| Field | Description | Data Type | Unit | Supported Operations |
|
3913
4344
|
|--- |--- |--- |--- |--- |
|
@@ -3915,14 +4346,41 @@ All supported environment variables:
|
|
3915
4346
|
| `basicEpsAnnual` | Basic EPS - annual | Float64 | currency | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
3916
4347
|
| `dilutedEpsQuarterly` | Diluted EPS - quarterly | Float64 | currency | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
3917
4348
|
| `dilutedEpsAnnual` | Diluted EPS - annual | Float64 | currency | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
4349
|
+
| `roe` | Return on Equity | Nullable(Float32) | % | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
4350
|
+
| `roa` | Return on Assets | Nullable(Float32) | % | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
4351
|
+
| `ebitda` | Earnings Before Interest, Taxes, Depreciation, and Amortization | Nullable(Float64) | currency | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
4352
|
+
| `ebitMargin` | Earnings Before Interest and Taxes Margin | Nullable(Float32) | % | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
4353
|
+
| `EPS` | Earnings Per Share | Nullable(Float64) | currency | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
4354
|
+
| `epsCagr` | EPS Compounded Annual Growth Rate | Float | % | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
3918
4355
|
|
3919
4356
|
### Efficiency Ratios
|
3920
4357
|
| Field | Description | Data Type | Unit | Supported Operations |
|
3921
4358
|
|--- |--- |--- |--- |--- |
|
3922
4359
|
| `assetTurnover` | Asset Turnover Ratio | Float | ratio | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
3923
4360
|
| `currentRatio` | Current Ratio | Float | ratio | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
4361
|
+
| `ocfNPRatio` | Operating Cash Flow to Net Profit Ratio | Nullable(Float64) | ratio | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
3924
4362
|
| `ocfPat` | Operating Cash Flow to PAT Ratio | Float | ratio | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
3925
4363
|
|
4364
|
+
### Shareholding Patterns
|
4365
|
+
|
4366
|
+
#### Current Holdings
|
4367
|
+
| Field | Description | Data Type | Unit | Supported Operations |
|
4368
|
+
|--- |--- |--- |--- |--- |
|
4369
|
+
| `currentFiiHoldings` | Current FII holdings percentage (latest quarter) | Float64 | % | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
4370
|
+
| `currentDiiHoldings` | Current DII holdings percentage (latest quarter) | Float64 | % | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
4371
|
+
| `currentPromoterHoldings` | Current Promoter holdings percentage (latest quarter) | Float64 | % | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
4372
|
+
| `currentInstitutionalHoldings` | Current total institutional holdings percentage (latest quarter) | Float64 | % | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
4373
|
+
| `freeFloatPercentage` | Free float percentage (latest quarter) | Float64 | % | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
4374
|
+
| `freeFloatMarketCap` | Free-float market capitalization (latest trading day) | Float64 | currency | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
4375
|
+
|
4376
|
+
#### Quarter-on-Quarter Changes
|
4377
|
+
| Field | Description | Data Type | Unit | Supported Operations |
|
4378
|
+
|--- |--- |--- |--- |--- |
|
4379
|
+
| `qoqInstitutionalChange` | Quarter-on-quarter change in institutional holdings (%) | Float64 | % | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
4380
|
+
| `qoqFiiChange` | Quarter-on-quarter change in FII holdings (%) | Float64 | % | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
4381
|
+
| `qoqDiiChange` | Quarter-on-quarter change in DII holdings (%) | Float64 | % | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
4382
|
+
| `qoqPromoterChange` | Quarter-on-quarter change in Promoter holdings (%) | Float64 | % | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
4383
|
+
|
3926
4384
|
## Segment Analysis
|
3927
4385
|
|
3928
4386
|
### Segment Financial Data
|
@@ -3953,6 +4411,7 @@ All supported environment variables:
|
|
3953
4411
|
| `hmdPriceBandLower` | Lower price band limit | Float | currency | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
3954
4412
|
| `hmdPriceBandUpper` | Upper price band limit | Float | currency | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
3955
4413
|
| `hmdDate` | Trading date | Date | - | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
4414
|
+
| `MarketCap` | Logarithm of Market Capitalization | Float64 | log_currency | `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$between` |
|
3956
4415
|
|
3957
4416
|
### Supported Operations
|
3958
4417
|
|