AI4Finance-Foundation / FinNLP

Democratizing Internet-scale financial data.
https://ai4finance.org
MIT License
1.1k stars 196 forks source link

connection error in dataframe values #22

Open sherelynyap opened 9 months ago

sherelynyap commented 9 months ago

run:

# Finnhub (Yahoo Finance, Reuters, SeekingAlpha, CNBC...)
from finnlp.data_sources.news.finnhub_date_range import Finnhub_Date_Range

start_date = "2023-01-01"
end_date = "2023-01-03"
config = {
    "use_proxy": "us_free",    # use proxies to prvent ip blocking
    "max_retry": 5,
    "proxy_pages": 5,
    "token": "clon9npr01qtp8tab4ngclon9npr01qtp8tab4o0"  # Available at https://finnhub.io/dashboard
}

news_downloader = Finnhub_Date_Range(config)                      # init
news_downloader.download_date_range_stock(start_date,end_date)    # Download headers
news_downloader.gather_content()                                  # Download contents
df = news_downloader.dataframe
selected_columns = ["headline", "content"]
df[selected_columns].head(10)

#   headline                        content
# 0 My 26-Stock $349k Portfolio Gets A Nice Petrob...   Home\nInvesting Strategy\nPortfolio Strategy\n...
# 1 Apple’s Market Cap Slides Below $2 Trillion fo...   Error
# 2 US STOCKS-Wall St starts the year with a dip; ...   (For a Reuters live blog on U.S., UK and Europ...
# 3 Buy 4 January Dogs Of The Dow, Watch 4 More Home\nDividends\nDividend Quick Picks\nBuy 4 J...
# 4 Apple's stock market value falls below $2 tril...   Jan 3 (Reuters) - Apple Inc's \n(AAPL.O)\n sto...
# 5 CORRECTED-UPDATE 1-Apple's stock market value ...   Jan 3 (Reuters) - Apple Inc's \n(AAPL.O)\n sto...
# 6 Apple Stock Falls Amid Report Of Product Order...   Apple stock got off to a slow start in 2023 as...
# 7 US STOCKS-Wall St starts the year with a dip; ...   Summary\nCompanies\nTesla shares plunge on Q4 ...
# 8 More than $1 trillion wiped off value of Apple...   apple store\nMore than $1 trillion has been wi...

==================================================================== Error: connection error in dataframe values as shown below

image