wiz-trader 0.39.0__tar.gz → 0.41.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.39.0/src/wiz_trader.egg-info → wiz_trader-0.41.0}/PKG-INFO +312 -2
- {wiz_trader-0.39.0 → wiz_trader-0.41.0}/README.md +311 -1
- {wiz_trader-0.39.0 → wiz_trader-0.41.0}/pyproject.toml +1 -1
- {wiz_trader-0.39.0 → wiz_trader-0.41.0}/src/wiz_trader/__init__.py +1 -1
- {wiz_trader-0.39.0 → wiz_trader-0.41.0}/src/wiz_trader/apis/client.py +404 -3
- {wiz_trader-0.39.0 → wiz_trader-0.41.0}/src/wiz_trader/quotes/client.py +28 -1
- {wiz_trader-0.39.0 → wiz_trader-0.41.0/src/wiz_trader.egg-info}/PKG-INFO +312 -2
- {wiz_trader-0.39.0 → wiz_trader-0.41.0}/MANIFEST.in +0 -0
- {wiz_trader-0.39.0 → wiz_trader-0.41.0}/setup.cfg +0 -0
- {wiz_trader-0.39.0 → wiz_trader-0.41.0}/setup.py +0 -0
- {wiz_trader-0.39.0 → wiz_trader-0.41.0}/src/wiz_trader/apis/__init__.py +0 -0
- {wiz_trader-0.39.0 → wiz_trader-0.41.0}/src/wiz_trader/quotes/__init__.py +0 -0
- {wiz_trader-0.39.0 → wiz_trader-0.41.0}/src/wiz_trader.egg-info/SOURCES.txt +0 -0
- {wiz_trader-0.39.0 → wiz_trader-0.41.0}/src/wiz_trader.egg-info/dependency_links.txt +0 -0
- {wiz_trader-0.39.0 → wiz_trader-0.41.0}/src/wiz_trader.egg-info/requires.txt +0 -0
- {wiz_trader-0.39.0 → wiz_trader-0.41.0}/src/wiz_trader.egg-info/top_level.txt +0 -0
- {wiz_trader-0.39.0 → wiz_trader-0.41.0}/tests/test_apis.py +0 -0
- {wiz_trader-0.39.0 → wiz_trader-0.41.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.41.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
|
@@ -39,6 +39,7 @@ Dynamic: requires-python
|
|
39
39
|
- [Subscribing to Instruments](#subscribing-to-instruments)
|
40
40
|
- [Unsubscribing from Instruments](#unsubscribing-from-instruments)
|
41
41
|
- [Account Events](#account-events)
|
42
|
+
- [Corporate Events](#corporate-events)
|
42
43
|
- [Handling WebSocket Connection](#handling-websocket-connection)
|
43
44
|
- [Complete Examples](#quotes-client-examples)
|
44
45
|
5. [Wizzer Client](#wizzer-client)
|
@@ -596,6 +597,196 @@ client.on_trade = strategy.on_trade_event
|
|
596
597
|
client.connect()
|
597
598
|
```
|
598
599
|
|
600
|
+
### Corporate Events
|
601
|
+
|
602
|
+
The QuotesClient supports automatic reception of corporate events from the server. These include corporate actions (dividends, stock splits, bonus issues) and corporate announcements (earnings reports, AGM notices, company announcements).
|
603
|
+
|
604
|
+
#### Corporate Event Handlers
|
605
|
+
|
606
|
+
```python
|
607
|
+
from wiz_trader import QuotesClient
|
608
|
+
|
609
|
+
def handle_corporate_action(client, event):
|
610
|
+
"""Handle corporate actions like dividends, splits, bonus issues"""
|
611
|
+
print(f"Corporate Action: {event['data']['eventText']}")
|
612
|
+
print(f"Symbol: {event['data']['tradingSymbol']}")
|
613
|
+
print(f"Date: {event['data']['date']}")
|
614
|
+
|
615
|
+
# Handle specific action categories
|
616
|
+
action_category = event['data'].get('actionCategory', '').lower()
|
617
|
+
if action_category == 'dividend':
|
618
|
+
amount = event['data'].get('primaryAmount')
|
619
|
+
print(f"Dividend Amount: ₹{amount} per share")
|
620
|
+
elif action_category == 'split':
|
621
|
+
print(f"Stock Split - Face Value Change from ₹{event['data'].get('oldFaceValue')} to ₹{event['data'].get('newFaceValue')}")
|
622
|
+
elif action_category == 'bonus':
|
623
|
+
ratio_num = event['data'].get('ratioNumerator')
|
624
|
+
ratio_den = event['data'].get('ratioDenominator')
|
625
|
+
if ratio_num and ratio_den:
|
626
|
+
print(f"Bonus Shares: {ratio_num}:{ratio_den} ratio")
|
627
|
+
|
628
|
+
def handle_corporate_announcement(client, event):
|
629
|
+
"""Handle corporate announcements like earnings, AGM notices"""
|
630
|
+
print(f"Announcement: {event['data']['announcement']}")
|
631
|
+
print(f"Symbol: {event['data']['tradingSymbol']}")
|
632
|
+
print(f"Date: {event['data']['date']}")
|
633
|
+
print(f"Event Description: {event['data']['eventsDescriptions']}")
|
634
|
+
|
635
|
+
# Check for attachment file
|
636
|
+
if 'attachmentFile' in event['data']:
|
637
|
+
print(f"Attachment: {event['data']['attachmentFile']}")
|
638
|
+
|
639
|
+
# Register corporate event handlers
|
640
|
+
client.on_corporate_action = handle_corporate_action
|
641
|
+
client.on_corporate_announcement = handle_corporate_announcement
|
642
|
+
```
|
643
|
+
|
644
|
+
#### Corporate Event Types
|
645
|
+
|
646
|
+
**Corporate Actions** (`type: 'events.corporate.actions'`):
|
647
|
+
- **Dividends**: Cash dividends, special dividends
|
648
|
+
- **Stock Splits**: Forward splits, reverse splits
|
649
|
+
- **Bonus Issues**: Bonus share distributions
|
650
|
+
- **Rights Issues**: Rights share offerings
|
651
|
+
- **Mergers & Acquisitions**: Corporate restructuring events
|
652
|
+
|
653
|
+
**Corporate Announcements** (`type: 'events.corporate.announcements'`):
|
654
|
+
- **Earnings Reports**: Quarterly and annual results
|
655
|
+
- **AGM/EGM Notices**: Annual and extraordinary general meetings
|
656
|
+
- **Board Meetings**: Board meeting announcements
|
657
|
+
- **Company Updates**: Material announcements, regulatory filings
|
658
|
+
|
659
|
+
#### Example Event Data Structures
|
660
|
+
|
661
|
+
**Corporate Action Example**:
|
662
|
+
```json
|
663
|
+
{
|
664
|
+
"data": {
|
665
|
+
"actionCategory": "dividend",
|
666
|
+
"actionSubcategory": "",
|
667
|
+
"assetClass": "sme",
|
668
|
+
"date": "19-08-2025",
|
669
|
+
"eventText": "DIVIDEND - RS 2 PER SHARE",
|
670
|
+
"events": "corporate_actions.other_corporate_action",
|
671
|
+
"eventsDescriptions": "OTHER CORPORATE ACTION",
|
672
|
+
"faceValue": 10,
|
673
|
+
"hasAgm": false,
|
674
|
+
"hasBonus": false,
|
675
|
+
"hasDividend": true,
|
676
|
+
"newFaceValue": null,
|
677
|
+
"oldFaceValue": null,
|
678
|
+
"percentageValue": null,
|
679
|
+
"primaryAmount": 2,
|
680
|
+
"ratioDenominator": null,
|
681
|
+
"ratioNumerator": null,
|
682
|
+
"secondaryAmount": null,
|
683
|
+
"series": "SM",
|
684
|
+
"tradingSymbol": "SBIN"
|
685
|
+
},
|
686
|
+
"timestamp": "2025-08-19T19:04:47.789Z",
|
687
|
+
"type": "events.corporate.actions"
|
688
|
+
}
|
689
|
+
```
|
690
|
+
|
691
|
+
**Corporate Announcement Example**:
|
692
|
+
```json
|
693
|
+
{
|
694
|
+
"data": {
|
695
|
+
"announcement": "Manglam Infra & Engineering Limited has informed the Exchange about award of Additional Work from BRO under Project Deepak, Himachal Pradesh.",
|
696
|
+
"assetClass": "sme",
|
697
|
+
"attachmentFile": "https://nsearchives.nseindia.com/corporate/MANGLAMINFRA_19082025133231_addition.pdf",
|
698
|
+
"date": "19-08-2025",
|
699
|
+
"events": "corporate_announcements.general_updates",
|
700
|
+
"eventsDescriptions": "General Updates",
|
701
|
+
"hasXbrl": false,
|
702
|
+
"industry": "",
|
703
|
+
"tradingSymbol": "SBIN"
|
704
|
+
},
|
705
|
+
"timestamp": "2025-08-19T19:04:30.511Z",
|
706
|
+
"type": "events.corporate.announcements"
|
707
|
+
}
|
708
|
+
```
|
709
|
+
|
710
|
+
#### Complete Corporate Events Example
|
711
|
+
|
712
|
+
```python
|
713
|
+
from wiz_trader import QuotesClient
|
714
|
+
from datetime import datetime
|
715
|
+
|
716
|
+
# Initialize client
|
717
|
+
client = QuotesClient(
|
718
|
+
base_url="url",
|
719
|
+
token="your-jwt-token",
|
720
|
+
log_level="info"
|
721
|
+
)
|
722
|
+
|
723
|
+
def handle_corporate_action(client, event):
|
724
|
+
"""Comprehensive corporate action handler"""
|
725
|
+
print(f"\n🏢 CORPORATE ACTION - {datetime.now()}")
|
726
|
+
data = event.get('data', {})
|
727
|
+
|
728
|
+
print(f"Symbol: {data.get('tradingSymbol')}")
|
729
|
+
print(f"Action: {data.get('eventText')}")
|
730
|
+
print(f"Date: {data.get('date')}")
|
731
|
+
print(f"Event: {data.get('eventsDescriptions')}")
|
732
|
+
print(f"Asset Class: {data.get('assetClass')}")
|
733
|
+
print(f"Face Value: ₹{data.get('faceValue')}")
|
734
|
+
|
735
|
+
# Action-specific handling based on actionCategory
|
736
|
+
action_category = data.get('actionCategory', '').lower()
|
737
|
+
if action_category == 'dividend' and data.get('hasDividend'):
|
738
|
+
amount = data.get('primaryAmount')
|
739
|
+
print(f"💰 Dividend: ₹{amount} per share")
|
740
|
+
# Implement dividend tracking logic
|
741
|
+
elif action_category == 'bonus' and data.get('hasBonus'):
|
742
|
+
ratio_num = data.get('ratioNumerator')
|
743
|
+
ratio_den = data.get('ratioDenominator')
|
744
|
+
if ratio_num and ratio_den:
|
745
|
+
print(f"🎁 Bonus Shares: {ratio_num}:{ratio_den} ratio")
|
746
|
+
# Update portfolio for bonus shares
|
747
|
+
elif action_category == 'split':
|
748
|
+
old_fv = data.get('oldFaceValue')
|
749
|
+
new_fv = data.get('newFaceValue')
|
750
|
+
if old_fv and new_fv:
|
751
|
+
print(f"📊 Stock Split: Face value changed from ₹{old_fv} to ₹{new_fv}")
|
752
|
+
# Adjust position quantities
|
753
|
+
|
754
|
+
def handle_corporate_announcement(client, event):
|
755
|
+
"""Comprehensive corporate announcement handler"""
|
756
|
+
print(f"\n📢 CORPORATE ANNOUNCEMENT - {datetime.now()}")
|
757
|
+
data = event.get('data', {})
|
758
|
+
|
759
|
+
print(f"Symbol: {data.get('tradingSymbol')}")
|
760
|
+
print(f"Announcement: {data.get('announcement')}")
|
761
|
+
print(f"Date: {data.get('date')}")
|
762
|
+
print(f"Event: {data.get('eventsDescriptions')}")
|
763
|
+
print(f"Asset Class: {data.get('assetClass')}")
|
764
|
+
|
765
|
+
# Check for attachment file
|
766
|
+
if 'attachmentFile' in data:
|
767
|
+
print(f"📎 Attachment: {data['attachmentFile']}")
|
768
|
+
|
769
|
+
# Event-specific handling based on events field
|
770
|
+
events = data.get('events', '').lower()
|
771
|
+
if 'earnings' in events or 'results' in events:
|
772
|
+
print("📈 Earnings/Results announcement detected")
|
773
|
+
# Implement earnings analysis
|
774
|
+
elif 'general_updates' in events:
|
775
|
+
print("📋 General company update")
|
776
|
+
# Handle general announcements
|
777
|
+
|
778
|
+
# Register handlers
|
779
|
+
client.on_corporate_action = handle_corporate_action
|
780
|
+
client.on_corporate_announcement = handle_corporate_announcement
|
781
|
+
|
782
|
+
# Optional: Subscribe to market data as well
|
783
|
+
instruments = ["NSE:RELIANCE-EQ", "NSE:TCS-EQ"]
|
784
|
+
client.subscribe(instruments, mode="ticks")
|
785
|
+
|
786
|
+
# Start listening for events
|
787
|
+
client.connect()
|
788
|
+
```
|
789
|
+
|
599
790
|
### Complete Examples
|
600
791
|
|
601
792
|
#### Blocking Example
|
@@ -2834,10 +3025,129 @@ beta_custom = client.get_beta_custom_period(
|
|
2834
3025
|
)
|
2835
3026
|
print(f"Custom Period Beta: {beta_custom['beta']}")
|
2836
3027
|
print(f"Alpha: {beta_custom['alpha']}")
|
3028
|
+
|
3029
|
+
# Strategy Max Drawdown
|
3030
|
+
strategy_drawdown = client.get_strategy_max_drawdown(
|
3031
|
+
strategy_id="str_01jspb8z36edjsp5pecqq0mpm3",
|
3032
|
+
start_date="2023-01-01",
|
3033
|
+
end_date="2024-12-31",
|
3034
|
+
interval="daily"
|
3035
|
+
)
|
3036
|
+
print(f"Strategy Max Drawdown: {strategy_drawdown['maxDrawdown']}")
|
3037
|
+
print(f"Peak Date: {strategy_drawdown['peakDate']}")
|
3038
|
+
|
3039
|
+
# Product Max Drawdown
|
3040
|
+
product_drawdown = client.get_product_max_drawdown(
|
3041
|
+
product_id="prd_01jyrg7ffkemq9hz3rkeznh9dr",
|
3042
|
+
start_date="2023-01-01",
|
3043
|
+
end_date="2024-12-31",
|
3044
|
+
interval="monthly"
|
3045
|
+
)
|
3046
|
+
print(f"Product Max Drawdown: {product_drawdown['maxDrawdown']}")
|
3047
|
+
|
3048
|
+
# Average True Range (ATR)
|
3049
|
+
atr_data = client.get_atr(
|
3050
|
+
symbol="AXISBANK",
|
3051
|
+
start_date="2023-01-01",
|
3052
|
+
end_date="2024-12-31",
|
3053
|
+
window=14,
|
3054
|
+
adjusted=True,
|
3055
|
+
interval="daily"
|
3056
|
+
)
|
3057
|
+
print(f"Latest ATR: {atr_data['atr'][-1]['atrValue']}")
|
3058
|
+
|
3059
|
+
# Simple Return
|
3060
|
+
simple_return = client.get_simple_return(
|
3061
|
+
symbol="NIFTY_IT",
|
3062
|
+
start_date="2023-01-01",
|
3063
|
+
end_date="2024-12-31",
|
3064
|
+
adjusted=True,
|
3065
|
+
interval="daily",
|
3066
|
+
benchmark="NIFTY 50"
|
3067
|
+
)
|
3068
|
+
print(f"Total Return: {simple_return['totalReturn']}")
|
3069
|
+
print(f"Relative Return: {simple_return['relativeReturn']}")
|
3070
|
+
|
3071
|
+
# Corporate Actions and Announcements
|
3072
|
+
corporate_events = client.get_corporate_actions_events()
|
3073
|
+
print(f"Available Corporate Action Types: {corporate_events}")
|
3074
|
+
|
3075
|
+
# Filter Corporate Actions
|
3076
|
+
corporate_actions = client.get_corporate_actions_filter(
|
3077
|
+
symbol="RELIANCE",
|
3078
|
+
events="corporate_actions.agm",
|
3079
|
+
fromDate="2024-01-01",
|
3080
|
+
toDate="2024-12-31",
|
3081
|
+
hasDividend=True,
|
3082
|
+
page=1,
|
3083
|
+
pageSize=20
|
3084
|
+
)
|
3085
|
+
print(f"Found {corporate_actions['totalCount']} corporate actions")
|
3086
|
+
|
3087
|
+
# Corporate Announcements
|
3088
|
+
announcement_events = client.get_corporate_announcements_events()
|
3089
|
+
print(f"Available Announcement Types: {announcement_events}")
|
3090
|
+
|
3091
|
+
# Filter Corporate Announcements
|
3092
|
+
announcements = client.get_corporate_announcements_filter(
|
3093
|
+
symbol="TCS",
|
3094
|
+
events="corporate_announcements.agm",
|
3095
|
+
fromDate="2024-01-01",
|
3096
|
+
toDate="2024-12-31",
|
3097
|
+
announcementContains="dividend",
|
3098
|
+
page=1,
|
3099
|
+
pageSize=10
|
3100
|
+
)
|
3101
|
+
print(f"Found {announcements['totalCount']} announcements")
|
2837
3102
|
```
|
2838
3103
|
|
3104
|
+
### Corporate Analytics API Reference
|
3105
|
+
|
3106
|
+
#### Corporate Actions Filter Parameters
|
3107
|
+
|
3108
|
+
| Parameter | Type | Required | Description | Example |
|
3109
|
+
|-----------|------|----------|-------------|----------|
|
3110
|
+
| symbol | string | No | Trading symbol to filter by | RELIANCE, TCS |
|
3111
|
+
| events | string | No | Event type to filter by | Dividend, BONUS |
|
3112
|
+
| actionCategory | string | No | Action category to filter by | DIVIDEND, BONUS, SPLIT |
|
3113
|
+
| fromDate | string (date) | No | Ex-date from (YYYY-MM-DD) | 2024-01-01 |
|
3114
|
+
| toDate | string (date) | No | Ex-date to (YYYY-MM-DD) | 2024-12-31 |
|
3115
|
+
| exchange | string | No | Exchange to filter by | NSE, BSE |
|
3116
|
+
| hasDividend | boolean | No | Filter for dividend actions | true, false |
|
3117
|
+
| hasBonus | boolean | No | Filter for bonus actions | true, false |
|
3118
|
+
| hasAgm | boolean | No | Filter for AGM actions | true, false |
|
3119
|
+
| eventTextContains | string | No | Search text within event description | bonus, dividend |
|
3120
|
+
| faceValue | number | No | Face value to filter by | 10, 1 |
|
3121
|
+
| ratioNumerator | integer | No | Ratio numerator value | 1, 2 |
|
3122
|
+
| ratioDenominator | integer | No | Ratio denominator value | 1, 10 |
|
3123
|
+
| actionSubcategory | string | No | Action subcategory to filter by | INTERIM, FINAL |
|
3124
|
+
| primaryAmount | number | No | Primary amount to filter by | 5.50, 10.00 |
|
3125
|
+
| secondaryAmount | number | No | Secondary amount to filter by | 2.50 |
|
3126
|
+
| oldFaceValue | number | No | Old face value to filter by | 10 |
|
3127
|
+
| newFaceValue | number | No | New face value to filter by | 1 |
|
3128
|
+
| page | integer | No | Page number for pagination (default: 1) | 1, 2 |
|
3129
|
+
| pageSize | integer | No | Records per page (default: 20, max: 100) | 20, 50 |
|
3130
|
+
|
3131
|
+
#### Corporate Announcements Filter Parameters
|
3132
|
+
|
3133
|
+
| Parameter | Type | Required | Description | Example |
|
3134
|
+
|-----------|------|----------|-------------|----------|
|
3135
|
+
| symbol | string | No | Trading symbol to filter by | 20MICRONS, FINCABLES |
|
3136
|
+
| events | string | No | Event type to filter by | AGM, Results Update |
|
3137
|
+
| fromDate | string (date) | No | Date from (YYYY-MM-DD) | 2012-01-01 |
|
3138
|
+
| toDate | string (date) | No | Date to (YYYY-MM-DD) | 2012-12-31 |
|
3139
|
+
| announcementDateFrom | string (date) | No | Announcement date from (YYYY-MM-DD) | 2010-01-01 |
|
3140
|
+
| announcementDateTo | string (date) | No | Announcement date to (YYYY-MM-DD) | 2010-12-31 |
|
3141
|
+
| exchange | string | No | Exchange to filter by | NSE, BSE |
|
3142
|
+
| announcementContains | string | No | Search text within announcement | dividend, merger |
|
3143
|
+
| hasXbrl | boolean | No | Filter for announcements with XBRL | true, false |
|
3144
|
+
| page | integer | No | Page number for pagination (default: 1) | 1, 2 |
|
3145
|
+
| pageSize | integer | No | Records per page (default: 20, max: 100) | 20, 50 |
|
3146
|
+
|
2839
3147
|
**Key Features:**
|
2840
|
-
- **Comprehensive Coverage**:
|
3148
|
+
- **Comprehensive Coverage**: 47+ analytics endpoints covering fundamentals, valuation, returns, market data, ownership, metrics, macro data, risk analysis, sector classification, leverage analysis, advanced technical analysis, and corporate actions/announcements
|
3149
|
+
- **Corporate Actions**: Track dividends, bonus issues, stock splits, rights issues, AGMs, and buybacks with comprehensive filtering
|
3150
|
+
- **Corporate Announcements**: Monitor board meetings, financial results, AGM notifications, and regulatory announcements with XBRL support
|
2841
3151
|
- **Fundamentals Analysis**: 9 methods including ROE, ROA, margins, ratios, book-to-market, market cap-to-sales, and cash-to-market cap
|
2842
3152
|
- **Valuation Metrics**: P/E, P/B, EV/EBITDA, FCF yield with TTM and consolidated/standalone options
|
2843
3153
|
- **Risk-Adjusted Metrics**: Sortino ratio, upside capture ratio, maximum drawdown, and returns volatility for comprehensive risk analysis
|
@@ -12,6 +12,7 @@
|
|
12
12
|
- [Subscribing to Instruments](#subscribing-to-instruments)
|
13
13
|
- [Unsubscribing from Instruments](#unsubscribing-from-instruments)
|
14
14
|
- [Account Events](#account-events)
|
15
|
+
- [Corporate Events](#corporate-events)
|
15
16
|
- [Handling WebSocket Connection](#handling-websocket-connection)
|
16
17
|
- [Complete Examples](#quotes-client-examples)
|
17
18
|
5. [Wizzer Client](#wizzer-client)
|
@@ -569,6 +570,196 @@ client.on_trade = strategy.on_trade_event
|
|
569
570
|
client.connect()
|
570
571
|
```
|
571
572
|
|
573
|
+
### Corporate Events
|
574
|
+
|
575
|
+
The QuotesClient supports automatic reception of corporate events from the server. These include corporate actions (dividends, stock splits, bonus issues) and corporate announcements (earnings reports, AGM notices, company announcements).
|
576
|
+
|
577
|
+
#### Corporate Event Handlers
|
578
|
+
|
579
|
+
```python
|
580
|
+
from wiz_trader import QuotesClient
|
581
|
+
|
582
|
+
def handle_corporate_action(client, event):
|
583
|
+
"""Handle corporate actions like dividends, splits, bonus issues"""
|
584
|
+
print(f"Corporate Action: {event['data']['eventText']}")
|
585
|
+
print(f"Symbol: {event['data']['tradingSymbol']}")
|
586
|
+
print(f"Date: {event['data']['date']}")
|
587
|
+
|
588
|
+
# Handle specific action categories
|
589
|
+
action_category = event['data'].get('actionCategory', '').lower()
|
590
|
+
if action_category == 'dividend':
|
591
|
+
amount = event['data'].get('primaryAmount')
|
592
|
+
print(f"Dividend Amount: ₹{amount} per share")
|
593
|
+
elif action_category == 'split':
|
594
|
+
print(f"Stock Split - Face Value Change from ₹{event['data'].get('oldFaceValue')} to ₹{event['data'].get('newFaceValue')}")
|
595
|
+
elif action_category == 'bonus':
|
596
|
+
ratio_num = event['data'].get('ratioNumerator')
|
597
|
+
ratio_den = event['data'].get('ratioDenominator')
|
598
|
+
if ratio_num and ratio_den:
|
599
|
+
print(f"Bonus Shares: {ratio_num}:{ratio_den} ratio")
|
600
|
+
|
601
|
+
def handle_corporate_announcement(client, event):
|
602
|
+
"""Handle corporate announcements like earnings, AGM notices"""
|
603
|
+
print(f"Announcement: {event['data']['announcement']}")
|
604
|
+
print(f"Symbol: {event['data']['tradingSymbol']}")
|
605
|
+
print(f"Date: {event['data']['date']}")
|
606
|
+
print(f"Event Description: {event['data']['eventsDescriptions']}")
|
607
|
+
|
608
|
+
# Check for attachment file
|
609
|
+
if 'attachmentFile' in event['data']:
|
610
|
+
print(f"Attachment: {event['data']['attachmentFile']}")
|
611
|
+
|
612
|
+
# Register corporate event handlers
|
613
|
+
client.on_corporate_action = handle_corporate_action
|
614
|
+
client.on_corporate_announcement = handle_corporate_announcement
|
615
|
+
```
|
616
|
+
|
617
|
+
#### Corporate Event Types
|
618
|
+
|
619
|
+
**Corporate Actions** (`type: 'events.corporate.actions'`):
|
620
|
+
- **Dividends**: Cash dividends, special dividends
|
621
|
+
- **Stock Splits**: Forward splits, reverse splits
|
622
|
+
- **Bonus Issues**: Bonus share distributions
|
623
|
+
- **Rights Issues**: Rights share offerings
|
624
|
+
- **Mergers & Acquisitions**: Corporate restructuring events
|
625
|
+
|
626
|
+
**Corporate Announcements** (`type: 'events.corporate.announcements'`):
|
627
|
+
- **Earnings Reports**: Quarterly and annual results
|
628
|
+
- **AGM/EGM Notices**: Annual and extraordinary general meetings
|
629
|
+
- **Board Meetings**: Board meeting announcements
|
630
|
+
- **Company Updates**: Material announcements, regulatory filings
|
631
|
+
|
632
|
+
#### Example Event Data Structures
|
633
|
+
|
634
|
+
**Corporate Action Example**:
|
635
|
+
```json
|
636
|
+
{
|
637
|
+
"data": {
|
638
|
+
"actionCategory": "dividend",
|
639
|
+
"actionSubcategory": "",
|
640
|
+
"assetClass": "sme",
|
641
|
+
"date": "19-08-2025",
|
642
|
+
"eventText": "DIVIDEND - RS 2 PER SHARE",
|
643
|
+
"events": "corporate_actions.other_corporate_action",
|
644
|
+
"eventsDescriptions": "OTHER CORPORATE ACTION",
|
645
|
+
"faceValue": 10,
|
646
|
+
"hasAgm": false,
|
647
|
+
"hasBonus": false,
|
648
|
+
"hasDividend": true,
|
649
|
+
"newFaceValue": null,
|
650
|
+
"oldFaceValue": null,
|
651
|
+
"percentageValue": null,
|
652
|
+
"primaryAmount": 2,
|
653
|
+
"ratioDenominator": null,
|
654
|
+
"ratioNumerator": null,
|
655
|
+
"secondaryAmount": null,
|
656
|
+
"series": "SM",
|
657
|
+
"tradingSymbol": "SBIN"
|
658
|
+
},
|
659
|
+
"timestamp": "2025-08-19T19:04:47.789Z",
|
660
|
+
"type": "events.corporate.actions"
|
661
|
+
}
|
662
|
+
```
|
663
|
+
|
664
|
+
**Corporate Announcement Example**:
|
665
|
+
```json
|
666
|
+
{
|
667
|
+
"data": {
|
668
|
+
"announcement": "Manglam Infra & Engineering Limited has informed the Exchange about award of Additional Work from BRO under Project Deepak, Himachal Pradesh.",
|
669
|
+
"assetClass": "sme",
|
670
|
+
"attachmentFile": "https://nsearchives.nseindia.com/corporate/MANGLAMINFRA_19082025133231_addition.pdf",
|
671
|
+
"date": "19-08-2025",
|
672
|
+
"events": "corporate_announcements.general_updates",
|
673
|
+
"eventsDescriptions": "General Updates",
|
674
|
+
"hasXbrl": false,
|
675
|
+
"industry": "",
|
676
|
+
"tradingSymbol": "SBIN"
|
677
|
+
},
|
678
|
+
"timestamp": "2025-08-19T19:04:30.511Z",
|
679
|
+
"type": "events.corporate.announcements"
|
680
|
+
}
|
681
|
+
```
|
682
|
+
|
683
|
+
#### Complete Corporate Events Example
|
684
|
+
|
685
|
+
```python
|
686
|
+
from wiz_trader import QuotesClient
|
687
|
+
from datetime import datetime
|
688
|
+
|
689
|
+
# Initialize client
|
690
|
+
client = QuotesClient(
|
691
|
+
base_url="url",
|
692
|
+
token="your-jwt-token",
|
693
|
+
log_level="info"
|
694
|
+
)
|
695
|
+
|
696
|
+
def handle_corporate_action(client, event):
|
697
|
+
"""Comprehensive corporate action handler"""
|
698
|
+
print(f"\n🏢 CORPORATE ACTION - {datetime.now()}")
|
699
|
+
data = event.get('data', {})
|
700
|
+
|
701
|
+
print(f"Symbol: {data.get('tradingSymbol')}")
|
702
|
+
print(f"Action: {data.get('eventText')}")
|
703
|
+
print(f"Date: {data.get('date')}")
|
704
|
+
print(f"Event: {data.get('eventsDescriptions')}")
|
705
|
+
print(f"Asset Class: {data.get('assetClass')}")
|
706
|
+
print(f"Face Value: ₹{data.get('faceValue')}")
|
707
|
+
|
708
|
+
# Action-specific handling based on actionCategory
|
709
|
+
action_category = data.get('actionCategory', '').lower()
|
710
|
+
if action_category == 'dividend' and data.get('hasDividend'):
|
711
|
+
amount = data.get('primaryAmount')
|
712
|
+
print(f"💰 Dividend: ₹{amount} per share")
|
713
|
+
# Implement dividend tracking logic
|
714
|
+
elif action_category == 'bonus' and data.get('hasBonus'):
|
715
|
+
ratio_num = data.get('ratioNumerator')
|
716
|
+
ratio_den = data.get('ratioDenominator')
|
717
|
+
if ratio_num and ratio_den:
|
718
|
+
print(f"🎁 Bonus Shares: {ratio_num}:{ratio_den} ratio")
|
719
|
+
# Update portfolio for bonus shares
|
720
|
+
elif action_category == 'split':
|
721
|
+
old_fv = data.get('oldFaceValue')
|
722
|
+
new_fv = data.get('newFaceValue')
|
723
|
+
if old_fv and new_fv:
|
724
|
+
print(f"📊 Stock Split: Face value changed from ₹{old_fv} to ₹{new_fv}")
|
725
|
+
# Adjust position quantities
|
726
|
+
|
727
|
+
def handle_corporate_announcement(client, event):
|
728
|
+
"""Comprehensive corporate announcement handler"""
|
729
|
+
print(f"\n📢 CORPORATE ANNOUNCEMENT - {datetime.now()}")
|
730
|
+
data = event.get('data', {})
|
731
|
+
|
732
|
+
print(f"Symbol: {data.get('tradingSymbol')}")
|
733
|
+
print(f"Announcement: {data.get('announcement')}")
|
734
|
+
print(f"Date: {data.get('date')}")
|
735
|
+
print(f"Event: {data.get('eventsDescriptions')}")
|
736
|
+
print(f"Asset Class: {data.get('assetClass')}")
|
737
|
+
|
738
|
+
# Check for attachment file
|
739
|
+
if 'attachmentFile' in data:
|
740
|
+
print(f"📎 Attachment: {data['attachmentFile']}")
|
741
|
+
|
742
|
+
# Event-specific handling based on events field
|
743
|
+
events = data.get('events', '').lower()
|
744
|
+
if 'earnings' in events or 'results' in events:
|
745
|
+
print("📈 Earnings/Results announcement detected")
|
746
|
+
# Implement earnings analysis
|
747
|
+
elif 'general_updates' in events:
|
748
|
+
print("📋 General company update")
|
749
|
+
# Handle general announcements
|
750
|
+
|
751
|
+
# Register handlers
|
752
|
+
client.on_corporate_action = handle_corporate_action
|
753
|
+
client.on_corporate_announcement = handle_corporate_announcement
|
754
|
+
|
755
|
+
# Optional: Subscribe to market data as well
|
756
|
+
instruments = ["NSE:RELIANCE-EQ", "NSE:TCS-EQ"]
|
757
|
+
client.subscribe(instruments, mode="ticks")
|
758
|
+
|
759
|
+
# Start listening for events
|
760
|
+
client.connect()
|
761
|
+
```
|
762
|
+
|
572
763
|
### Complete Examples
|
573
764
|
|
574
765
|
#### Blocking Example
|
@@ -2807,10 +2998,129 @@ beta_custom = client.get_beta_custom_period(
|
|
2807
2998
|
)
|
2808
2999
|
print(f"Custom Period Beta: {beta_custom['beta']}")
|
2809
3000
|
print(f"Alpha: {beta_custom['alpha']}")
|
3001
|
+
|
3002
|
+
# Strategy Max Drawdown
|
3003
|
+
strategy_drawdown = client.get_strategy_max_drawdown(
|
3004
|
+
strategy_id="str_01jspb8z36edjsp5pecqq0mpm3",
|
3005
|
+
start_date="2023-01-01",
|
3006
|
+
end_date="2024-12-31",
|
3007
|
+
interval="daily"
|
3008
|
+
)
|
3009
|
+
print(f"Strategy Max Drawdown: {strategy_drawdown['maxDrawdown']}")
|
3010
|
+
print(f"Peak Date: {strategy_drawdown['peakDate']}")
|
3011
|
+
|
3012
|
+
# Product Max Drawdown
|
3013
|
+
product_drawdown = client.get_product_max_drawdown(
|
3014
|
+
product_id="prd_01jyrg7ffkemq9hz3rkeznh9dr",
|
3015
|
+
start_date="2023-01-01",
|
3016
|
+
end_date="2024-12-31",
|
3017
|
+
interval="monthly"
|
3018
|
+
)
|
3019
|
+
print(f"Product Max Drawdown: {product_drawdown['maxDrawdown']}")
|
3020
|
+
|
3021
|
+
# Average True Range (ATR)
|
3022
|
+
atr_data = client.get_atr(
|
3023
|
+
symbol="AXISBANK",
|
3024
|
+
start_date="2023-01-01",
|
3025
|
+
end_date="2024-12-31",
|
3026
|
+
window=14,
|
3027
|
+
adjusted=True,
|
3028
|
+
interval="daily"
|
3029
|
+
)
|
3030
|
+
print(f"Latest ATR: {atr_data['atr'][-1]['atrValue']}")
|
3031
|
+
|
3032
|
+
# Simple Return
|
3033
|
+
simple_return = client.get_simple_return(
|
3034
|
+
symbol="NIFTY_IT",
|
3035
|
+
start_date="2023-01-01",
|
3036
|
+
end_date="2024-12-31",
|
3037
|
+
adjusted=True,
|
3038
|
+
interval="daily",
|
3039
|
+
benchmark="NIFTY 50"
|
3040
|
+
)
|
3041
|
+
print(f"Total Return: {simple_return['totalReturn']}")
|
3042
|
+
print(f"Relative Return: {simple_return['relativeReturn']}")
|
3043
|
+
|
3044
|
+
# Corporate Actions and Announcements
|
3045
|
+
corporate_events = client.get_corporate_actions_events()
|
3046
|
+
print(f"Available Corporate Action Types: {corporate_events}")
|
3047
|
+
|
3048
|
+
# Filter Corporate Actions
|
3049
|
+
corporate_actions = client.get_corporate_actions_filter(
|
3050
|
+
symbol="RELIANCE",
|
3051
|
+
events="corporate_actions.agm",
|
3052
|
+
fromDate="2024-01-01",
|
3053
|
+
toDate="2024-12-31",
|
3054
|
+
hasDividend=True,
|
3055
|
+
page=1,
|
3056
|
+
pageSize=20
|
3057
|
+
)
|
3058
|
+
print(f"Found {corporate_actions['totalCount']} corporate actions")
|
3059
|
+
|
3060
|
+
# Corporate Announcements
|
3061
|
+
announcement_events = client.get_corporate_announcements_events()
|
3062
|
+
print(f"Available Announcement Types: {announcement_events}")
|
3063
|
+
|
3064
|
+
# Filter Corporate Announcements
|
3065
|
+
announcements = client.get_corporate_announcements_filter(
|
3066
|
+
symbol="TCS",
|
3067
|
+
events="corporate_announcements.agm",
|
3068
|
+
fromDate="2024-01-01",
|
3069
|
+
toDate="2024-12-31",
|
3070
|
+
announcementContains="dividend",
|
3071
|
+
page=1,
|
3072
|
+
pageSize=10
|
3073
|
+
)
|
3074
|
+
print(f"Found {announcements['totalCount']} announcements")
|
2810
3075
|
```
|
2811
3076
|
|
3077
|
+
### Corporate Analytics API Reference
|
3078
|
+
|
3079
|
+
#### Corporate Actions Filter Parameters
|
3080
|
+
|
3081
|
+
| Parameter | Type | Required | Description | Example |
|
3082
|
+
|-----------|------|----------|-------------|----------|
|
3083
|
+
| symbol | string | No | Trading symbol to filter by | RELIANCE, TCS |
|
3084
|
+
| events | string | No | Event type to filter by | Dividend, BONUS |
|
3085
|
+
| actionCategory | string | No | Action category to filter by | DIVIDEND, BONUS, SPLIT |
|
3086
|
+
| fromDate | string (date) | No | Ex-date from (YYYY-MM-DD) | 2024-01-01 |
|
3087
|
+
| toDate | string (date) | No | Ex-date to (YYYY-MM-DD) | 2024-12-31 |
|
3088
|
+
| exchange | string | No | Exchange to filter by | NSE, BSE |
|
3089
|
+
| hasDividend | boolean | No | Filter for dividend actions | true, false |
|
3090
|
+
| hasBonus | boolean | No | Filter for bonus actions | true, false |
|
3091
|
+
| hasAgm | boolean | No | Filter for AGM actions | true, false |
|
3092
|
+
| eventTextContains | string | No | Search text within event description | bonus, dividend |
|
3093
|
+
| faceValue | number | No | Face value to filter by | 10, 1 |
|
3094
|
+
| ratioNumerator | integer | No | Ratio numerator value | 1, 2 |
|
3095
|
+
| ratioDenominator | integer | No | Ratio denominator value | 1, 10 |
|
3096
|
+
| actionSubcategory | string | No | Action subcategory to filter by | INTERIM, FINAL |
|
3097
|
+
| primaryAmount | number | No | Primary amount to filter by | 5.50, 10.00 |
|
3098
|
+
| secondaryAmount | number | No | Secondary amount to filter by | 2.50 |
|
3099
|
+
| oldFaceValue | number | No | Old face value to filter by | 10 |
|
3100
|
+
| newFaceValue | number | No | New face value to filter by | 1 |
|
3101
|
+
| page | integer | No | Page number for pagination (default: 1) | 1, 2 |
|
3102
|
+
| pageSize | integer | No | Records per page (default: 20, max: 100) | 20, 50 |
|
3103
|
+
|
3104
|
+
#### Corporate Announcements Filter Parameters
|
3105
|
+
|
3106
|
+
| Parameter | Type | Required | Description | Example |
|
3107
|
+
|-----------|------|----------|-------------|----------|
|
3108
|
+
| symbol | string | No | Trading symbol to filter by | 20MICRONS, FINCABLES |
|
3109
|
+
| events | string | No | Event type to filter by | AGM, Results Update |
|
3110
|
+
| fromDate | string (date) | No | Date from (YYYY-MM-DD) | 2012-01-01 |
|
3111
|
+
| toDate | string (date) | No | Date to (YYYY-MM-DD) | 2012-12-31 |
|
3112
|
+
| announcementDateFrom | string (date) | No | Announcement date from (YYYY-MM-DD) | 2010-01-01 |
|
3113
|
+
| announcementDateTo | string (date) | No | Announcement date to (YYYY-MM-DD) | 2010-12-31 |
|
3114
|
+
| exchange | string | No | Exchange to filter by | NSE, BSE |
|
3115
|
+
| announcementContains | string | No | Search text within announcement | dividend, merger |
|
3116
|
+
| hasXbrl | boolean | No | Filter for announcements with XBRL | true, false |
|
3117
|
+
| page | integer | No | Page number for pagination (default: 1) | 1, 2 |
|
3118
|
+
| pageSize | integer | No | Records per page (default: 20, max: 100) | 20, 50 |
|
3119
|
+
|
2812
3120
|
**Key Features:**
|
2813
|
-
- **Comprehensive Coverage**:
|
3121
|
+
- **Comprehensive Coverage**: 47+ analytics endpoints covering fundamentals, valuation, returns, market data, ownership, metrics, macro data, risk analysis, sector classification, leverage analysis, advanced technical analysis, and corporate actions/announcements
|
3122
|
+
- **Corporate Actions**: Track dividends, bonus issues, stock splits, rights issues, AGMs, and buybacks with comprehensive filtering
|
3123
|
+
- **Corporate Announcements**: Monitor board meetings, financial results, AGM notifications, and regulatory announcements with XBRL support
|
2814
3124
|
- **Fundamentals Analysis**: 9 methods including ROE, ROA, margins, ratios, book-to-market, market cap-to-sales, and cash-to-market cap
|
2815
3125
|
- **Valuation Metrics**: P/E, P/B, EV/EBITDA, FCF yield with TTM and consolidated/standalone options
|
2816
3126
|
- **Risk-Adjusted Metrics**: Sortino ratio, upside capture ratio, maximum drawdown, and returns volatility for comprehensive risk analysis
|