Python function to automate trading with AWS Lambda and Serverless Framework with scheduled trigger.
Docker and serverless are needed for deployment.
Install docker (Windows)
winget install Docker.DockerDesktop
Windows may need to be restarted after installation.
Install serverless
npm install -g serverless
Add AWS credentials to serverless
serverless config credentials
Install npm packages/plugins for serverless
npm install
After setting up serverless credentials you can deploy with:
serverless deploy
Rate vs Cron example function configuration for serverless.yml
functions:
rateHandler:
handler: handler.run
events:
# Invoke Lambda function every minute
- schedule: rate(1 minute)
cronHandler:
handler: handler.run
events:
# Invoke Lambda function every 2nd minute from Mon-Fri
- schedule: cron(0/2 * ? * MON-FRI *)