Trading
-
from smartapi import SmartConnect
Replace with your actual details:
API_KEY = "nBvKVLPi" # Your actual API key
CLIENT_ID = "Your AngelOne client ID (e.g. R123456)"
PASSWORD = "Your login password"
TOTP = "Your TOTP code if 2FA enabled (optional)"obj = SmartConnect(api_key=API_KEY)
Login session
data = obj.generateSession(CLIENT_ID, PASSWORD, TOTP)
refresh_token = data['data']['refreshToken']
access_token = obj.getAccessToken()Check profile (optional)
profile = obj.getProfile(refresh_token)
print("Profile:", profile)