pmorissette / ffn

ffn - a financial function library for Python
pmorissette.github.io/ffn
MIT License
2.03k stars 300 forks source link

Cannot fetch data #189

Closed TAndronicus closed 1 year ago

TAndronicus commented 1 year ago
In [5]: ffn.get('aapl,msft,c,gs,ge', start='2010-01-01')
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-5-341a6197ebee> in <module>
----> 1 ffn.get('aapl,msft,c,gs,ge', start='2010-01-01')

~/.pyenv/versions/anaconda3-2022.10/lib/python3.9/site-packages/decorator.py in fun(*args, **kw)
    230             if not kwsyntax:
    231                 args, kw = fix(args, kw, sig)
--> 232             return caller(func, *(extras + args), **kw)
    233     fun.__name__ = func.__name__
    234     fun.__doc__ = func.__doc__

~/.pyenv/versions/anaconda3-2022.10/lib/python3.9/site-packages/ffn/utils.py in _memoize(func, *args, **kw)
     32         return cache[key]
     33     else:
---> 34         cache[key] = result = func(*args, **kw)
     35         return result
     36

~/.pyenv/versions/anaconda3-2022.10/lib/python3.9/site-packages/ffn/data.py in get(tickers, provider, common_dates, forward_fill, clean_tickers, column_names, ticker_field_sep, mrefresh, existing, **kwargs)
     74         # call provider - check if supports memoization
     75         if hasattr(provider, "mcache"):
---> 76             data[ticker] = provider(ticker=t, field=f, mrefresh=mrefresh, **kwargs)
     77         else:
     78             data[ticker] = provider(ticker=t, field=f, **kwargs)

~/.pyenv/versions/anaconda3-2022.10/lib/python3.9/site-packages/decorator.py in fun(*args, **kw)
    230             if not kwsyntax:
    231                 args, kw = fix(args, kw, sig)
--> 232             return caller(func, *(extras + args), **kw)
    233     fun.__name__ = func.__name__
    234     fun.__doc__ = func.__doc__

~/.pyenv/versions/anaconda3-2022.10/lib/python3.9/site-packages/ffn/utils.py in _memoize(func, *args, **kw)
     32         return cache[key]
     33     else:
---> 34         cache[key] = result = func(*args, **kw)
     35         return result
     36

~/.pyenv/versions/anaconda3-2022.10/lib/python3.9/site-packages/ffn/data.py in yf(ticker, field, start, end, mrefresh)
    138         field = "Adj Close"
    139
--> 140     tmp = pdata.get_data_yahoo(ticker, start=start, end=end)
    141
    142     if tmp is None:

~/.pyenv/versions/anaconda3-2022.10/lib/python3.9/site-packages/pandas_datareader/data.py in get_data_yahoo(*args, **kwargs)
     78
     79 def get_data_yahoo(*args, **kwargs):
---> 80     return YahooDailyReader(*args, **kwargs).read()
     81
     82

~/.pyenv/versions/anaconda3-2022.10/lib/python3.9/site-packages/pandas_datareader/base.py in read(self)
    251         # If a single symbol, (e.g., 'GOOG')
    252         if isinstance(self.symbols, (string_types, int)):
--> 253             df = self._read_one_data(self.url, params=self._get_params(self.symbols))
    254         # Or multiple symbols, (e.g., ['GOOG', 'AAPL', 'MSFT'])
    255         elif isinstance(self.symbols, DataFrame):

~/.pyenv/versions/anaconda3-2022.10/lib/python3.9/site-packages/pandas_datareader/yahoo/daily.py in _read_one_data(self, url, params)
    151         try:
    152             j = json.loads(re.search(ptrn, resp.text, re.DOTALL).group(1))
--> 153             data = j["context"]["dispatcher"]["stores"]["HistoricalPriceStore"]
    154         except KeyError:
    155             msg = "No data fetched for symbol {} using {}"

TypeError: string indices must be integers