Merge branch 'freqtrade:develop' into partial_sell

This commit is contained in:
Kavinkumar 2022-03-02 16:27:21 +05:30 committed by GitHub
commit dcba781ef7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 20 additions and 9 deletions

View File

@ -1,5 +1,5 @@
""" Freqtrade bot """
__version__ = '2022.1'
__version__ = 'develop'
if __version__ == 'develop':

View File

@ -25,12 +25,16 @@ def setup_optimize_configuration(args: Dict[str, Any], method: RunMode) -> Dict[
RunMode.HYPEROPT: 'hyperoptimization',
}
if method in no_unlimited_runmodes.keys():
wallet_size = config['dry_run_wallet'] * config['tradable_balance_ratio']
# tradable_balance_ratio
if (config['stake_amount'] != constants.UNLIMITED_STAKE_AMOUNT
and config['stake_amount'] > config['dry_run_wallet']):
wallet = round_coin_value(config['dry_run_wallet'], config['stake_currency'])
and config['stake_amount'] > wallet_size):
wallet = round_coin_value(wallet_size, config['stake_currency'])
stake = round_coin_value(config['stake_amount'], config['stake_currency'])
raise OperationalException(f"Starting balance ({wallet}) "
f"is smaller than stake_amount {stake}.")
raise OperationalException(
f"Starting balance ({wallet}) is smaller than stake_amount {stake}. "
f"Wallet is calculated as `dry_run_wallet * tradable_balance_ratio`."
)
return config

View File

@ -440,7 +440,6 @@ SCHEMA_TRADE_REQUIRED = [
'dry_run_wallet',
'ask_strategy',
'bid_strategy',
'unfilledtimeout',
'stoploss',
'minimal_roi',
'internals',
@ -456,7 +455,6 @@ SCHEMA_BACKTEST_REQUIRED = [
'dry_run_wallet',
'dataformat_ohlcv',
'dataformat_trades',
'unfilledtimeout',
]
SCHEMA_MINIMAL_REQUIRED = [

View File

@ -1127,6 +1127,7 @@ class FreqtradeBot(LoggingMixin):
trade.close_date = None
trade.is_open = True
trade.open_order_id = None
trade.sell_reason = None
cancelled = True
else:
# TODO: figure out how to handle partially complete sell orders

View File

@ -2,7 +2,7 @@ numpy==1.22.2
pandas==1.4.1
pandas-ta==0.3.14b
ccxt==1.74.43
ccxt==1.74.63
# Pin cryptography for now due to rust build errors with piwheels
cryptography==36.0.1
aiohttp==3.8.1

View File

@ -132,6 +132,9 @@ function install_macos() {
echo_block "Installing Brew"
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
brew install gettext
#Gets number after decimal in python version
version=$(egrep -o 3.\[0-9\]+ <<< $PYTHON | sed 's/3.//g')

View File

@ -2554,9 +2554,12 @@ def test_handle_cancel_exit_limit(mocker, default_conf_usdt, fee) -> None:
exchange='binance',
open_rate=0.245441,
open_order_id="123456",
open_date=arrow.utcnow().datetime,
open_date=arrow.utcnow().shift(days=-2).datetime,
fee_open=fee.return_value,
fee_close=fee.return_value,
close_rate=0.555,
close_date=arrow.utcnow().datetime,
sell_reason="sell_reason_whatever",
)
order = {'remaining': 1,
'amount': 1,
@ -2565,6 +2568,8 @@ def test_handle_cancel_exit_limit(mocker, default_conf_usdt, fee) -> None:
assert freqtrade.handle_cancel_exit(trade, order, reason)
assert cancel_order_mock.call_count == 1
assert send_msg_mock.call_count == 1
assert trade.close_rate is None
assert trade.sell_reason is None
send_msg_mock.reset_mock()