NodeJS stock tracker. Read historical stock data from an API to store in local DB. Offer API to integrate data into a dashboard. https://github.com/alecc08/stock-tracker-dashboard
Using Alphavantage API to get data. You can get your own API key from them at https://www.alphavantage.co
Note: Alphavantage is free but they request not to query them over 100 calls per minute. Please respect this limit or contact them to work something out. This application shouldn't have any need get anywhere near that volume, as the data returned will be from the database unless the stock wasn't already obtained.
POST
/stocks
- Params
-stockCode
Ex: POST /stocks stockCode:MSFT
There's a cron job that runs at your time of choosing to update all stocks in the database. You can change this time in config.js
GET
/stocks
- Params
-stockCodes : Comma seperated list of stocks
-start : YYYY-MM-DD format date start
-end : YYYY-MM-DD format date end
Ex: GET /stocks stockCodes:MSFT,FB,GOOG start:2017-01-01 end:2017-02-02
GET
/accounts
- Params
-accountId
Ex: POST /stocks stockCode:MSFT
POST
/accounts
- Params
-accountName
To run some custom sql directly into the db, simply run the dbConsole.js file with node
node dbConsole
Then you can run any sql statement followed by a semicolon to execute the query. E.g.
SELECT * FROM stock_history;