How I automatically extract my M1 Finance transactions

Dividends data automatically extracted from M1 in a live Grafana dashboard.
Dividends data automatically extracted from M1 in a live Grafana dashboard.

I’m the author behind Meerschaum, and I originally wrote the apex plugin last year as a way to track my own transactions and dividends. I hope this guide makes your investing journey easier and more exciting!

The Apex Clearing export tool is a bit… clunky.

Create your Apex Clearing username

A screenshot of the view account settings link in M1 Finance.
A screenshot of the M1 Finance accounts page.

Install Meerschaum

pip install meerschaum
A screenshot of the Meerschaum shell
The Meerschaum shell on first launch.

If you have Docker installed (i.e. you are likely a software developer), then you can instead run the full pre-configured data analysis stack.

Fetch Apex Clearing data

install plugin apex

The apex plugin will ask for your Apex Clearing account credentials, which is always concerning. For complete transparency and in the spirit of open source, here is the plugin source code so you can audit exactly what it’s doing.

NOTE: The apex plugin is in no way formally associated with Apex Clearing.

register pipe -c plugin:apex -m activities
sync pipes
The apex plugin asking for login credentials.
The Apex Clearing plugin on first sync.

Firefox is necessary because Apex Clearing does fingerprinting to make sure you’re using a real browser.

The success message displayed after syncing data from Apex Clearing.
Data are successfully synced from Apex Clearing.
sync pipes --loop
Continuously syncing new Apex Clearing data.
sync pipes --loop --min-seconds 3600
sync pipes --loop --min-seconds 3600 -d
The output of the show jobs command.
The status of saved jobs.
A screenshot of the show logs command.
The duration was edited to 30 seconds for this demonstration.
show logs --nopretty
The output of the stop jobs command.

Visualize your data

show data all
The output of the show data command.
A quick overview of the data fetched from Apex Clearing.
import meerschaum as mrsm
pipe = mrsm.Pipe('plugin:apex', 'activities', instance='sql:local')
df = pipe.get_data()
df.to_csv('apex_data.csv')
M1 Finance data in a spreadsheet.
M1 Finance data in a spreadsheet.
SELECT DISTINCT
timestamp,
( SUM("netAmount")
OVER (ORDER BY timestamp ASC)
) AS "running_dividends"
FROM "plugin_apex_activities"
WHERE symbol IS NOT NULL AND symbol != ''
AND "transferDirection" = 'INCOMING'
AND "activityType" = 'MONEY_MOVEMENTS'

Conclusion

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Bennett Meares

I’m the software developer behind Meerschaum, the data engineer’s toolbox. Say “Big Data” three times into a mirror and I might just show up.