polybuildr / money-stuff

Analysing topics from Matt Levine's "Money Stuff"

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Analysing topics from Matt Levine's "Money Stuff"

There exists a fantastic newsletter called Money Stuff which can be found at https://www.bloomberg.com/opinion/authors/ARbTQlRLRjE/matthew-s-levine and the author can be found on Twitter at https://twitter.com/matt_levine.

Recently, I was idly wondering about the topics that Matt Levine writes about in Money Stuff and how they reflect trends in Finance news, in some way. I had some free time on my hands, hence this exploratory respository.

Heatmap of the top 10 topics by count per month

The code in this repository downloads Money Stuff emails from your Gmail account using the Gmail API, runs the Spacy NLP library on it and then plots a heatmap using Seaborn/Matplotlib.

There will (eventually) be a longer blog post about this project on my blog at https://blog.vghaisas.com.

Setup

I was using Python 3.8.10 in a virtualenv while developing this project.

All the required packages can be installed using pip and the included requirements.txt file:

$ pip install -r requirements.txt

In order to download Money Stuff emails from Gmail, this project uses the Gmail API (see the Python Quickstart). In order to use the API, there are some additional setup steps mentioned in the quickstart: you'll need to create a Google Cloud Platform project with the API enabled and then create authorization credentials for a desktop application. Download your client secret and save it as credentials.json in this repository.

Usage

  1. First up, download your Money Stuff emails using the Gmail API.
$ python download_emails.py
  1. Then parse the downloads, extract entities from them, and pickle the results.
$ python main_pickle_data.py
  1. Finally, read the pickled data and generate a heatmap plot.
$ python main_process_pickle.py

About

Analysing topics from Matt Levine's "Money Stuff"

License:MIT License


Languages

Language:Python 100.0%