Self-adjusting, auto-compounding multi-pair DCA crypto trading bot using Python, AWS Lambda & 3Commas API

Overview

Self-adjusting, auto-compounding multi-pair DCA crypto trading bot using Python, AWS Lambda & 3Commas API

The following code describes how we can leverage Python & AWS Lambda & 3Commas API to automatically adjust the Base and Safety order size of a DCA crypto trading multi-pair bot based on the total balance available in the account.

More details in the following article: https://www.joe0.com/2021/10/30/how-to-create-self-adjusting-auto-compounding-dca-crypto-trading-bot-using-python-aws-lambda-by-leveraging-3commas-api/

Flow Depiction

alt text

Source Code & Licensing

  • This project is open-source released under GNU GENERAL PUBLIC LICENSE - Version 2, June 1991.
  • Feel free to fork and further enhance this project.
  • Application is coded entirely in Python

Dependencies

  • cctx
  • certifi
  • charset_normalizer
  • idna
  • py3cw
  • requests

Support

Author / Contact

You might also like...
POC de uma AWS lambda que executa a consulta de preços de criptomoedas, e é implantada na AWS usando Github actions.
POC de uma AWS lambda que executa a consulta de preços de criptomoedas, e é implantada na AWS usando Github actions.

Cryptocurrency Prices Overview Instalação Repositório Configuração CI/CD Roadmap Testes Overview A ideia deste projeto é aplicar o conteúdo estudado s

AWS-serverless-starter - AWS Lambda serverless stack via Serverless framework
AWS-serverless-starter - AWS Lambda serverless stack via Serverless framework

Serverless app via AWS Lambda, ApiGateway and Serverless framework Configuration

AHA is an incident management & communication framework to provide real-time alert customers when there are active AWS event(s). For customers with AWS Organizations, customers can get aggregated active account level events of all the accounts in the Organization. Customers not using AWS Organizations still benefit alerting at the account level. Implement backup and recovery with AWS Backup across your AWS Organizations using a CI/CD pipeline (AWS CodePipeline).
Implement backup and recovery with AWS Backup across your AWS Organizations using a CI/CD pipeline (AWS CodePipeline).

Backup and Recovery with AWS Backup This repository provides you with a management and deployment solution for implementing Backup and Recovery with A

Freqtrade 3commas wrapper for python
Freqtrade 3commas wrapper for python

Freqtrade 3commas wrapper The aim of this project is to provide an easy way to integrate freqtrade with 3commas. The main reason someone would want to

Trading bot - A Trading bot With Python
Trading bot - A Trading bot With Python

Trading_bot Trading bot intended for 1) Tracking current prices of tokens 2) Set

Tsar-Bot - Crypto auto trade bot that use sentiment analysis from twitter
Tsar-Bot - Crypto auto trade bot that use sentiment analysis from twitter

Tsar Bot - Crypto Sentiment Bot Tsar Bot is a Twitter Crypto Sentiment Bot that

AWS Lambda Fast API starter application

AWS Lambda Fast API Fast API starter application compatible with API Gateway and Lambda Function. How to deploy it? Terraform AWS Lambda API is a reus

