not able to get ltp data using SmartConnect
-
unable to get ltp using SmartConnect
continue to raise objection that
"LTP API failed: SmartConnect.ltpData() missing 1 required positional argument: 'symboltoken' "
even when i have done so
here is code
try:
exchange="NSE"
tradingsymbol = "SBIN-EQ"
symbolToken = "3045"
print(symbolToken)
ltp_data = SmartConnect.ltpData(exchange,tradingsymbol,symbolToken)
print(ltp_data) -
You are using SmartConnect directly from library. Instead create a login function that logs in with the API key like below
ANGEL_API_KEY = your_API_key
smart_api = SmartConnect(api_key=ANGEL_API_KEY)and you can use smart_api.ltpData(...)
it'll work. You're welcome.