Merge branch 'develop' into feat/short

This commit is contained in:
Matthias 2022-03-10 06:54:20 +01:00
commit cb9da78a27
9 changed files with 51 additions and 20 deletions

View File

@ -24,10 +24,10 @@ jobs:
python-version: ["3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
@ -119,10 +119,10 @@ jobs:
python-version: ["3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
@ -211,10 +211,10 @@ jobs:
python-version: ["3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
@ -263,14 +263,14 @@ jobs:
docs_check:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Documentation syntax
run: |
./tests/test_docs.sh
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: 3.8
@ -326,10 +326,10 @@ jobs:
if: (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'release') && github.repository == 'freqtrade/freqtrade'
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: 3.8
@ -406,7 +406,7 @@ jobs:
if: (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'release') && github.repository == 'freqtrade/freqtrade'
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Extract branch name
shell: bash

View File

@ -8,7 +8,7 @@ jobs:
dockerHubDescription:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- name: Docker Hub Description
uses: peter-evans/dockerhub-description@v2.4.3
env:

View File

@ -58,7 +58,8 @@
"forcebuy": "market",
"stoploss": "market",
"stoploss_on_exchange": false,
"stoploss_on_exchange_interval": 60
"stoploss_on_exchange_interval": 60,
"stoploss_on_exchange_limit_ratio": 0.99
},
"order_time_in_force": {
"entry": "gtc",

View File

@ -1,4 +1,4 @@
mkdocs==1.2.3
mkdocs-material==8.2.3
mkdocs-material==8.2.5
mdx_truly_sane_lists==1.2
pymdown-extensions==9.2

View File

@ -1077,7 +1077,9 @@ class FreqtradeBot(LoggingMixin):
:param order: Current on exchange stoploss order
:return: None
"""
if self.exchange.stoploss_adjust(trade.stop_loss, order, side=trade.exit_side):
stoploss_norm = self.exchange.price_to_precision(trade.pair, trade.stop_loss)
if self.exchange.stoploss_adjust(stoploss_norm, order, side=trade.exit_side):
# we check if the update is necessary
update_beat = self.strategy.order_types.get('stoploss_on_exchange_interval', 60)
if (datetime.utcnow() - trade.stoploss_last_update).total_seconds() >= update_beat:

View File

@ -23,6 +23,7 @@ coingecko_mapping = {
'eth': 'ethereum',
'bnb': 'binancecoin',
'sol': 'solana',
'usdt': 'tether',
}

View File

@ -8,7 +8,7 @@ flake8==4.0.1
flake8-tidy-imports==4.6.0
mypy==0.931
pytest==7.0.1
pytest-asyncio==0.18.1
pytest-asyncio==0.18.2
pytest-cov==3.0.0
pytest-mock==3.7.0
pytest-random-order==1.0.4
@ -20,7 +20,7 @@ time-machine==2.6.0
nbconvert==6.4.2
# mypy types
types-cachetools==4.2.9
types-cachetools==4.2.10
types-filelock==3.2.5
types-requests==2.27.11
types-tabulate==0.8.5

View File

@ -2,11 +2,11 @@ numpy==1.22.2
pandas==1.4.1
pandas-ta==0.3.14b
ccxt==1.74.63
ccxt==1.75.12
# Pin cryptography for now due to rust build errors with piwheels
cryptography==36.0.1
aiohttp==3.8.1
SQLAlchemy==1.4.31
SQLAlchemy==1.4.32
python-telegram-bot==13.11
arrow==1.2.2
cachetools==4.2.2
@ -31,7 +31,7 @@ python-rapidjson==1.6
sdnotify==0.3.2
# API Server
fastapi==0.74.1
fastapi==0.75.0
uvicorn==0.17.5
pyjwt==2.3.0
aiofiles==0.8.0

View File

@ -1508,7 +1508,34 @@ def test_handle_stoploss_on_exchange_trailing_error(
assert log_has_re(r"Could not create trailing stoploss order for pair ETH/USDT\..*", caplog)
def test_stoploss_on_exchange_price_rounding(
mocker, default_conf_usdt, fee, open_trade_usdt) -> None:
patch_RPCManager(mocker)
mocker.patch.multiple(
'freqtrade.exchange.Exchange',
get_fee=fee,
)
price_mock = MagicMock(side_effect=lambda p, s: int(s))
stoploss_mock = MagicMock(return_value={'id': '13434334'})
adjust_mock = MagicMock(return_value=False)
mocker.patch.multiple(
'freqtrade.exchange.Binance',
stoploss=stoploss_mock,
stoploss_adjust=adjust_mock,
price_to_precision=price_mock,
)
freqtrade = get_patched_freqtradebot(mocker, default_conf_usdt)
open_trade_usdt.stoploss_order_id = '13434334'
open_trade_usdt.stop_loss = 222.55
freqtrade.handle_trailing_stoploss_on_exchange(open_trade_usdt, {})
assert price_mock.call_count == 1
assert adjust_mock.call_count == 1
assert adjust_mock.call_args_list[0][0][0] == 222
@pytest.mark.parametrize("is_short", [False, True])
@pytest.mark.usefixtures("init_persistence")
def test_handle_stoploss_on_exchange_custom_stop(
mocker, default_conf_usdt, fee, is_short, limit_order
) -> None: