177 lines
4.3 KiB
YAML
177 lines
4.3 KiB
YAML
service: freq
|
|
|
|
frameworkVersion: ">=1.1.0 <2.0.0"
|
|
|
|
plugins:
|
|
- serverless-domain-manager
|
|
- serverless-python-requirements
|
|
|
|
############################################################################################
|
|
# configure out provider and the security guide lines
|
|
############################################################################################
|
|
provider:
|
|
name: aws
|
|
runtime: python3.6
|
|
region: us-east-2
|
|
|
|
#required permissions
|
|
iamRoleStatements:
|
|
- Effect: Allow
|
|
Action:
|
|
- dynamodb:Query
|
|
- dynamodb:Scan
|
|
- dynamodb:GetItem
|
|
- dynamodb:PutItem
|
|
- dynamodb:UpdateItem
|
|
- dynamodb:DeleteItem
|
|
Resource: "arn:aws:dynamodb:${opt:region, self:provider.region}:*:table/*"
|
|
- Effect: Allow
|
|
Action:
|
|
- SNS:*
|
|
Resource: { "Fn::Join" : [":", ["arn:aws:sns:${self:custom.region}", "*:*" ] ] }
|
|
|
|
memorySize: 128
|
|
timeout: 90
|
|
versionFunctions: false
|
|
|
|
logRetentionInDays: 3
|
|
|
|
#where to store out data, needs to be manually created!
|
|
deploymentBucket:
|
|
name: lambdas-freq
|
|
|
|
############################################################################################
|
|
#custom configuration settings
|
|
############################################################################################
|
|
custom:
|
|
stage: ${opt:stage, self:provider.stage}
|
|
region: ${opt:region, self:provider.region}
|
|
|
|
snsTopic: "FreqQueue-${self:custom.stage}"
|
|
tradeTable: "FreqTradesTable-${self:custom.stage}"
|
|
strategyTable: "FreqStrategyTable-${self:custom.stage}"
|
|
|
|
###
|
|
# custom domain management
|
|
###
|
|
|
|
customDomain:
|
|
basePath: "${self:custom.stage}"
|
|
domainName: "freq.isaac.international"
|
|
stage: "${self:custom.stage}"
|
|
createRoute53Record: true
|
|
|
|
pythonRequirements:
|
|
slim: true
|
|
invalidateCaches: true
|
|
dockerizePip: false
|
|
noDeploy:
|
|
- pytest
|
|
- moto
|
|
- plotly
|
|
- boto3
|
|
- pytest-mock
|
|
- pytest-cov
|
|
- pymongo
|
|
package:
|
|
exclude:
|
|
- test/**
|
|
- __pycache__/**
|
|
- node_modules/**
|
|
|
|
############################################################################################
|
|
# this section defines all lambda function and triggers
|
|
############################################################################################
|
|
functions:
|
|
|
|
#TODO
|
|
#returns all known strategy names from the server
|
|
#and if they are private or not
|
|
strategies:
|
|
memorySize: 128
|
|
handler: freqtrade/aws/strategy.names
|
|
events:
|
|
- http:
|
|
path: strategies
|
|
method: get
|
|
cors: true
|
|
|
|
environment:
|
|
strategyTable: ${self:custom.strategyTable}
|
|
|
|
#TODO
|
|
#returns the performance for the given strategy
|
|
performance:
|
|
memorySize: 128
|
|
handler: freqtrade/aws/strategy.performance
|
|
events:
|
|
- http:
|
|
path: strategies/{name}/performance
|
|
method: get
|
|
cors: true
|
|
request:
|
|
parameter:
|
|
paths:
|
|
name: true
|
|
|
|
environment:
|
|
strategyTable: ${self:custom.strategyTable}
|
|
|
|
#TODO
|
|
#returns the source code of this given strategy
|
|
#unless it's private
|
|
code:
|
|
memorySize: 128
|
|
handler: freqtrade/aws/strategy.code
|
|
events:
|
|
- http:
|
|
path: strategies/{name}/code
|
|
method: get
|
|
cors: true
|
|
request:
|
|
parameter:
|
|
paths:
|
|
name: true
|
|
|
|
environment:
|
|
strategyTable: ${self:custom.strategyTable}
|
|
|
|
#TODO
|
|
#submits a new strategy to the system
|
|
submit:
|
|
memorySize: 128
|
|
handler: freqtrade/aws/strategy.submit
|
|
events:
|
|
- http:
|
|
path: submit
|
|
method: post
|
|
cors: true
|
|
|
|
environment:
|
|
topic: ${self:custom.snsTopic}
|
|
strategyTable: ${self:custom.strategyTable}
|
|
|
|
#TODO
|
|
#backtests the strategy
|
|
backtest:
|
|
memorySize: 256
|
|
handler: freqtrade/aws/backtesting_lambda.run
|
|
|
|
events:
|
|
- sns: ${self:custom.snsTopic}
|
|
environment:
|
|
topic: ${self:custom.snsTopic}
|
|
tradeTable: ${self:custom.tradeTable}
|
|
|
|
#TODO
|
|
# schedules all registered strategies on a daily base
|
|
daily:
|
|
memorySize: 128
|
|
handler: freqtrade/aws/backtesting_lambda.run
|
|
|
|
events:
|
|
- sns: ${self:custom.snsTopic}
|
|
environment:
|
|
topic: ${self:custom.snsTopic}
|
|
strategyTable: ${self:custom.strategyTable}
|