Skip to content

OpenBagTwo/MarketWatch

Repository files navigation

SMBC Market Watch

Generate Post

A Meme Financial Headline Generator

What Is This?

I woke up one morning, and as am I am wont to do, was randomly wandering through the SMBC archive when I came across this webcomic from 2020:

SMBC Markets

and I thought to myself, "Hey, I bet I could code that pretty easily!"

which is exactly what I did.

How does it work?

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) or didn't contain composite indices (Alpha Vantage). Luckily, not only is Yahoo Finance still around, but there's even a well-maintained Python package called yfinance that I could use without even creating a developer account!

On the news side, I found this handy list of news media APIs and decided to go with The Guardian. Their documentation was excellent and their API was extremely easy to use.

If you'd like to get a deeper look at how I combined the two halves, have a look at the the development notebook or just jump straight into the script that generates the posts. To run the code, you'll need an environment with:

If you're interested in learning about the website side of things, take a read through the Hugo quickstart guide. This project uses the Blonde theme, so have a look at their documentation as well.

If you're interested in the automation portion (new content is updated daily), it's all done via GitHub Actions

Contribution and Licensing

The project is licensed under the Affero GPL and all contributions, uses and modifications must be done under those terms (read: if you spin up your own site, you must make the source code publicly available under the AGPL).