From e3a57ec3be4ce1c4904e7a8fc06ef6c022523fd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=AE=AE=E0=AE=A9=E0=AF=8B=E0=AE=9C=E0=AF=8D=E0=AE=95?= =?UTF-8?q?=E0=AF=81=E0=AE=AE=E0=AE=BE=E0=AE=B0=E0=AF=8D=20=E0=AE=AA?= =?UTF-8?q?=E0=AE=B4=E0=AE=A9=E0=AE=BF=E0=AE=9A=E0=AF=8D=E0=AE=9A=E0=AE=BE?= =?UTF-8?q?=E0=AE=AE=E0=AE=BF?= Date: Sat, 9 Apr 2022 16:19:27 +0530 Subject: [PATCH] fix remaining amount check --- .gitignore | 217 +++++++++++++++++++------------------- freqtrade/freqtradebot.py | 2 +- 2 files changed, 111 insertions(+), 108 deletions(-) diff --git a/.gitignore b/.gitignore index 97f77f779..23f505ea0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,107 +1,110 @@ -# Freqtrade rules -config*.json -*.sqlite -*.sqlite-shm -*.sqlite-wal -logfile.txt -user_data/* -!user_data/strategy/sample_strategy.py -!user_data/notebooks -user_data/notebooks/* -freqtrade-plot.html -freqtrade-profit-plot.html -freqtrade/rpc/api_server/ui/* - -# Macos related -.DS_Store - -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class - -# C extensions -*.so - -# Distribution / packaging -.Python -env/ -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -wheels/ -*.egg-info/ -.installed.cfg -*.egg - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*.cover -.hypothesis/ - -# Translations -*.mo -*.pot - -# Django stuff: -*.log -local_settings.py - -# Flask stuff: -instance/ -.webassets-cache - -# Scrapy stuff: -.scrapy - -# Sphinx documentation -docs/_build/ - -# PyBuilder -target/ - -# Jupyter Notebook -*.ipynb_checkpoints - -# pyenv -.python-version - -.env -.venv -.idea -.vscode - -.pytest_cache/ -.mypy_cache/ - -#exceptions -!*.gitkeep -!config_examples/config_binance.example.json -!config_examples/config_bittrex.example.json -!config_examples/config_ftx.example.json -!config_examples/config_full.example.json -!config_examples/config_kraken.example.json +# Freqtrade rules +config*.json +*.sqlite +*.sqlite-shm +*.sqlite-wal +logfile.txt +user_data/* +!user_data/strategy/sample_strategy.py +!user_data/notebooks +user_data/notebooks/* +freqtrade-plot.html +freqtrade-profit-plot.html +freqtrade/rpc/api_server/ui/* + +# Macos related +.DS_Store + +# git files after merging +*.orig + +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +.hypothesis/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +*.ipynb_checkpoints + +# pyenv +.python-version + +.env +.venv +.idea +.vscode + +.pytest_cache/ +.mypy_cache/ + +#exceptions +!*.gitkeep +!config_examples/config_binance.example.json +!config_examples/config_bittrex.example.json +!config_examples/config_ftx.example.json +!config_examples/config_full.example.json +!config_examples/config_kraken.example.json diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py index 5a70ed470..adf33babe 100644 --- a/freqtrade/freqtradebot.py +++ b/freqtrade/freqtradebot.py @@ -549,7 +549,7 @@ class FreqtradeBot(LoggingMixin): # We should decrease our position # Strategy should return value as Decimal for accuracy. amount = abs(float(Decimal(stake_amount) / Decimal(current_exit_rate))) - if trade.amount - amount < min_exit_stake: + if (trade.amount - amount) * current_exit_rate < min_exit_stake: logger.info('Remaining amount would be too small') return if amount > trade.amount: