Merge branch 'develop' into partial_sell2

This commit is contained in:
மனோஜ்குமார் பழனிச்சாமி
2022-04-04 20:26:35 +05:30
committed by GitHub
9 changed files with 50 additions and 20 deletions

View File

@@ -8,12 +8,13 @@ from datetime import datetime, time, timezone
from decimal import Decimal
from math import isclose
from threading import Lock
from typing import Any, Dict, List, Literal, Optional, Tuple
from typing import Any, Dict, List, Optional, Tuple
from schedule import Scheduler
from freqtrade import __version__, constants
from freqtrade.configuration import validate_config_consistency
from freqtrade.constants import LongShort
from freqtrade.data.converter import order_book_to_dataframe
from freqtrade.data.dataprovider import DataProvider
from freqtrade.edge import Edge
@@ -611,7 +612,7 @@ class FreqtradeBot(LoggingMixin):
time_in_force = self.strategy.order_time_in_force['entry']
[side, name] = ['sell', 'Short'] if is_short else ['buy', 'Long']
trade_side: Literal['long', 'short'] = 'short' if is_short else 'long'
trade_side: LongShort = 'short' if is_short else 'long'
pos_adjust = trade is not None
enter_limit_requested, stake_amount, leverage = self.get_valid_enter_price_and_stake(
@@ -765,7 +766,7 @@ class FreqtradeBot(LoggingMixin):
def get_valid_enter_price_and_stake(
self, pair: str, price: Optional[float], stake_amount: float,
trade_side: Literal['long', 'short'],
trade_side: LongShort,
entry_tag: Optional[str],
trade: Optional[Trade]
) -> Tuple[float, float, float]:
@@ -779,7 +780,9 @@ class FreqtradeBot(LoggingMixin):
custom_entry_price = strategy_safe_wrapper(self.strategy.custom_entry_price,
default_retval=proposed_enter_rate)(
pair=pair, current_time=datetime.now(timezone.utc),
proposed_rate=proposed_enter_rate, entry_tag=entry_tag)
proposed_rate=proposed_enter_rate, entry_tag=entry_tag,
side=trade_side,
)
enter_limit_requested = self.get_valid_price(custom_entry_price, proposed_enter_rate)