Fetching LTP Gives 500 Internal Server Error
-
Hello @admin , @rajanprabu @sandipkhairnar :
I am trying to fetch the LTP and getting 500 (Internal Server Error). Please look into this:
Also, since you are suggesting us to use this method of implementing the API, how can the API documentation help us in this scenario? I had to go back to the SmartConnect class we are importing to check how the LTP is fetched. I think there should be a separate documentation when we use this (the smartconnect module) approach.
Thank you for your help!
-
@kaleps
There were three errors:- The Symbol token was incorrect -> refer the link
- The url used was incorrect -> check the documentation
- I missed the authorization in the header. -> add to header as shown in the documentaion
-
-
@admin
Thanks a ton! -
Hi @A224819 , thank you sharing the remote access with us. The query is now resolved.
-
@A224819 is there a reason why you are not using the python SDK available here https://github.com/angelbroking-github/smartapi-python.
Since you are coding in python, wouldn't that be easier ?
-
Hi @admin
I have tried doing that. I have copy-pasted your code exactly and still no luck:
Kindly assist me with this. It's been days now I am trying to pull LTP.
You had said earlier that I have to try during market hours, but you did not clarify if the code won't work off-hours. I have tried now and will try the same code tomorrow morning and update a screenshot (which I am sure will still pull 404).
Thank you.
-
Hi @A224819 , exchange and trading symbol input is wrong. Correct details as per below
{
"exchange":"NSE",
"tradingsymbol":"3MINDIA-BL",
"symboltoken":"12179"
} -
@admin ,
I have been following the same link you have shared. Here is what i tried today during the trading hours:
Kindly tell me where I am going wrong?
Please tell me how a working code would look like with the correct parameters. As I follow the documentation, I see we only pass the exchange, trading symbol and the symbol token.
-
Hi @A224819 , Exchange input is incorrect in your code.
{"token":"275","symbol":"AUROPHARMA-EQ","name":"AUROPHARMA","expiry":"","strike":"-1.000000","lotsize":"1","instrumenttype":"","exch_seg":"NSE","tick_size":"5.000000"}
Please verify trading symbol, symbol token and exchange inputs from below link
https://margincalculator.angelbroking.com/OpenAPI_File/files/OpenAPIScripMaster.json
-
@rajanprabu
Okay, so is this how it's designed? I mean to pull only during the trading hours? -
@A224819 Please try it during market hours.