Change usdt stake_amount to 60$
This commit is contained in:
parent
058c7b3e99
commit
9e77a739fa
@ -376,7 +376,7 @@ def get_default_conf(testdatadir):
|
|||||||
def get_default_conf_usdt(testdatadir):
|
def get_default_conf_usdt(testdatadir):
|
||||||
configuration = get_default_conf(testdatadir)
|
configuration = get_default_conf(testdatadir)
|
||||||
configuration.update({
|
configuration.update({
|
||||||
"stake_amount": 10.0,
|
"stake_amount": 60.0,
|
||||||
"stake_currency": "USDT",
|
"stake_currency": "USDT",
|
||||||
"exchange": {
|
"exchange": {
|
||||||
"name": "binance",
|
"name": "binance",
|
||||||
|
@ -126,14 +126,14 @@ def test_get_trade_stake_amount(default_conf_usdt, mocker) -> None:
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("amend_last,wallet,max_open,lsamr,expected", [
|
@pytest.mark.parametrize("amend_last,wallet,max_open,lsamr,expected", [
|
||||||
(False, 20, 2, 0.5, [10, None]),
|
(False, 120, 2, 0.5, [60, None]),
|
||||||
(True, 20, 2, 0.5, [10, 9.8]),
|
(True, 120, 2, 0.5, [60, 58.8]),
|
||||||
(False, 30, 3, 0.5, [10, 10, None]),
|
(False, 180, 3, 0.5, [60, 60, None]),
|
||||||
(True, 30, 3, 0.5, [10, 10, 9.7]),
|
(True, 180, 3, 0.5, [60, 60, 58.2]),
|
||||||
(False, 22, 3, 0.5, [10, 10, None]),
|
(False, 122, 3, 0.5, [60, 60, None]),
|
||||||
(True, 22, 3, 0.5, [10, 10, 0.0]),
|
(True, 122, 3, 0.5, [60, 60, 0.0]),
|
||||||
(True, 27, 3, 0.5, [10, 10, 6.73]),
|
(True, 167, 3, 0.5, [60, 60, 45.33]),
|
||||||
(True, 22, 3, 1, [10, 10, 0.0]),
|
(True, 122, 3, 1, [60, 60, 0.0]),
|
||||||
])
|
])
|
||||||
def test_check_available_stake_amount(
|
def test_check_available_stake_amount(
|
||||||
default_conf_usdt, ticker_usdt, mocker, fee, limit_buy_order_usdt_open,
|
default_conf_usdt, ticker_usdt, mocker, fee, limit_buy_order_usdt_open,
|
||||||
@ -256,7 +256,7 @@ def test_total_open_trades_stakes(mocker, default_conf_usdt, ticker_usdt, fee) -
|
|||||||
trade = Trade.query.first()
|
trade = Trade.query.first()
|
||||||
|
|
||||||
assert trade is not None
|
assert trade is not None
|
||||||
assert trade.stake_amount == 10.0
|
assert trade.stake_amount == 60.0
|
||||||
assert trade.is_open
|
assert trade.is_open
|
||||||
assert trade.open_date is not None
|
assert trade.open_date is not None
|
||||||
|
|
||||||
@ -264,11 +264,11 @@ def test_total_open_trades_stakes(mocker, default_conf_usdt, ticker_usdt, fee) -
|
|||||||
trade = Trade.query.order_by(Trade.id.desc()).first()
|
trade = Trade.query.order_by(Trade.id.desc()).first()
|
||||||
|
|
||||||
assert trade is not None
|
assert trade is not None
|
||||||
assert trade.stake_amount == 10.0
|
assert trade.stake_amount == 60.0
|
||||||
assert trade.is_open
|
assert trade.is_open
|
||||||
assert trade.open_date is not None
|
assert trade.open_date is not None
|
||||||
|
|
||||||
assert Trade.total_open_trades_stakes() == 20.0
|
assert Trade.total_open_trades_stakes() == 120.0
|
||||||
|
|
||||||
|
|
||||||
def test_create_trade(default_conf_usdt, ticker_usdt, limit_buy_order_usdt, fee, mocker) -> None:
|
def test_create_trade(default_conf_usdt, ticker_usdt, limit_buy_order_usdt, fee, mocker) -> None:
|
||||||
@ -289,7 +289,7 @@ def test_create_trade(default_conf_usdt, ticker_usdt, limit_buy_order_usdt, fee,
|
|||||||
|
|
||||||
trade = Trade.query.first()
|
trade = Trade.query.first()
|
||||||
assert trade is not None
|
assert trade is not None
|
||||||
assert trade.stake_amount == 10.0
|
assert trade.stake_amount == 60.0
|
||||||
assert trade.is_open
|
assert trade.is_open
|
||||||
assert trade.open_date is not None
|
assert trade.open_date is not None
|
||||||
assert trade.exchange == 'binance'
|
assert trade.exchange == 'binance'
|
||||||
@ -467,7 +467,7 @@ def test_create_trades_multiple_trades(
|
|||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
default_conf_usdt['max_open_trades'] = max_open
|
default_conf_usdt['max_open_trades'] = max_open
|
||||||
default_conf_usdt['tradable_balance_ratio'] = tradable_balance_ratio
|
default_conf_usdt['tradable_balance_ratio'] = tradable_balance_ratio
|
||||||
default_conf_usdt['dry_run_wallet'] = 10.0 * max_open
|
default_conf_usdt['dry_run_wallet'] = 60.0 * max_open
|
||||||
|
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
'freqtrade.exchange.Exchange',
|
'freqtrade.exchange.Exchange',
|
||||||
@ -544,10 +544,10 @@ def test_process_trade_creation(default_conf_usdt, ticker_usdt, limit_buy_order_
|
|||||||
assert trade.open_date is not None
|
assert trade.open_date is not None
|
||||||
assert trade.exchange == 'binance'
|
assert trade.exchange == 'binance'
|
||||||
assert trade.open_rate == 2.0
|
assert trade.open_rate == 2.0
|
||||||
assert trade.amount == 5.0
|
assert trade.amount == 30.0
|
||||||
|
|
||||||
assert log_has(
|
assert log_has(
|
||||||
'Buy signal found: about create a new trade for ETH/USDT with stake_amount: 10.0 ...',
|
'Buy signal found: about create a new trade for ETH/USDT with stake_amount: 60.0 ...',
|
||||||
caplog
|
caplog
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1265,7 +1265,7 @@ def test_handle_stoploss_on_exchange_trailing(mocker, default_conf_usdt, fee,
|
|||||||
|
|
||||||
cancel_order_mock.assert_called_once_with(100, 'ETH/USDT')
|
cancel_order_mock.assert_called_once_with(100, 'ETH/USDT')
|
||||||
stoploss_order_mock.assert_called_once_with(
|
stoploss_order_mock.assert_called_once_with(
|
||||||
amount=4.56621004,
|
amount=27.39726027,
|
||||||
pair='ETH/USDT',
|
pair='ETH/USDT',
|
||||||
order_types=freqtrade.strategy.order_types,
|
order_types=freqtrade.strategy.order_types,
|
||||||
stop_price=4.4 * 0.95
|
stop_price=4.4 * 0.95
|
||||||
@ -1457,7 +1457,7 @@ def test_handle_stoploss_on_exchange_custom_stop(
|
|||||||
|
|
||||||
cancel_order_mock.assert_called_once_with(100, 'ETH/USDT')
|
cancel_order_mock.assert_called_once_with(100, 'ETH/USDT')
|
||||||
stoploss_order_mock.assert_called_once_with(
|
stoploss_order_mock.assert_called_once_with(
|
||||||
amount=5.26315789,
|
amount=31.57894736,
|
||||||
pair='ETH/USDT',
|
pair='ETH/USDT',
|
||||||
order_types=freqtrade.strategy.order_types,
|
order_types=freqtrade.strategy.order_types,
|
||||||
stop_price=4.4 * 0.96
|
stop_price=4.4 * 0.96
|
||||||
@ -2577,11 +2577,11 @@ def test_execute_trade_exit_up(default_conf_usdt, ticker_usdt, fee, ticker_usdt_
|
|||||||
'pair': 'ETH/USDT',
|
'pair': 'ETH/USDT',
|
||||||
'gain': 'profit',
|
'gain': 'profit',
|
||||||
'limit': 2.2,
|
'limit': 2.2,
|
||||||
'amount': 5.0,
|
'amount': 30.0,
|
||||||
'order_type': 'limit',
|
'order_type': 'limit',
|
||||||
'open_rate': 2.0,
|
'open_rate': 2.0,
|
||||||
'current_rate': 2.3,
|
'current_rate': 2.3,
|
||||||
'profit_amount': 0.9475,
|
'profit_amount': 5.685,
|
||||||
'profit_ratio': 0.09451372,
|
'profit_ratio': 0.09451372,
|
||||||
'stake_currency': 'USDT',
|
'stake_currency': 'USDT',
|
||||||
'fiat_currency': 'USD',
|
'fiat_currency': 'USD',
|
||||||
@ -2630,11 +2630,11 @@ def test_execute_trade_exit_down(default_conf_usdt, ticker_usdt, fee, ticker_usd
|
|||||||
'pair': 'ETH/USDT',
|
'pair': 'ETH/USDT',
|
||||||
'gain': 'loss',
|
'gain': 'loss',
|
||||||
'limit': 2.01,
|
'limit': 2.01,
|
||||||
'amount': 5.0,
|
'amount': 30.0,
|
||||||
'order_type': 'limit',
|
'order_type': 'limit',
|
||||||
'open_rate': 2.0,
|
'open_rate': 2.0,
|
||||||
'current_rate': 2.0,
|
'current_rate': 2.0,
|
||||||
'profit_amount': -0.000125,
|
'profit_amount': -0.00075,
|
||||||
'profit_ratio': -1.247e-05,
|
'profit_ratio': -1.247e-05,
|
||||||
'stake_currency': 'USDT',
|
'stake_currency': 'USDT',
|
||||||
'fiat_currency': 'USD',
|
'fiat_currency': 'USD',
|
||||||
@ -2697,11 +2697,11 @@ def test_execute_trade_exit_custom_exit_price(default_conf_usdt, ticker_usdt, fe
|
|||||||
'pair': 'ETH/USDT',
|
'pair': 'ETH/USDT',
|
||||||
'gain': 'profit',
|
'gain': 'profit',
|
||||||
'limit': 2.25,
|
'limit': 2.25,
|
||||||
'amount': 5.0,
|
'amount': 30.0,
|
||||||
'order_type': 'limit',
|
'order_type': 'limit',
|
||||||
'open_rate': 2.0,
|
'open_rate': 2.0,
|
||||||
'current_rate': 2.3,
|
'current_rate': 2.3,
|
||||||
'profit_amount': 1.196875,
|
'profit_amount': 7.18125,
|
||||||
'profit_ratio': 0.11938903,
|
'profit_ratio': 0.11938903,
|
||||||
'stake_currency': 'USDT',
|
'stake_currency': 'USDT',
|
||||||
'fiat_currency': 'USD',
|
'fiat_currency': 'USD',
|
||||||
@ -2756,11 +2756,11 @@ def test_execute_trade_exit_down_stoploss_on_exchange_dry_run(
|
|||||||
'pair': 'ETH/USDT',
|
'pair': 'ETH/USDT',
|
||||||
'gain': 'loss',
|
'gain': 'loss',
|
||||||
'limit': 1.98,
|
'limit': 1.98,
|
||||||
'amount': 5.0,
|
'amount': 30.0,
|
||||||
'order_type': 'limit',
|
'order_type': 'limit',
|
||||||
'open_rate': 2.0,
|
'open_rate': 2.0,
|
||||||
'current_rate': 2.0,
|
'current_rate': 2.0,
|
||||||
'profit_amount': -0.14975,
|
'profit_amount': -0.8985,
|
||||||
'profit_ratio': -0.01493766,
|
'profit_ratio': -0.01493766,
|
||||||
'stake_currency': 'USDT',
|
'stake_currency': 'USDT',
|
||||||
'fiat_currency': 'USD',
|
'fiat_currency': 'USD',
|
||||||
@ -2973,11 +2973,11 @@ def test_execute_trade_exit_market_order(default_conf_usdt, ticker_usdt, fee,
|
|||||||
'pair': 'ETH/USDT',
|
'pair': 'ETH/USDT',
|
||||||
'gain': 'profit',
|
'gain': 'profit',
|
||||||
'limit': 2.2,
|
'limit': 2.2,
|
||||||
'amount': 5.0,
|
'amount': 30.0,
|
||||||
'order_type': 'market',
|
'order_type': 'market',
|
||||||
'open_rate': 2.0,
|
'open_rate': 2.0,
|
||||||
'current_rate': 2.3,
|
'current_rate': 2.3,
|
||||||
'profit_amount': 0.9475,
|
'profit_amount': 5.685,
|
||||||
'profit_ratio': 0.09451372,
|
'profit_ratio': 0.09451372,
|
||||||
'stake_currency': 'USDT',
|
'stake_currency': 'USDT',
|
||||||
'fiat_currency': 'USD',
|
'fiat_currency': 'USD',
|
||||||
@ -3742,7 +3742,7 @@ def test_order_book_depth_of_market(
|
|||||||
assert trade is None
|
assert trade is None
|
||||||
else:
|
else:
|
||||||
assert trade is not None
|
assert trade is not None
|
||||||
assert trade.stake_amount == 10.0
|
assert trade.stake_amount == 60.0
|
||||||
assert trade.is_open
|
assert trade.is_open
|
||||||
assert trade.open_date is not None
|
assert trade.open_date is not None
|
||||||
assert trade.exchange == 'binance'
|
assert trade.exchange == 'binance'
|
||||||
@ -3891,7 +3891,7 @@ def test_sync_wallet_dry_run(mocker, default_conf_usdt, ticker_usdt, fee, limit_
|
|||||||
caplog):
|
caplog):
|
||||||
default_conf_usdt['dry_run'] = True
|
default_conf_usdt['dry_run'] = True
|
||||||
# Initialize to 2 times stake amount
|
# Initialize to 2 times stake amount
|
||||||
default_conf_usdt['dry_run_wallet'] = 20.0
|
default_conf_usdt['dry_run_wallet'] = 120.0
|
||||||
default_conf_usdt['max_open_trades'] = 2
|
default_conf_usdt['max_open_trades'] = 2
|
||||||
default_conf_usdt['tradable_balance_ratio'] = 1.0
|
default_conf_usdt['tradable_balance_ratio'] = 1.0
|
||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
@ -3904,7 +3904,7 @@ def test_sync_wallet_dry_run(mocker, default_conf_usdt, ticker_usdt, fee, limit_
|
|||||||
|
|
||||||
bot = get_patched_freqtradebot(mocker, default_conf_usdt)
|
bot = get_patched_freqtradebot(mocker, default_conf_usdt)
|
||||||
patch_get_signal(bot)
|
patch_get_signal(bot)
|
||||||
assert bot.wallets.get_free('USDT') == 20.0
|
assert bot.wallets.get_free('USDT') == 120.0
|
||||||
|
|
||||||
n = bot.enter_positions()
|
n = bot.enter_positions()
|
||||||
assert n == 2
|
assert n == 2
|
||||||
@ -3915,7 +3915,7 @@ def test_sync_wallet_dry_run(mocker, default_conf_usdt, ticker_usdt, fee, limit_
|
|||||||
n = bot.enter_positions()
|
n = bot.enter_positions()
|
||||||
assert n == 0
|
assert n == 0
|
||||||
assert log_has_re(r"Unable to create trade for XRP/USDT: "
|
assert log_has_re(r"Unable to create trade for XRP/USDT: "
|
||||||
r"Available balance \(0.0 USDT\) is lower than stake amount \(10.0 USDT\)",
|
r"Available balance \(0.0 USDT\) is lower than stake amount \(60.0 USDT\)",
|
||||||
caplog)
|
caplog)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user