From 612b9fad7670406a72986762581f81aad462d9a0 Mon Sep 17 00:00:00 2001 From: Mikko Ohtamaa Date: Thu, 24 Nov 2022 10:34:44 +0100 Subject: [PATCH] Adding new strategy configuration system --- configurations/README.md | 4 ++- env/README.md | 7 +++++ env/pancake-eth-usd-sma.env | 31 +++++++++++++++++++++++ scripts/create-docker-env-with-secrets.sh | 27 ++++++++++++++++++++ 4 files changed, 68 insertions(+), 1 deletion(-) create mode 100755 env/README.md create mode 100644 env/pancake-eth-usd-sma.env create mode 100755 scripts/create-docker-env-with-secrets.sh diff --git a/configurations/README.md b/configurations/README.md index f1b0842f7..ca6a01b87 100755 --- a/configurations/README.md +++ b/configurations/README.md @@ -1,4 +1,6 @@ -# Executor configurations +# Executor configurations (legacy) + +**These are legacy configuration files. See [../env/] This folder contains configuration scripts for different trading strategy executions diff --git a/env/README.md b/env/README.md new file mode 100755 index 000000000..fb1bb59e5 --- /dev/null +++ b/env/README.md @@ -0,0 +1,7 @@ +# Executor configurations (legacy) + +**These are legacy configuration files. See [env folder](../env/) for recent files. + +This folder contains configuration scripts for different trading strategy executions. +These are incomplete configuration files that need to be processed +by `create-docker-env-secrets.sh.` diff --git a/env/pancake-eth-usd-sma.env b/env/pancake-eth-usd-sma.env new file mode 100644 index 000000000..5019846cc --- /dev/null +++ b/env/pancake-eth-usd-sma.env @@ -0,0 +1,31 @@ +# +# This is a configuration file for pancake-eth-usdc-sma.py strategy +# +# This is only partial configuration. +# To createa full .env configuration file for Docker container, which also contains secrets, +# you need to run create-docker-env-with-secrets.sh having this file as an input. +# + +# Metadata + +EXECUTOR_ID=pancake-eth-usd-sma +NAME="Quickswap momentum" +DOMAIN_NAME="pancake-eth-usd-sma.tradingstrategy.ai" +SHORT_DESCRIPTION="A data collection test that trades on Polygon MATIC/USDC pairs." +LONG_DESCRIPTION="This strategy is a test strategy that does not aim to generated profit. The strategy trades on MATIC/USDC pairs on QuickSwap. The strategy rebalances every 16 hours to generate maximum amount of data. Based on 4h candles, the strategy calculates the momentum and picks highest gainers. The portfolio can hold 6 positions at once." +ICON_URL="https://i0.wp.com/bloody-disgusting.com/wp-content/uploads/2022/01/watch-robocop-the-series.png?w=1270" + +# 12 hours +export MAX_DATA_DELAY_MINUTES=720 + +# Blockchain transaction broadcasting parameters +GAS_PRICE_METHOD="london" +EXECUTION_TYPE="uniswap_v2_hot_wallet" +APPROVAL_TYPE="unchecked" + +# Webhook server configuration for Docker. +# Always static. +# This is mapped to the host in docker-compose.yml +HTTP_PORT=3456 +HTTP_HOST=0.0.0.0 + diff --git a/scripts/create-docker-env-with-secrets.sh b/scripts/create-docker-env-with-secrets.sh new file mode 100755 index 000000000..838bf76fd --- /dev/null +++ b/scripts/create-docker-env-with-secrets.sh @@ -0,0 +1,27 @@ +# +# Creates .env file for a trade-executor Docker container +# +# - Reads public .env configuration variables +# - Reads secret environment variables +# - Generates some file locations based on the strategy id +# - Validates environment variables +# - Writes the output to a single file +# +# Usage: +# +# # Load your non-committed secrets from the server root +# source ~/my-secrets.env +# +# # Combine the env configuration file with the secrets +# scripts/create-docker-env-with-secrets.sh env/pancake-eth-usd-sma.env > ~/pancake-eth-usd-sma-final.env +# + + + +# +# Generated environment variables. +# These maps to the physical paths on the server, +# also mapped in docker-compose.yml +# +export CACHE_PATH="cache/${EXECUTOR_ID}" +export STRATEGY_FILE="strategies/${EXECUTOR_ID}.py"