Not able to get correct LTP of NIFTY50
-
Hi,
I am trying to get last traded price of NIFTY50 using
angel=SmartConnect(api_key=key_secret[0])
....
angel.ltpData("CDS", "NIFTY50", "2")I am getting value 183.3855 for ltp. Where as current LTP is 185.4580. I was expecting this value. Can you please look into this issue
Thanks
Phani -
HI @phanideva You can refer below code
https://smartapi.angelbroking.com/topic/1194/basic-smartapi-integration-using-python -
@admin said in Not able to get correct LTP of NIFTY50:
HI @phanideva Passed exchange as NSE.
@admin If I pass NSE I get this error
angel.ltpData("NSE", "NIFTY50", "2")
Out[87]:
{'message': 'Failed to get symbol details',
'errorcode': 'AB1018',
'status': False,
'data': None}If I pass "CDS" I get below output
angel.ltpData("CDS", "NIFTY50", "2")
Out[88]:
{'status': True,
'message': 'SUCCESS',
'errorcode': '',
'data': {'exchange': 'CDS',
'tradingsymbol': 'NIFTY50',
'symboltoken': '2',
'open': 0.0,
'high': 0.0,
'low': 0.0,
'close': 183.3855,
'ltp': 183.3855}}It was working yesterday.
-
HI @phanideva said in Not able to get correct LTP of NIFTY50:
Hi,
I am trying to get last traded price of NIFTY50 using
angel=SmartConnect(api_key=key_secret[0])
....
angel.ltpData("CDS", "NIFTY50", "2")
I am getting value 183.3855 for ltp. Where as current LTP is 185.4580. I was expecting this value. Can you please look into this issue
Thanks
Phani
please post your complete code..it seems you have posted partial code where "2" is not recognized. -
@admin If I pass NSE I get this error
angel.ltpData("NSE", "NIFTY50", "2")
Out[87]:
{'message': 'Failed to get symbol details',
'errorcode': 'AB1018',
'status': False,
'data': None}If I pass "CDS" I get below output
angel.ltpData("CDS", "NIFTY50", "2")
Out[88]:
{'status': True,
'message': 'SUCCESS',
'errorcode': '',
'data': {'exchange': 'CDS',
'tradingsymbol': 'NIFTY50',
'symboltoken': '2',
'open': 0.0,
'high': 0.0,
'low': 0.0,
'close': 183.3855,
'ltp': 183.3855}}It was working yesterday.
-
HI @phanideva Passed exchange as NSE.