https://github.com/rhlsthrm/bittman
Bittman algorithm implemented with serverless
https://github.com/rhlsthrm/bittman
aws-lambda serverless
Last synced: 5 months ago
JSON representation
Bittman algorithm implemented with serverless
- Host: GitHub
- URL: https://github.com/rhlsthrm/bittman
- Owner: rhlsthrm
- Created: 2016-06-08T03:16:19.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2017-03-07T01:05:15.000Z (about 9 years ago)
- Last Synced: 2025-04-23T14:51:28.650Z (11 months ago)
- Topics: aws-lambda, serverless
- Language: JavaScript
- Homepage:
- Size: 5.74 MB
- Stars: 14
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# bittman
## Background
This project calculates Bittman trading algorithm trading points on Wednesday evenings, and then uses them to calculate the actual triggers based on the morning open price on Thursday.
Background: http://alta5.com/blog/bittman/
This project implements the algorithm using the Serverless framework and sends emails through Mailgun. On Wednesday after market close, the `calculateVolatility` Lambda function runs and stores the data into DynamoDB. On Thursday at market open, the `calculateTriggers` Lambda function runs and sends emails with the trigger points calculated from the market open price.
## Prerequisites
* Serverless (please see https://serverless.com/) for AWS setup instructions.
`$ npm install serverless -g`
* Mailgun account (https://www.mailgun.com/)
## Configuration
The project requires an active [Mailgun](https://www.mailgun.com/) account to send emails. Insert your mailgun API key and domain into the configuration file `common/config.js`. Also you will insert email addresses here.
```
const config = {};
config.mailgun = {
apiKey: 'key-xxxxxxxxxx',
domain: 'sandboxxxxxxxxxx.mailgun.org'
};
config.emails = [
'Rahul '
];
module.exports = config;
```
## Deployment
First, install the npm dependencies:
`$ npm install`
Deploy the functions to AWS:
`$ sls deploy`
The functions have GET endpoints tied to them just so they can be tested, but the functions are meant to be run on the schedule provided.
## Debugging
To debug serverless functions, you can use the following command:
`$ sls logs -f -t`
This will give a tailing log output of the function and provides stack traces of errors.