Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use it on gogle colab? #14

Open
rrfaria opened this issue Jul 3, 2021 · 2 comments · Fixed by #18
Open

How to use it on gogle colab? #14

rrfaria opened this issue Jul 3, 2021 · 2 comments · Fixed by #18

Comments

@rrfaria
Copy link

rrfaria commented Jul 3, 2021

What I did:
I followed readme and added initial code but it isn't works

!pip install --no-deps git+git://github.com/Heerozh/spectre.git
!pip install pytorch torchvision torchaudio
!pip install pyarrow pandas tqdm plotly requests

by default cudatoolkit is already installed on colab
then I imported the code:

from spectre.data import YahooDownloader
YahooDownloader.ingest(start_date="2011", save_to="/content/prices/yahoo", symbols=None, skip_exists=True)

and the errors shows:

Download prices from yahoo...
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-14-db2629264a25> in <module>()
      1 from spectre.data import YahooDownloader
----> 2 YahooDownloader.ingest(start_date="2011", save_to="/content/prices/yahoo", symbols=None, skip_exists=True)

6 frames
/usr/local/lib/python3.7/dist-packages/pandas/io/html.py in _parse_tables(self, doc, match, attrs)
    545 
    546         if not tables:
--> 547             raise ValueError("No tables found")
    548 
    549         result = []

ValueError: No tables found

if I use:

YahooDownloader.ingest(start_date="2011", save_to="/content/prices/yahoo", symbols=['EURUSD=X'], skip_exists=True)

ERROR:

Download prices from yahoo...
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-19-cd5640dd3574> in <module>()
      1 from spectre.data import YahooDownloader
----> 2 YahooDownloader.ingest(start_date="2011", save_to="/content/prices/yahoo", symbols=['EURUSD=X'], skip_exists=True)

/usr/local/lib/python3.7/dist-packages/spectre/data/yahoo.py in ingest(cls, start_date, save_to, symbols, skip_exists)
     47         # CrumbStore
     48         m = re.search('"CrumbStore":{"crumb":"(.*?)"}', page.text)
---> 49         crumb = m.group(1)
     50         crumb = crumb.encode('ascii').decode('unicode-escape')
     51 

AttributeError: 'NoneType' object has no attribute 'group'
@Heerozh
Copy link
Owner

Heerozh commented Jul 4, 2021

problem is downloading data from Yahoo, not related to colab.
It seems that Yahoo changed his API.

Yahoo often changes his methods to prevent others from downloading, you better find other ways to get data.

@rrfaria
Copy link
Author

rrfaria commented Jul 5, 2021

The best lib and still working for yahoo
https://github.com/ranaroussi/yfinance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants