Registry / finance / smartapi-python

smartapi-python

JSON →
library1.5.5pypypiunverified

Angel Broking (Angel One) official Python SDK for the SmartAPI – trading, orders, market data, and portfolio management. Current version 1.5.5. Release cadence is irregular, driven by broker API changes.

pip install smartapi-python
INSTALL
IMPORT
SIG · SMARTAPI-PYTHON
S
smartapi-python
financepythonv1.5.5
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SmartConnect
from SmartApi import SmartConnect
from smartapi import SmartConnect

Initialize SmartConnect with API key, then generate session using client id, password, and TOTP.

import os from smartapi import SmartConnect obj = SmartConnect(api_key=os.environ.get('API_KEY', '')) data = obj.generateSession(os.environ.get('CLIENT_ID', ''), os.environ.get('PASSWORD', ''), os.environ.get('TOTP', '')) print(data)
Debug
Known issues
breakingsession.userProfiles and session.profile are deprecated. Use session.getProfile() to fetch profile.
fix
Replace session.userProfiles with session.getProfile()['data'].
affects: >=1.4.0
gotchaTOTP (One Time Password) is mandatory for session generation even in live environment. Many users miss this.
fix
Pass the TOTP value (not just password) to generateSession.
affects: all
deprecatedSmartWebSocket (V1) is deprecated. Use SmartWebSocketV2 for live market data.
fix
Migrate from 'from smartapi import SmartWebSocket' to 'from smartapi import SmartWebSocketV2'.
affects: <=1.3.x
gotchaFeedToken required for WebSocket connection is returned in generateSession response, not in access_token.
fix
Extract feed_token from generateSession response: obj.feed_token or feed_token key in returned dict.
affects: all
Upgrade
Version history
1.5.5latest on PyPI · released Feb 7, 2025
Audit
Dependencies
requestsrequiredHTTP client
pyotprequiredTOTP for 2FA
urllib3requiredConnection pooling
Agent activity
43 hits · last 30 days
node
38
OpenAI (training)
1
Resources
smartapi-python — pip install smartapi-python · libregistry