Auquan / Tutorials

Ipython notebooks for math and finance tutorials
970 stars 563 forks source link

key error #47

Open shrjawa opened 2 years ago

shrjawa commented 2 years ago

ds = YahooStockDataSource(cachedFolderName=cachedFolderName, dataSetId=dataSetId, instrumentIds=instrumentIds, startDateStr=startDateStr, endDateStr=endDateStr, event='history')

This line gives following error. Processing data for stock: SPY

KeyError Traceback (most recent call last) /tmp/ipykernel_12343/1072003231.py in 13 startDateStr=startDateStr, 14 endDateStr=endDateStr, ---> 15 event='history') 16 17 # Get adjusted closing price

/opt/conda/lib/python3.7/site-packages/backtester/dataSource/yahoo_data_source.py in init(self, cachedFolderName, dataSetId, instrumentIds, startDateStr, endDateStr, event, adjustPrice, downloadId, liveUpdates, pad) 117 self.event = event 118 if liveUpdates: --> 119 self._allTimes, self._groupedInstrumentUpdates = self.getGroupedInstrumentUpdates() 120 self.processGroupedInstrumentUpdates() 121 self._bookDataFeatureKeys = self.__bookDataByFeature.keys()

/opt/conda/lib/python3.7/site-packages/backtester/dataSource/data_source.py in getGroupedInstrumentUpdates(self) 65 print('Processing data for stock: %s' % (instrumentId)) 66 fileName = self.getFileName(instrumentId) ---> 67 if not self.downloadAndAdjustData(instrumentId, fileName): 68 continue 69 with open(fileName) as f:

/opt/conda/lib/python3.7/site-packages/backtester/dataSource/yahoo_data_source.py in downloadAndAdjustData(self, instrumentId, fileName) 131 def downloadAndAdjustData(self, instrumentId, fileName): 132 if not os.path.isfile(fileName): --> 133 if not downloadFileFromYahoo(self._startDate, self._endDate, instrumentId, fileName): 134 logError('Skipping %s:' % (instrumentId)) 135 return False

/opt/conda/lib/python3.7/site-packages/backtester/dataSource/data_source_utils.py in downloadFileFromYahoo(startDate, endDate, instrumentId, fileName, event) 28 def downloadFileFromYahoo(startDate, endDate, instrumentId, fileName, event='history'): 29 logInfo('Downloading %s' % fileName) ---> 30 cookie, crumb = getCookieForYahoo(instrumentId) 31 start = int(mktime(startDate.timetuple())) 32 end = int(mktime(endDate.timetuple()))

/opt/conda/lib/python3.7/site-packages/backtester/dataSource/data_source_utils.py in getCookieForYahoo(instrumentId) 15 req = requests.get(url) 16 txt = req.content ---> 17 cookie = req.cookies['B'] 18 pattern = re.compile('.*"CrumbStore":{"crumb":"(?P[^"]+)"}') 19

/opt/conda/lib/python3.7/site-packages/requests/cookies.py in getitem(self, name) 326 .. warning:: operation is O(n), not O(1). 327 """ --> 328 return self._find_no_duplicates(name) 329 330 def setitem(self, name, value):

/opt/conda/lib/python3.7/site-packages/requests/cookies.py in _find_no_duplicates(self, name, domain, path) 397 if toReturn: 398 return toReturn --> 399 raise KeyError('name=%r, domain=%r, path=%r' % (name, domain, path)) 400 401 def getstate(self):

KeyError: "name='B', domain=None, path=None"

Tried locally and on cloud.

Please let me know what is wrong.(all necessary modules are imported) Also I didn't edit file from tutorial--> pairs_trading.ipynb

numberjuani commented 2 years ago

same error as @shrjawa

sibikour commented 2 years ago

also having the same error as @shrjawa

PangyourQA commented 1 year ago

same error as above, what happened to auquan toolbox?