Goal: Ping Twelve data API at the end of each weekday for 1-minute SPY price data. Use this data to update fade 10 dataset and email subscribers updates including an end of day price chart.
API Documentation here
How to create a request overview here.
API endpoints are prefixed with https://api.twelvedata.com
390 minutes in a trading day (6.5 hours X 60 minutes)
Checkout the “earliest timestamp” and “market state” features.
Can get output in JSON or CSV
Pinging the API after hours for a days worth of one minute quotes only counts as 1/800 daily API requests. This means that, in theory, tracking the data I need throughout the trading day via this API would be free, estimated 390/800 pings starting at 930am.
Every trading day after market close and accounting for data delay, Ping twelve data API using API key and check response. Leverage response to parse and get opening range, activation time (if any), signal direction and that hit and that hit time. Once we have all of this data then update the database. Once the database is updated then send an email to all the subscribed users with the new data.
AWS sends the API request and sends results to NextJS app with a token and that API handles the db and email.
Devil in the details on which function handles what but definitely AWS handles schedule of data API ping.
If the client is built on NEXTJS, which runs server side code, can’t we just leverage CRON on the server there? I found an interesting article here. Hint: The article originally leveraged easycron.com and now uses tryslater.com and the latter has a great FAQ about alternatives like Lambda and GH Actions.
“Why not just use AWS Lambda triggers? Lambda triggers would work great, but they require deploying a separate function, configuring database access, and setting up CI/CD. Slater just works.”
“Why not just use GitHub Actions? GitHub Actions are great for some things, but cron jobs aren’t one of them. GH Actions are ran on a best effort basis, and can only be set as short as every 15 minutes.”
Fireship Stonks video here
Youtube video here
Cron Job with AWS here