mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
Merge branch 'develop' into feature/update_sl_order_mgt
This commit is contained in:
commit
931704abcc
3
.github/workflows/pre-commit-update.yml
vendored
3
.github/workflows/pre-commit-update.yml
vendored
|
@ -17,6 +17,9 @@ jobs:
|
|||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.11"
|
||||
|
||||
|
||||
- name: Install pre-commit
|
||||
run: pip install pre-commit
|
||||
|
|
|
@ -9,7 +9,7 @@ repos:
|
|||
# stages: [push]
|
||||
|
||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||
rev: "v1.7.1"
|
||||
rev: "v1.8.0"
|
||||
hooks:
|
||||
- id: mypy
|
||||
exclude: build_helpers
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
coveralls==3.3.1
|
||||
ruff==0.1.8
|
||||
mypy==1.7.1
|
||||
mypy==1.8.0
|
||||
pre-commit==3.6.0
|
||||
pytest==7.4.3
|
||||
pytest-asyncio==0.21.1
|
||||
|
|
|
@ -9,7 +9,7 @@ from sqlalchemy import select
|
|||
from freqtrade.edge import PairInfo
|
||||
from freqtrade.enums import SignalDirection, State, TradingMode
|
||||
from freqtrade.exceptions import ExchangeError, InvalidOrderException, TemporaryError
|
||||
from freqtrade.persistence import Trade
|
||||
from freqtrade.persistence import Order, Trade
|
||||
from freqtrade.persistence.pairlock_middleware import PairLocks
|
||||
from freqtrade.rpc import RPC, RPCException
|
||||
from freqtrade.rpc.fiat_convert import CryptoToFiatConverter
|
||||
|
@ -354,8 +354,18 @@ def test_rpc_delete_trade(mocker, default_conf, fee, markets, caplog, is_short):
|
|||
rpc._rpc_delete('200')
|
||||
|
||||
trades = Trade.session.scalars(select(Trade)).all()
|
||||
trades[1].stoploss_order_id = '1234'
|
||||
trades[2].stoploss_order_id = '1234'
|
||||
trades[2].stoploss_order_id = '102'
|
||||
trades[2].orders.append(
|
||||
Order(
|
||||
ft_order_side='stoploss',
|
||||
ft_pair=trades[2].pair,
|
||||
ft_is_open=True,
|
||||
ft_amount=trades[2].amount,
|
||||
ft_price=trades[2].stop_loss,
|
||||
order_id='102',
|
||||
status='open',
|
||||
)
|
||||
)
|
||||
assert len(trades) > 2
|
||||
|
||||
res = rpc._rpc_delete('1')
|
||||
|
@ -368,7 +378,7 @@ def test_rpc_delete_trade(mocker, default_conf, fee, markets, caplog, is_short):
|
|||
cancel_mock.reset_mock()
|
||||
stoploss_mock.reset_mock()
|
||||
|
||||
res = rpc._rpc_delete('2')
|
||||
res = rpc._rpc_delete('5')
|
||||
assert isinstance(res, dict)
|
||||
assert stoploss_mock.call_count == 1
|
||||
assert res['cancel_order_count'] == 1
|
||||
|
|
|
@ -728,7 +728,6 @@ def test_api_delete_trade(botclient, mocker, fee, markets, is_short):
|
|||
|
||||
ftbot.strategy.order_types['stoploss_on_exchange'] = True
|
||||
trades = Trade.session.scalars(select(Trade)).all()
|
||||
trades[1].stoploss_order_id = '1234'
|
||||
Trade.commit()
|
||||
assert len(trades) > 2
|
||||
|
||||
|
@ -745,9 +744,9 @@ def test_api_delete_trade(botclient, mocker, fee, markets, is_short):
|
|||
assert cancel_mock.call_count == 0
|
||||
|
||||
assert len(trades) - 1 == len(Trade.session.scalars(select(Trade)).all())
|
||||
rc = client_delete(client, f"{BASE_URI}/trades/2")
|
||||
rc = client_delete(client, f"{BASE_URI}/trades/5")
|
||||
assert_response(rc)
|
||||
assert rc.json()['result_msg'] == 'Deleted trade 2. Closed 1 open orders.'
|
||||
assert rc.json()['result_msg'] == 'Deleted trade 5. Closed 1 open orders.'
|
||||
assert len(trades) - 2 == len(Trade.session.scalars(select(Trade)).all())
|
||||
assert stoploss_mock.call_count == 1
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user