/trade

Primary LanguagePython

Lambda Automated Trading

Python function to automate trading with AWS Lambda and Serverless Framework with scheduled trigger.

Setup

Docker and serverless are needed for deployment.

Docker

Install docker (Windows)

winget install Docker.DockerDesktop

Windows may need to be restarted after installation.

Serverless

Install serverless

npm install -g serverless

Add AWS credentials to serverless

serverless config credentials

Setup Repo

Install npm packages/plugins for serverless

npm install

Deploy

After setting up serverless credentials you can deploy with:

serverless deploy

Serverless YML

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 *)