Shoonya-Dev / ShoonyaApi-py

144 stars 133 forks source link

Attribute error while fetching historical data, AttributeError: 'ShoonyaApiPy' object has no attribute '_NorenApi__username' #152

Closed ashish5051 closed 5 months ago

ashish5051 commented 7 months ago

AttributeError Traceback (most recent call last) Cell In[3], line 14 12 lastBusDay = datetime.datetime.today() - datetime.timedelta(days=3) 13 lastBusDay = lastBusDay.replace(hour=0, minute=0, second=0, microsecond=0) ---> 14 ret = api.get_time_price_series(exchange='NSE', token='22', starttime=lastBusDay.timestamp(), interval=5) 15 pdb.set_trace()

File ~\AppData\Local\Programs\Python\Python312\Lib\site-packages\NorenRestApiPy\NorenApi.py:889, in NorenApi.get_time_price_series(self, exchange, token, starttime, endtime, interval) 887 # 888 values = {'ordersource':'API'} --> 889 values["uid"] = self.__username 890 values["exch"] = exchange 891 values["token"] = token

AttributeError: 'ShoonyaApiPy' object has no attribute '_NorenApi__username'

trader842 commented 7 months ago

AttributeError Traceback (most recent call last) Cell In[3], line 14 12 lastBusDay = datetime.datetime.today() - datetime.timedelta(days=3) 13 lastBusDay = lastBusDay.replace(hour=0, minute=0, second=0, microsecond=0) ---> 14 ret = api.get_time_price_series(exchange='NSE', token='22', starttime=lastBusDay.timestamp(), interval=5) 15 pdb.set_trace()

File ~\AppData\Local\Programs\Python\Python312\Lib\site-packages\NorenRestApiPy\NorenApi.py:889, in NorenApi.get_time_price_series(self, exchange, token, starttime, endtime, interval) 887 # 888 values = {'ordersource':'API'} --> 889 values["uid"] = self.__username 890 values["exch"] = exchange 891 values["token"] = token

AttributeError: 'ShoonyaApiPy' object has no attribute '_NorenApi__username'

Have you found any solution for this ?

ashish5051 commented 7 months ago

NO, I'm asking for solution

Shoonya-Dev commented 5 months ago

Greetings from Shoonya!

As we checked, its working fine. Please refer to the attached input and output of the code:

image