Skip to content

Saves the last price of stocks every second using the TDAmeritrade API.

Notifications You must be signed in to change notification settings

shortland/Last-Price-Saver

Repository files navigation

LPS - Last Price Saver

Gets specified quote prices every second & saves it to a mysql database.

I can't find 'free' reliable data like this online... So I wrote this containerized app to begin collecting data for me.

You can only get historical data at the minute level from the TDAmeritrade API... Even then, you can only get the last ~2 months of it...

Usage

Configuration

Rename .env.example to .env or duplicate the file with the name .env...

Register for a TDAmeritrade Developer account & create a new application from their site here. Then paste in your Application API Key & Redirect URI into the .env file.

Also write in whichever stocks you want to keep track of - comma delimited in the .env file as-well.

Authentication

Prior to deploying this application to a headless server, you need to run the authentication script locally. The authentication script uses Selenium webdriver & expects Chrome to be installed on your machine... You can modify the script yourself to use Firefox, or whichever browser you prefer (I don't think newer versions of Safari support it)...

make auth

Deployment

After successfully running the authentication script above, you can either clone this repo to your server & copy over the generate secrets/token.json file; or copy the local version of this repo that already has the token.json file...

Building

Just incase you already have an older built version, throw the clean on there.

make clean && make build

Running

After building, you can run the application simply with:

make run

Exporting

Want to export the data to .CSV format? There's already a small script here that lets you do that by ticker & date (daily). You'll be prompted for that information after running the below:

make csv

Metrics

WIP.

About

Saves the last price of stocks every second using the TDAmeritrade API.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published