Skip to main content

StockNews

Scrape financial News from Yahoo and analyse the sentiment (PoC)

Summary

With stocknews, you can scrape news data from the Yahoo Financial RSS Feed and store them with the sentiment of the headline and the summary. Depending on the initialization 1 or 2 files are output as csv. No. 1 is the scraped news (optional) and no. 2 is the summary, having the summarized sentiment of news for the given date (see options) and the values.

Install

To install the package, run pip install stocknews

Usage

In order to use stocknews to scrape news data and prepare them for your model you simply need this:

from stocknews import StockNews
...
stocks = ['AAPL', 'MSFT', 'NFLX']
sn = StockNews(stocks, wt_key='MY_WORLD_TRADING_DATA_KEY')
df = sn.summarize()
...

This returns a pandas DataFrame and saves it to data/data.csv by default (see options)

Options

  • stocks: A list of stocks to check. See http://eoddata.com/symbols.aspx for all symbols available
  • news_file='news.csv': filename of the saved news
  • summary_file='data.csv': filename of the saved dataset, including sentiment and value per day and stock
  • save_news=True: save the news file or scrape and analyse on the fly for recent news
  • closing_hour=20: Close of the exchange (NASDAQ in this case). News after closing will be taken for next trading day (skips the weekend as well)
  • closing_minute=0: Same as closing_hour
  • wt_key=None: Your worldtradingdata.com API Key. Get one here. Not needed if read_rss is called directly.

Dependencies

Tests

python setup.py test

ToDo

  • add more news sources
  • add more tests

Changes

0.9.11

  • Fixed another pathing issue...

0.9.10

  • removed the exit() rolleyes

0.9.9

  • path issues fixed. For real now...

0.9.8

  • fixed some path issues

0.9.7

  • tried to fix too many requests, added a counter for made requests to keep track

0.9.6

  • Suppress ntlk download messages
  • renamed test.py

0.9.5

  • "Initial Release"

<0.9.5:

  • Testing

Release files for stocknews 0.9.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for stocknews 0.9.11
File Size Uploaded
stocknews-0.9.11.tar.gz 5.4 kB Details

Release files / stocknews-0.9.11.tar.gz

Download URL stocknews-0.9.11.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
c440ecfeccf3b4ddd9f27d4105ba450ed082ecc415845d03a646f872778fc659
BLAKE2b-256 checksum
How to use checksums
eefdb50941b623fc5bf54a79856b4685c50b055b65dd3a118f0e14f3e5a8eaab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.3

Release history Release notifications | RSS feed

This release

0.9.11 This release

1 release file

0.9.10

1 release file

0.9.9

1 release file

0.9.8

1 release file

0.9.7

1 release file

0.9.6

1 release file

0.9.5

1 release file

0.9.0

1 release file

0.5.3

1 release file

0.5.2

1 release file

0.5.1

1 release file

0.3.2

2 release files

0.3.1

1 release file

0.3

1 release file

0.2

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page