fix remaining amount check

This commit is contained in:
மனோஜ்குமார் பழனிச்சாமி 2022-04-09 16:19:27 +05:30
parent a77e3ea378
commit e3a57ec3be
2 changed files with 111 additions and 108 deletions

217
.gitignore vendored
View File

@ -1,107 +1,110 @@
# Freqtrade rules # Freqtrade rules
config*.json config*.json
*.sqlite *.sqlite
*.sqlite-shm *.sqlite-shm
*.sqlite-wal *.sqlite-wal
logfile.txt logfile.txt
user_data/* user_data/*
!user_data/strategy/sample_strategy.py !user_data/strategy/sample_strategy.py
!user_data/notebooks !user_data/notebooks
user_data/notebooks/* user_data/notebooks/*
freqtrade-plot.html freqtrade-plot.html
freqtrade-profit-plot.html freqtrade-profit-plot.html
freqtrade/rpc/api_server/ui/* freqtrade/rpc/api_server/ui/*
# Macos related # Macos related
.DS_Store .DS_Store
# Byte-compiled / optimized / DLL files # git files after merging
__pycache__/ *.orig
*.py[cod]
*$py.class # Byte-compiled / optimized / DLL files
__pycache__/
# C extensions *.py[cod]
*.so *$py.class
# Distribution / packaging # C extensions
.Python *.so
env/
build/ # Distribution / packaging
develop-eggs/ .Python
dist/ env/
downloads/ build/
eggs/ develop-eggs/
.eggs/ dist/
lib/ downloads/
lib64/ eggs/
parts/ .eggs/
sdist/ lib/
var/ lib64/
wheels/ parts/
*.egg-info/ sdist/
.installed.cfg var/
*.egg wheels/
*.egg-info/
# PyInstaller .installed.cfg
# Usually these files are written by a python script from a template *.egg
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest # PyInstaller
*.spec # 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.
# Installer logs *.manifest
pip-log.txt *.spec
pip-delete-this-directory.txt
# Installer logs
# Unit test / coverage reports pip-log.txt
htmlcov/ pip-delete-this-directory.txt
.tox/
.coverage # Unit test / coverage reports
.coverage.* htmlcov/
.cache .tox/
nosetests.xml .coverage
coverage.xml .coverage.*
*.cover .cache
.hypothesis/ nosetests.xml
coverage.xml
# Translations *.cover
*.mo .hypothesis/
*.pot
# Translations
# Django stuff: *.mo
*.log *.pot
local_settings.py
# Django stuff:
# Flask stuff: *.log
instance/ local_settings.py
.webassets-cache
# Flask stuff:
# Scrapy stuff: instance/
.scrapy .webassets-cache
# Sphinx documentation # Scrapy stuff:
docs/_build/ .scrapy
# PyBuilder # Sphinx documentation
target/ docs/_build/
# Jupyter Notebook # PyBuilder
*.ipynb_checkpoints target/
# pyenv # Jupyter Notebook
.python-version *.ipynb_checkpoints
.env # pyenv
.venv .python-version
.idea
.vscode .env
.venv
.pytest_cache/ .idea
.mypy_cache/ .vscode
#exceptions .pytest_cache/
!*.gitkeep .mypy_cache/
!config_examples/config_binance.example.json
!config_examples/config_bittrex.example.json #exceptions
!config_examples/config_ftx.example.json !*.gitkeep
!config_examples/config_full.example.json !config_examples/config_binance.example.json
!config_examples/config_kraken.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

View File

@ -549,7 +549,7 @@ class FreqtradeBot(LoggingMixin):
# We should decrease our position # We should decrease our position
# Strategy should return value as Decimal for accuracy. # Strategy should return value as Decimal for accuracy.
amount = abs(float(Decimal(stake_amount) / Decimal(current_exit_rate))) 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') logger.info('Remaining amount would be too small')
return return
if amount > trade.amount: if amount > trade.amount: