OpenApi-5p / py5paisa

Official Python SDK for 5paisa APIs natively written in VB .NET
https://5paisa.github.io
92 stars 68 forks source link

Error while fetching a scrip price using fetch_market_depth #127

Open kirany2github opened 2 years ago

kirany2github commented 2 years ago

Description

I am trying to fetch a scrip price

What I Did

a=[{"Exchange":"N","ExchangeType":"C","ScripName":"999920005"}] banknifty = client.fetch_market_depth(a) lastprice = round(banknifty['Data'][0]['LastTradedPrice']/100)*100 print(banknifty['Data'][0]['LastTradedPrice'])


Expecting value: line 1 column 1 (char 0)
None
Traceback (most recent call last):
  File "c:\Kiran\algo\main.py", line 72, in <module>
    lastprice = round(banknifty['Data'][0]['LastTradedPrice']/100)*100
TypeError: 'NoneType' object is not subscriptable
jrdinesh commented 2 years ago

Its ScripCode not ScripName But this has stopped working from 07 Feb onwards but may be u can still try i get this response 'NoneType' object is not subscriptable
I checked the response from order_request method in py5paisa.py and this is the response {'Message': 'Error while processing'} Honestly so many issues with 5paisa API its so unreliable @5paisa @ba11b0y @tarunw07 Can someone have a look into this Please.

5paisa commented 2 years ago

Can you try again now?

jrdinesh commented 2 years ago

Yeah it’s working now..