diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fc7648cd8..476d63847 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -18,7 +18,7 @@ repos: - types-requests==2.31.0.1 - types-tabulate==0.9.0.2 - types-python-dateutil==2.8.19.13 - - SQLAlchemy==2.0.15 + - SQLAlchemy==2.0.16 # stages: [push] - repo: https://github.com/pycqa/isort diff --git a/freqtrade/exchange/okx.py b/freqtrade/exchange/okx.py index 8ad3c2cdb..c703e3a78 100644 --- a/freqtrade/exchange/okx.py +++ b/freqtrade/exchange/okx.py @@ -199,6 +199,7 @@ class Okx(Exchange): order_reg['type'] = 'stoploss' order_reg['status_stop'] = 'triggered' return order_reg + order = self._order_contracts_to_amount(order) order['type'] = 'stoploss' return order diff --git a/freqtrade/persistence/trade_model.py b/freqtrade/persistence/trade_model.py index 5d8aada6b..5dee2a53c 100644 --- a/freqtrade/persistence/trade_model.py +++ b/freqtrade/persistence/trade_model.py @@ -97,7 +97,7 @@ class Order(ModelBase): @property def safe_filled(self) -> float: - return self.filled if self.filled is not None else self.amount or 0.0 + return self.filled if self.filled is not None else 0.0 @property def safe_cost(self) -> float: @@ -703,7 +703,7 @@ class LocalTrade(): self.stoploss_order_id = None self.close_rate_requested = self.stop_loss self.exit_reason = ExitType.STOPLOSS_ON_EXCHANGE.value - if self.is_open: + if self.is_open and order.safe_filled > 0: logger.info(f'{order.order_type.upper()} is hit for {self}.') else: raise ValueError(f'Unknown order type: {order.order_type}') diff --git a/requirements-dev.txt b/requirements-dev.txt index 5822dd595..5239cd993 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -7,10 +7,10 @@ -r docs/requirements-docs.txt coveralls==3.3.1 -ruff==0.0.270 +ruff==0.0.272 mypy==1.3.0 pre-commit==3.3.2 -pytest==7.3.1 +pytest==7.3.2 pytest-asyncio==0.21.0 pytest-cov==4.1.0 pytest-mock==3.10.0 diff --git a/requirements-hyperopt.txt b/requirements-hyperopt.txt index 87b1fd3c8..20c60afe0 100644 --- a/requirements-hyperopt.txt +++ b/requirements-hyperopt.txt @@ -5,4 +5,4 @@ scipy==1.10.1 scikit-learn==1.1.3 scikit-optimize==0.9.0 -filelock==3.12.0 +filelock==3.12.1 diff --git a/requirements-plot.txt b/requirements-plot.txt index 8b9ad5bc4..72303efcb 100644 --- a/requirements-plot.txt +++ b/requirements-plot.txt @@ -1,4 +1,4 @@ # Include all requirements to run the bot. -r requirements.txt -plotly==5.14.1 +plotly==5.15.0 diff --git a/requirements.txt b/requirements.txt index 118ad95e2..a8c1611c4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,18 +2,18 @@ numpy==1.24.3 pandas==2.0.2 pandas-ta==0.3.14b -ccxt==3.1.23 +ccxt==3.1.34 cryptography==41.0.1; platform_machine != 'armv7l' cryptography==40.0.1; platform_machine == 'armv7l' aiohttp==3.8.4 -SQLAlchemy==2.0.15 +SQLAlchemy==2.0.16 python-telegram-bot==20.3 # can't be hard-pinned due to telegram-bot pinning httpx with ~ httpx>=0.24.1 arrow==1.2.3 cachetools==5.3.1 requests==2.31.0 -urllib3==2.0.2 +urllib3==2.0.3 jsonschema==4.17.3 TA-Lib==0.4.26 technical==1.4.0 @@ -32,14 +32,14 @@ py_find_1st==1.1.5 # Load ticker files 30% faster python-rapidjson==1.10 # Properly format api responses -orjson==3.9.0 +orjson==3.9.1 # Notify systemd sdnotify==0.3.2 # API Server fastapi==0.96.0 -pydantic==1.10.8 +pydantic==1.10.9 uvicorn==0.22.0 pyjwt==2.7.0 aiofiles==23.1.0 diff --git a/tests/test_freqtradebot.py b/tests/test_freqtradebot.py index 71f494372..945a81aa6 100644 --- a/tests/test_freqtradebot.py +++ b/tests/test_freqtradebot.py @@ -1241,6 +1241,8 @@ def test_handle_stoploss_on_exchange(mocker, default_conf_usdt, fee, caplog, is_ 'type': 'stop_loss_limit', 'price': 3, 'average': 2, + 'filled': enter_order['amount'], + 'remaining': 0, 'amount': enter_order['amount'], }) mocker.patch(f'{EXMS}.fetch_stoploss_order', stoploss_order_hit)