- Notifications
You must be signed in to change notification settings - Fork1
Financial Headline Generator as specified byhttps://www.smbc-comics.com/comic/markets
License
OpenBagTwo/MarketWatch
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A Meme Financial Headline Generator
I woke up one morning, and as am I am wont to do, was randomly wandering through theSMBC archivewhen I came acrossthis webcomic from 2020:
and I thought to myself, "Hey, I bet I could code that pretty easily!"
The two components going into generating the headlines were:
- getting market data (is the market up or down on any given day?)
- getting news headlines
I figured the first would be easy and the second would be hard, but the reverse ended up being true,as most Finance APIs I could find were either decommissioned (Google), paid (NASDAQ DataLink) ordidn't contain composite indices (Alpha Vantage). Luckily, not only isYahoo Financestill around, but there's even a well-maintained Python package calledyfinance
that I could use without even creating a developer account!
On the news side, I foundthis handy list of news media APIs and decided to go withThe Guardian. Their documentation was excellent and their API was extremely easyto use.
If you'd like to get a deeper look at how I combined the two halves, have a look at thethe development notebookor just jump straight intothe script that generates the posts. To runthe code, you'll need anenvironment with:
- Python 3.11 or newer (if your system doesn't ship with one, I highly recommendmambaforge across any system.
yfinance
requests
- JupyterLab is optional but highly recommended.
- You'll also need to register withThe Guardian's Open Platformand snag an API key.
If you're interested in learning about the website side of things, take a read through theHugo quickstart guide. This project usestheBlonde theme, so have a look at their documentationas well.
If you're interested in the automation portion (new content is updated daily), it's all doneviaGitHub Actions
The project is licensed under theAffero GPL and all contributions, uses and modificationsmust be done under those terms (read: if you spin up your own site, you must make the source codepublicly available under the AGPL).
About
Financial Headline Generator as specified byhttps://www.smbc-comics.com/comic/markets