Comments
  • [Suggestion] A better way to calculate safety order size

    [Suggestion] A better way to calculate safety order size

    Didn't know where else to contact you or where else to put this. I'm not gonna lie, I didn't stop to truly analyze your logic for calculating order sizes, but you may be interested in this:

    https://www.wolframalpha.com/input/?i2d=true&i=Sum%5Bx*Power%5B%5C%2840%29y%2Ci%5D%5C%2841%29%2C%7Bi%2C0%2Cj-1%7D%5D%3Dm%5C%2844%29+solve+for+x

    That is essentially the formula that safety orders follow (max funds for safety orders "m" is a summation of all safety order sizes, where each safety order size is the base safety order size "x" by the martingale volume coefficient "y" to the power of the safety order number "i" starting from 0 up to the max safety orders number "j" minus 1. I don't account for fees but really the idea shouldn't change much). By solving for X (the safety order size) like I did on wolfram alpha, we get the following formula (I have it in JS):

    const calculateSafetyOrderSize = (maxSOs, volumeStepScale, availableFundsForSOs) => { const SOSize = (availableFundsForSOs * (volumeStepScale - 1)) / (Math.pow(volumeStepScale, maxSOs) - 1); return Math.round((SOSize + Number.EPSILON) * 100) / 100; }

    So you need the martingale volume coefficient for this formula (which honestly should be a given in order to account for different approaches), and the total amount of funds you'd want to reserve for safety orders.

    My idea is that if you want to style your bot differently than by using a specific safety order strategy, you'll find numbers that work for you, and then you'll probably want to preserve that ratio of base order size to safety order funds size (in my case I use 500 dollars per deal, 100 dollars for base order and 400 dollars for safety orders, where I have 8 max SOs with a volume scale of 1.3, so inputting 400 dollars into the formula alongside 8 max safety orders and martingale volume coefficient of 1.3 would give me the safety order size of 16.7).

    This does imply the knowledge of said base-to-safety volume ratio in order to calculate base order sizes from max funds per deal, which in my case the value 0,2 would give me what I'm looking for (500 * 0.2 = 100, base order size found and you go from there).

    Also, if you request the bot data and then just pass it back as you received it (with some minor tweaks), you can skip the whole "setting all the bot settings on the script" part.

    Also also, you should link this repository on your article since the formatting of the python code in the article makes it a nightmare to understand.

    opened by Slyther 0
Owner
Jozef Jaroščiak
Jozef Jaroščiak
Aws-lambda-requests-wrapper - Request/Response wrapper for AWS Lambda with API Gateway

AWS Lambda Requests Wrapper Request/Response wrapper for AWS Lambda with API Gat

null 1 May 20, 2022
Python + AWS Lambda Hands OnPython + AWS Lambda Hands On

Python + AWS Lambda Hands On Python Criada em 1990, por Guido Van Rossum. "Bala de prata" (quase). Muito utilizado em: Automatizações - Selenium, Beau

Marcelo Ortiz de Santana 8 Sep 9, 2022
aws-lambda-scheduler lets you call any existing AWS Lambda Function you have in a future time.

aws-lambda-scheduler aws-lambda-scheduler lets you call any existing AWS Lambda Function you have in the future. This functionality is achieved by dyn

Oğuzhan Yılmaz 57 Dec 17, 2022
SSH-Restricted deploys an SSH compliance rule (AWS Config) with auto-remediation via AWS Lambda if SSH access is public.

SSH-Restricted SSH-Restricted deploys an SSH compliance rule with auto-remediation via AWS Lambda if SSH access is public. SSH-Auto-Restricted checks

Adrian Hornsby 30 Nov 8, 2022
Lambda-function - Python codes that allow notification of changes made to some services using the AWS Lambda Function

AWS Lambda Function This repository contains python codes that allow notificatio

Elif Apaydın 3 Feb 11, 2022
Cryptocurrency Trading Bot - A trading bot to automate cryptocurrency trading strategies using Python, equipped with a basic GUI

Cryptocurrency Trading Bot - A trading bot to automate cryptocurrency trading strategies using Python, equipped with a basic GUI. Used REST and WebSocket API to connect to two of the most popular crypto exchanges in the world.

Francis 8 Sep 15, 2022
Crypto-trading-simulator - Cryptocurrency trading simulator using Python, Streamlit

Crypto Trading Simulator Run streamlit run main.py Dependency Python 3 streamli

Brad 12 Jul 2, 2022
Auto Liker, Auto Reaction, Auto Comment, Auto Follower Tool. RajeLiker Credit Hacker.

Auto Liker, Auto Reaction, Auto Comment, Auto Follower Tool. RajeLiker Credit Hacker. Unlimited RajeLiker Credit Hack. Thanks To RajeLiker.

Md. Mehedi Hasan 32 Dec 28, 2022
A suite of utilities for AWS Lambda Functions that makes tracing with AWS X-Ray, structured logging and creating custom metrics asynchronously easier

A suite of utilities for AWS Lambda Functions that makes tracing with AWS X-Ray, structured logging and creating custom metrics asynchronously easier

Amazon Web Services - Labs 1.9k Jan 7, 2023