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

[BUG] Sentiments fail on businesstimes #355

Open
0cv opened this issue Feb 26, 2021 · 2 comments
Open

[BUG] Sentiments fail on businesstimes #355

0cv opened this issue Feb 26, 2021 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@0cv
Copy link
Contributor

0cv commented Feb 26, 2021

from fastquant import get_yahoo_data, get_bt_news_sentiment
from datetime import datetime, timedelta

# we get the current date and delta time of 30 days
current_date = datetime.now().strftime("%Y-%m-%d")
delta_date = (datetime.now() - timedelta(30)).strftime("%Y-%m-%d")
data = get_yahoo_data("TSLA", delta_date, current_date)
sentiments = get_bt_news_sentiment(keyword="tesla", page_nums=3)
backtest("sentiment", data, sentiments=sentiments, senti=0.2)

Will result in AttributeError: 'BarContainer' object has no attribute 'get_zorder'

Digging into the issue, it seems that the businesstimes website returns only JavaScript and no more HTML. At least doing this:

page = urlopen("https://www.businesstimes.com.sg/search/tesla?page=1").read()
print("page", page)

will result in an empty body and a lot of javascript. Either I'm doing something wrong, or businesstimes has implemented some mechanism to disable such scraping

@0cv 0cv added the bug Something isn't working label Feb 26, 2021
@enzoampil
Copy link
Owner

Ah yes, this is the issue with pull from the next. @rafmacalaba tagging you here since you built the feature 😄

@rafmacalaba
Copy link
Collaborator

@enzoampil ack! seems like its BT stuff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants