Rename create_trade to create_trades

This commit is contained in:
Matthias 2019-08-14 06:16:43 +02:00
parent 9d476b5ab2
commit a76136c010
5 changed files with 91 additions and 92 deletions

View File

@ -256,7 +256,7 @@ class FreqtradeBot(object):
amount_reserve_percent = max(amount_reserve_percent, 0.5)
return min(min_stake_amounts) / amount_reserve_percent
def create_trade(self) -> bool:
def create_trades(self) -> bool:
"""
Checks the implemented trading indicator(s) for a randomly picked pair,
if one pair triggers the buy_signal a new trade record gets created
@ -435,7 +435,7 @@ class FreqtradeBot(object):
"""
try:
# Create entity and execute trade
if not self.create_trade():
if not self.create_trades():
logger.info('Found no buy signals for whitelisted currencies. Trying again...')
except DependencyException as exception:
logger.warning('Unable to create trade: %s', exception)

View File

@ -44,7 +44,7 @@ def test_rpc_trade_status(default_conf, ticker, fee, markets, mocker) -> None:
with pytest.raises(RPCException, match=r'.*no active trade*'):
rpc._rpc_trade_status()
freqtradebot.create_trade()
freqtradebot.create_trades()
results = rpc._rpc_trade_status()
assert {
'trade_id': 1,
@ -116,7 +116,7 @@ def test_rpc_status_table(default_conf, ticker, fee, markets, mocker) -> None:
with pytest.raises(RPCException, match=r'.*no active order*'):
rpc._rpc_status_table()
freqtradebot.create_trade()
freqtradebot.create_trades()
result = rpc._rpc_status_table()
assert 'instantly' in result['Since'].all()
assert 'ETH/BTC' in result['Pair'].all()
@ -151,7 +151,7 @@ def test_rpc_daily_profit(default_conf, update, ticker, fee,
rpc = RPC(freqtradebot)
rpc._fiat_converter = CryptoToFiatConverter()
# Create some test data
freqtradebot.create_trade()
freqtradebot.create_trades()
trade = Trade.query.first()
assert trade
@ -208,7 +208,7 @@ def test_rpc_trade_statistics(default_conf, ticker, ticker_sell_up, fee,
rpc._rpc_trade_statistics(stake_currency, fiat_display_currency)
# Create some test data
freqtradebot.create_trade()
freqtradebot.create_trades()
trade = Trade.query.first()
# Simulate fulfilled LIMIT_BUY order for trade
trade.update(limit_buy_order)
@ -222,7 +222,7 @@ def test_rpc_trade_statistics(default_conf, ticker, ticker_sell_up, fee,
trade.close_date = datetime.utcnow()
trade.is_open = False
freqtradebot.create_trade()
freqtradebot.create_trades()
trade = Trade.query.first()
# Simulate fulfilled LIMIT_BUY order for trade
trade.update(limit_buy_order)
@ -292,7 +292,7 @@ def test_rpc_trade_statistics_closed(mocker, default_conf, ticker, fee, markets,
rpc = RPC(freqtradebot)
# Create some test data
freqtradebot.create_trade()
freqtradebot.create_trades()
trade = Trade.query.first()
# Simulate fulfilled LIMIT_BUY order for trade
trade.update(limit_buy_order)
@ -536,7 +536,7 @@ def test_rpc_forcesell(default_conf, ticker, fee, mocker, markets) -> None:
msg = rpc._rpc_forcesell('all')
assert msg == {'result': 'Created sell orders for all open trades.'}
freqtradebot.create_trade()
freqtradebot.create_trades()
msg = rpc._rpc_forcesell('all')
assert msg == {'result': 'Created sell orders for all open trades.'}
@ -570,7 +570,7 @@ def test_rpc_forcesell(default_conf, ticker, fee, mocker, markets) -> None:
assert cancel_order_mock.call_count == 1
assert trade.amount == filled_amount
freqtradebot.create_trade()
freqtradebot.create_trades()
trade = Trade.query.filter(Trade.id == '2').first()
amount = trade.amount
# make an limit-buy open trade, if there is no 'filled', don't sell it
@ -589,7 +589,7 @@ def test_rpc_forcesell(default_conf, ticker, fee, mocker, markets) -> None:
assert cancel_order_mock.call_count == 2
assert trade.amount == amount
freqtradebot.create_trade()
freqtradebot.create_trades()
# make an limit-sell open trade
mocker.patch(
'freqtrade.exchange.Exchange.get_order',
@ -622,7 +622,7 @@ def test_performance_handle(default_conf, ticker, limit_buy_order, fee,
rpc = RPC(freqtradebot)
# Create some test data
freqtradebot.create_trade()
freqtradebot.create_trades()
trade = Trade.query.first()
assert trade
@ -660,7 +660,7 @@ def test_rpc_count(mocker, default_conf, ticker, fee, markets) -> None:
assert counts["current"] == 0
# Create some test data
freqtradebot.create_trade()
freqtradebot.create_trades()
counts = rpc._rpc_count()
assert counts["current"] == 1

View File

@ -275,7 +275,7 @@ def test_api_count(botclient, mocker, ticker, fee, markets):
assert rc.json["max"] == 1.0
# Create some test data
ftbot.create_trade()
ftbot.create_trades()
rc = client_get(client, f"{BASE_URI}/count")
assert_response(rc)
assert rc.json["current"] == 1.0
@ -329,7 +329,7 @@ def test_api_profit(botclient, mocker, ticker, fee, markets, limit_buy_order, li
assert len(rc.json) == 1
assert rc.json == {"error": "Error querying _profit: no closed trade"}
ftbot.create_trade()
ftbot.create_trades()
trade = Trade.query.first()
# Simulate fulfilled LIMIT_BUY order for trade
@ -418,7 +418,7 @@ def test_api_status(botclient, mocker, ticker, fee, markets):
assert_response(rc, 502)
assert rc.json == {'error': 'Error querying _status: no active trade'}
ftbot.create_trade()
ftbot.create_trades()
rc = client_get(client, f"{BASE_URI}/status")
assert_response(rc)
assert len(rc.json) == 1
@ -548,7 +548,7 @@ def test_api_forcesell(botclient, mocker, ticker, fee, markets):
assert_response(rc, 502)
assert rc.json == {"error": "Error querying _forcesell: invalid argument"}
ftbot.create_trade()
ftbot.create_trades()
rc = client_post(client, f"{BASE_URI}/forcesell",
data='{"tradeid": "1"}')

View File

@ -192,7 +192,7 @@ def test_status(default_conf, update, mocker, fee, ticker, markets) -> None:
# Create some test data
for _ in range(3):
freqtradebot.create_trade()
freqtradebot.create_trades()
telegram._status(bot=MagicMock(), update=update)
assert msg_mock.call_count == 1
@ -240,7 +240,7 @@ def test_status_handle(default_conf, update, ticker, fee, markets, mocker) -> No
msg_mock.reset_mock()
# Create some test data
freqtradebot.create_trade()
freqtradebot.create_trades()
# Trigger status while we have a fulfilled order for the open trade
telegram._status(bot=MagicMock(), update=update)
@ -292,7 +292,7 @@ def test_status_table_handle(default_conf, update, ticker, fee, markets, mocker)
msg_mock.reset_mock()
# Create some test data
freqtradebot.create_trade()
freqtradebot.create_trades()
telegram._status_table(bot=MagicMock(), update=update)
@ -332,7 +332,7 @@ def test_daily_handle(default_conf, update, ticker, limit_buy_order, fee,
telegram = Telegram(freqtradebot)
# Create some test data
freqtradebot.create_trade()
freqtradebot.create_trades()
trade = Trade.query.first()
assert trade
@ -360,7 +360,7 @@ def test_daily_handle(default_conf, update, ticker, limit_buy_order, fee,
msg_mock.reset_mock()
freqtradebot.config['max_open_trades'] = 2
# Add two other trades
freqtradebot.create_trade()
freqtradebot.create_trades()
trades = Trade.query.all()
for trade in trades:
@ -439,7 +439,7 @@ def test_profit_handle(default_conf, update, ticker, ticker_sell_up, fee,
msg_mock.reset_mock()
# Create some test data
freqtradebot.create_trade()
freqtradebot.create_trades()
trade = Trade.query.first()
# Simulate fulfilled LIMIT_BUY order for trade
@ -734,7 +734,7 @@ def test_forcesell_handle(default_conf, update, ticker, fee,
telegram = Telegram(freqtradebot)
# Create some test data
freqtradebot.create_trade()
freqtradebot.create_trades()
trade = Trade.query.first()
assert trade
@ -785,7 +785,7 @@ def test_forcesell_down_handle(default_conf, update, ticker, fee,
telegram = Telegram(freqtradebot)
# Create some test data
freqtradebot.create_trade()
freqtradebot.create_trades()
# Decrease the price and sell it
mocker.patch.multiple(
@ -839,7 +839,7 @@ def test_forcesell_all_handle(default_conf, update, ticker, fee, markets, mocker
telegram = Telegram(freqtradebot)
# Create some test data
freqtradebot.create_trade()
freqtradebot.create_trades()
rpc_mock.reset_mock()
update.message.text = '/forcesell all'
@ -983,7 +983,7 @@ def test_performance_handle(default_conf, update, ticker, fee,
telegram = Telegram(freqtradebot)
# Create some test data
freqtradebot.create_trade()
freqtradebot.create_trades()
trade = Trade.query.first()
assert trade
@ -1028,7 +1028,7 @@ def test_count_handle(default_conf, update, ticker, fee, markets, mocker) -> Non
freqtradebot.state = State.RUNNING
# Create some test data
freqtradebot.create_trade()
freqtradebot.create_trades()
msg_mock.reset_mock()
telegram._count(bot=MagicMock(), update=update)

View File

@ -253,7 +253,6 @@ def test_get_trade_stake_amount_unlimited_amount(default_conf,
assert result == default_conf['stake_amount'] / conf['max_open_trades']
# create one trade, order amount should be 'balance / (max_open_trades - num_open_trades)'
# freqtrade.create_trade()
freqtrade.execute_buy('ETH/BTC', result)
result = freqtrade._get_trade_stake_amount('LTC/BTC')
@ -327,7 +326,7 @@ def test_edge_overrides_stoploss(limit_buy_order, fee, markets, caplog, mocker,
freqtrade.active_pair_whitelist = ['NEO/BTC']
patch_get_signal(freqtrade)
freqtrade.strategy.min_roi_reached = MagicMock(return_value=False)
freqtrade.create_trade()
freqtrade.create_trades()
trade = Trade.query.first()
trade.update(limit_buy_order)
#############################################
@ -368,7 +367,7 @@ def test_edge_should_ignore_strategy_stoploss(limit_buy_order, fee, markets,
freqtrade.active_pair_whitelist = ['NEO/BTC']
patch_get_signal(freqtrade)
freqtrade.strategy.min_roi_reached = MagicMock(return_value=False)
freqtrade.create_trade()
freqtrade.create_trades()
trade = Trade.query.first()
trade.update(limit_buy_order)
#############################################
@ -392,7 +391,7 @@ def test_total_open_trades_stakes(mocker, default_conf, ticker,
)
freqtrade = FreqtradeBot(default_conf)
patch_get_signal(freqtrade)
freqtrade.create_trade()
freqtrade.create_trades()
trade = Trade.query.first()
assert trade is not None
@ -400,7 +399,7 @@ def test_total_open_trades_stakes(mocker, default_conf, ticker,
assert trade.is_open
assert trade.open_date is not None
freqtrade.create_trade()
freqtrade.create_trades()
trade = Trade.query.order_by(Trade.id.desc()).first()
assert trade is not None
@ -523,7 +522,7 @@ def test_get_min_pair_stake_amount(mocker, default_conf) -> None:
assert result == min(8, 2 * 2) / 0.9
def test_create_trade(default_conf, ticker, limit_buy_order, fee, markets, mocker) -> None:
def test_create_trades(default_conf, ticker, limit_buy_order, fee, markets, mocker) -> None:
patch_RPCManager(mocker)
patch_exchange(mocker)
mocker.patch.multiple(
@ -538,7 +537,7 @@ def test_create_trade(default_conf, ticker, limit_buy_order, fee, markets, mocke
whitelist = deepcopy(default_conf['exchange']['pair_whitelist'])
freqtrade = FreqtradeBot(default_conf)
patch_get_signal(freqtrade)
freqtrade.create_trade()
freqtrade.create_trades()
trade = Trade.query.first()
assert trade is not None
@ -556,8 +555,8 @@ def test_create_trade(default_conf, ticker, limit_buy_order, fee, markets, mocke
assert whitelist == default_conf['exchange']['pair_whitelist']
def test_create_trade_no_stake_amount(default_conf, ticker, limit_buy_order,
fee, markets, mocker) -> None:
def test_create_trades_no_stake_amount(default_conf, ticker, limit_buy_order,
fee, markets, mocker) -> None:
patch_RPCManager(mocker)
patch_exchange(mocker)
patch_wallet(mocker, free=default_conf['stake_amount'] * 0.5)
@ -572,11 +571,11 @@ def test_create_trade_no_stake_amount(default_conf, ticker, limit_buy_order,
patch_get_signal(freqtrade)
with pytest.raises(DependencyException, match=r'.*stake amount.*'):
freqtrade.create_trade()
freqtrade.create_trades()
def test_create_trade_minimal_amount(default_conf, ticker, limit_buy_order,
fee, markets, mocker) -> None:
def test_create_trades_minimal_amount(default_conf, ticker, limit_buy_order,
fee, markets, mocker) -> None:
patch_RPCManager(mocker)
patch_exchange(mocker)
buy_mock = MagicMock(return_value={'id': limit_buy_order['id']})
@ -591,13 +590,13 @@ def test_create_trade_minimal_amount(default_conf, ticker, limit_buy_order,
freqtrade = FreqtradeBot(default_conf)
patch_get_signal(freqtrade)
freqtrade.create_trade()
freqtrade.create_trades()
rate, amount = buy_mock.call_args[1]['rate'], buy_mock.call_args[1]['amount']
assert rate * amount >= default_conf['stake_amount']
def test_create_trade_too_small_stake_amount(default_conf, ticker, limit_buy_order,
fee, markets, mocker) -> None:
def test_create_trades_too_small_stake_amount(default_conf, ticker, limit_buy_order,
fee, markets, mocker) -> None:
patch_RPCManager(mocker)
patch_exchange(mocker)
buy_mock = MagicMock(return_value={'id': limit_buy_order['id']})
@ -613,11 +612,11 @@ def test_create_trade_too_small_stake_amount(default_conf, ticker, limit_buy_ord
freqtrade = FreqtradeBot(default_conf)
patch_get_signal(freqtrade)
assert not freqtrade.create_trade()
assert not freqtrade.create_trades()
def test_create_trade_limit_reached(default_conf, ticker, limit_buy_order,
fee, markets, mocker) -> None:
def test_create_trades_limit_reached(default_conf, ticker, limit_buy_order,
fee, markets, mocker) -> None:
patch_RPCManager(mocker)
patch_exchange(mocker)
mocker.patch.multiple(
@ -634,12 +633,12 @@ def test_create_trade_limit_reached(default_conf, ticker, limit_buy_order,
freqtrade = FreqtradeBot(default_conf)
patch_get_signal(freqtrade)
assert not freqtrade.create_trade()
assert not freqtrade.create_trades()
assert freqtrade._get_trade_stake_amount('ETH/BTC') is None
def test_create_trade_no_pairs_let(default_conf, ticker, limit_buy_order, fee,
markets, mocker, caplog) -> None:
def test_create_trades_no_pairs_let(default_conf, ticker, limit_buy_order, fee,
markets, mocker, caplog) -> None:
patch_RPCManager(mocker)
patch_exchange(mocker)
mocker.patch.multiple(
@ -654,13 +653,13 @@ def test_create_trade_no_pairs_let(default_conf, ticker, limit_buy_order, fee,
freqtrade = FreqtradeBot(default_conf)
patch_get_signal(freqtrade)
assert freqtrade.create_trade()
assert not freqtrade.create_trade()
assert freqtrade.create_trades()
assert not freqtrade.create_trades()
assert log_has("No currency pair in whitelist, but checking to sell open trades.", caplog)
def test_create_trade_no_pairs_in_whitelist(default_conf, ticker, limit_buy_order, fee,
markets, mocker, caplog) -> None:
def test_create_trades_no_pairs_in_whitelist(default_conf, ticker, limit_buy_order, fee,
markets, mocker, caplog) -> None:
patch_RPCManager(mocker)
patch_exchange(mocker)
mocker.patch.multiple(
@ -674,11 +673,11 @@ def test_create_trade_no_pairs_in_whitelist(default_conf, ticker, limit_buy_orde
freqtrade = FreqtradeBot(default_conf)
patch_get_signal(freqtrade)
assert not freqtrade.create_trade()
assert not freqtrade.create_trades()
assert log_has("Whitelist is empty.", caplog)
def test_create_trade_no_signal(default_conf, fee, mocker) -> None:
def test_create_trades_no_signal(default_conf, fee, mocker) -> None:
default_conf['dry_run'] = True
patch_RPCManager(mocker)
@ -694,12 +693,12 @@ def test_create_trade_no_signal(default_conf, fee, mocker) -> None:
Trade.query = MagicMock()
Trade.query.filter = MagicMock()
assert not freqtrade.create_trade()
assert not freqtrade.create_trades()
@pytest.mark.parametrize("max_open", range(0, 5))
def test_create_trade_multiple_trades(default_conf, ticker,
fee, markets, mocker, max_open) -> None:
def test_create_trades_multiple_trades(default_conf, ticker,
fee, markets, mocker, max_open) -> None:
patch_RPCManager(mocker)
patch_exchange(mocker)
default_conf['max_open_trades'] = max_open
@ -713,7 +712,7 @@ def test_create_trade_multiple_trades(default_conf, ticker,
freqtrade = FreqtradeBot(default_conf)
patch_get_signal(freqtrade)
freqtrade.create_trade()
freqtrade.create_trades()
trades = Trade.get_open_trades()
assert len(trades) == max_open
@ -1101,7 +1100,7 @@ def test_handle_stoploss_on_exchange(mocker, default_conf, fee, caplog,
# Fourth case: when stoploss is set and it is hit
# should unset stoploss_order_id and return true
# as a trade actually happened
freqtrade.create_trade()
freqtrade.create_trades()
trade = Trade.query.first()
trade.is_open = True
trade.open_order_id = None
@ -1176,7 +1175,7 @@ def test_handle_stoploss_on_exchange_trailing(mocker, default_conf, fee, caplog,
patch_get_signal(freqtrade)
freqtrade.create_trade()
freqtrade.create_trades()
trade = Trade.query.first()
trade.is_open = True
trade.open_order_id = None
@ -1266,7 +1265,7 @@ def test_handle_stoploss_on_exchange_trailing_error(mocker, default_conf, fee, c
# setting stoploss_on_exchange_interval to 60 seconds
freqtrade.strategy.order_types['stoploss_on_exchange_interval'] = 60
patch_get_signal(freqtrade)
freqtrade.create_trade()
freqtrade.create_trades()
trade = Trade.query.first()
trade.is_open = True
trade.open_order_id = None
@ -1347,7 +1346,7 @@ def test_tsl_on_exchange_compatible_with_edge(mocker, edge_conf, fee, caplog,
freqtrade.active_pair_whitelist = freqtrade.edge.adjust(freqtrade.active_pair_whitelist)
freqtrade.create_trade()
freqtrade.create_trades()
trade = Trade.query.first()
trade.is_open = True
trade.open_order_id = None
@ -1414,7 +1413,7 @@ def test_tsl_on_exchange_compatible_with_edge(mocker, edge_conf, fee, caplog,
def test_process_maybe_execute_buy(mocker, default_conf, caplog) -> None:
freqtrade = get_patched_freqtradebot(mocker, default_conf)
mocker.patch('freqtrade.freqtradebot.FreqtradeBot.create_trade', MagicMock(return_value=False))
mocker.patch('freqtrade.freqtradebot.FreqtradeBot.create_trades', MagicMock(return_value=False))
freqtrade.process_maybe_execute_buy()
assert log_has('Found no buy signals for whitelisted currencies. Trying again...', caplog)
@ -1423,7 +1422,7 @@ def test_process_maybe_execute_buy_exception(mocker, default_conf, caplog) -> No
freqtrade = get_patched_freqtradebot(mocker, default_conf)
mocker.patch(
'freqtrade.freqtradebot.FreqtradeBot.create_trade',
'freqtrade.freqtradebot.FreqtradeBot.create_trades',
MagicMock(side_effect=DependencyException)
)
freqtrade.process_maybe_execute_buy()
@ -1610,7 +1609,7 @@ def test_handle_trade(default_conf, limit_buy_order, limit_sell_order,
freqtrade = FreqtradeBot(default_conf)
patch_get_signal(freqtrade)
freqtrade.create_trade()
freqtrade.create_trades()
trade = Trade.query.first()
assert trade
@ -1650,7 +1649,7 @@ def test_handle_overlpapping_signals(default_conf, ticker, limit_buy_order,
patch_get_signal(freqtrade, value=(True, True))
freqtrade.strategy.min_roi_reached = MagicMock(return_value=False)
freqtrade.create_trade()
freqtrade.create_trades()
# Buy and Sell triggering, so doing nothing ...
trades = Trade.query.all()
@ -1659,7 +1658,7 @@ def test_handle_overlpapping_signals(default_conf, ticker, limit_buy_order,
# Buy is triggering, so buying ...
patch_get_signal(freqtrade, value=(True, False))
freqtrade.create_trade()
freqtrade.create_trades()
trades = Trade.query.all()
nb_trades = len(trades)
assert nb_trades == 1
@ -1706,7 +1705,7 @@ def test_handle_trade_roi(default_conf, ticker, limit_buy_order,
patch_get_signal(freqtrade, value=(True, False))
freqtrade.strategy.min_roi_reached = MagicMock(return_value=True)
freqtrade.create_trade()
freqtrade.create_trades()
trade = Trade.query.first()
trade.is_open = True
@ -1738,7 +1737,7 @@ def test_handle_trade_experimental(
freqtrade = FreqtradeBot(default_conf)
patch_get_signal(freqtrade)
freqtrade.strategy.min_roi_reached = MagicMock(return_value=False)
freqtrade.create_trade()
freqtrade.create_trades()
trade = Trade.query.first()
trade.is_open = True
@ -1766,7 +1765,7 @@ def test_close_trade(default_conf, ticker, limit_buy_order, limit_sell_order,
patch_get_signal(freqtrade)
# Create trade and sell it
freqtrade.create_trade()
freqtrade.create_trades()
trade = Trade.query.first()
assert trade
@ -2106,7 +2105,7 @@ def test_execute_sell_up(default_conf, ticker, fee, ticker_sell_up, markets, moc
patch_get_signal(freqtrade)
# Create some test data
freqtrade.create_trade()
freqtrade.create_trades()
trade = Trade.query.first()
assert trade
@ -2152,7 +2151,7 @@ def test_execute_sell_down(default_conf, ticker, fee, ticker_sell_down, markets,
patch_get_signal(freqtrade)
# Create some test data
freqtrade.create_trade()
freqtrade.create_trades()
trade = Trade.query.first()
assert trade
@ -2201,7 +2200,7 @@ def test_execute_sell_down_stoploss_on_exchange_dry_run(default_conf, ticker, fe
patch_get_signal(freqtrade)
# Create some test data
freqtrade.create_trade()
freqtrade.create_trades()
trade = Trade.query.first()
assert trade
@ -2258,7 +2257,7 @@ def test_execute_sell_sloe_cancel_exception(mocker, default_conf, ticker, fee,
freqtrade.strategy.order_types['stoploss_on_exchange'] = True
patch_get_signal(freqtrade)
freqtrade.create_trade()
freqtrade.create_trades()
trade = Trade.query.first()
Trade.session = MagicMock()
@ -2305,7 +2304,7 @@ def test_execute_sell_with_stoploss_on_exchange(default_conf,
patch_get_signal(freqtrade)
# Create some test data
freqtrade.create_trade()
freqtrade.create_trades()
trade = Trade.query.first()
assert trade
@ -2357,7 +2356,7 @@ def test_may_execute_sell_after_stoploss_on_exchange_hit(default_conf,
patch_get_signal(freqtrade)
# Create some test data
freqtrade.create_trade()
freqtrade.create_trades()
trade = Trade.query.first()
freqtrade.process_maybe_execute_sell(trade)
assert trade
@ -2409,7 +2408,7 @@ def test_execute_sell_without_conf_sell_up(default_conf, ticker, fee,
patch_get_signal(freqtrade)
# Create some test data
freqtrade.create_trade()
freqtrade.create_trades()
trade = Trade.query.first()
assert trade
@ -2456,7 +2455,7 @@ def test_execute_sell_without_conf_sell_down(default_conf, ticker, fee,
patch_get_signal(freqtrade)
# Create some test data
freqtrade.create_trade()
freqtrade.create_trades()
trade = Trade.query.first()
assert trade
@ -2512,7 +2511,7 @@ def test_sell_profit_only_enable_profit(default_conf, limit_buy_order,
patch_get_signal(freqtrade)
freqtrade.strategy.min_roi_reached = MagicMock(return_value=False)
freqtrade.create_trade()
freqtrade.create_trades()
trade = Trade.query.first()
trade.update(limit_buy_order)
@ -2543,7 +2542,7 @@ def test_sell_profit_only_disable_profit(default_conf, limit_buy_order,
freqtrade = FreqtradeBot(default_conf)
patch_get_signal(freqtrade)
freqtrade.strategy.min_roi_reached = MagicMock(return_value=False)
freqtrade.create_trade()
freqtrade.create_trades()
trade = Trade.query.first()
trade.update(limit_buy_order)
@ -2574,7 +2573,7 @@ def test_sell_profit_only_enable_loss(default_conf, limit_buy_order, fee, market
patch_get_signal(freqtrade)
freqtrade.strategy.stop_loss_reached = MagicMock(return_value=SellCheckTuple(
sell_flag=False, sell_type=SellType.NONE))
freqtrade.create_trade()
freqtrade.create_trades()
trade = Trade.query.first()
trade.update(limit_buy_order)
@ -2605,7 +2604,7 @@ def test_sell_profit_only_disable_loss(default_conf, limit_buy_order, fee, marke
patch_get_signal(freqtrade)
freqtrade.strategy.min_roi_reached = MagicMock(return_value=False)
freqtrade.create_trade()
freqtrade.create_trades()
trade = Trade.query.first()
trade.update(limit_buy_order)
@ -2635,7 +2634,7 @@ def test_ignore_roi_if_buy_signal(default_conf, limit_buy_order, fee, markets, m
patch_get_signal(freqtrade)
freqtrade.strategy.min_roi_reached = MagicMock(return_value=True)
freqtrade.create_trade()
freqtrade.create_trades()
trade = Trade.query.first()
trade.update(limit_buy_order)
@ -2667,7 +2666,7 @@ def test_trailing_stop_loss(default_conf, limit_buy_order, fee, markets, caplog,
patch_get_signal(freqtrade)
freqtrade.strategy.min_roi_reached = MagicMock(return_value=False)
freqtrade.create_trade()
freqtrade.create_trades()
trade = Trade.query.first()
assert freqtrade.handle_trade(trade) is False
@ -2720,7 +2719,7 @@ def test_trailing_stop_loss_positive(default_conf, limit_buy_order, fee, markets
freqtrade = FreqtradeBot(default_conf)
patch_get_signal(freqtrade)
freqtrade.strategy.min_roi_reached = MagicMock(return_value=False)
freqtrade.create_trade()
freqtrade.create_trades()
trade = Trade.query.first()
trade.update(limit_buy_order)
@ -2778,7 +2777,7 @@ def test_trailing_stop_loss_offset(default_conf, limit_buy_order, fee,
freqtrade = FreqtradeBot(default_conf)
patch_get_signal(freqtrade)
freqtrade.strategy.min_roi_reached = MagicMock(return_value=False)
freqtrade.create_trade()
freqtrade.create_trades()
trade = Trade.query.first()
trade.update(limit_buy_order)
@ -2841,7 +2840,7 @@ def test_tsl_only_offset_reached(default_conf, limit_buy_order, fee,
freqtrade = FreqtradeBot(default_conf)
patch_get_signal(freqtrade)
freqtrade.strategy.min_roi_reached = MagicMock(return_value=False)
freqtrade.create_trade()
freqtrade.create_trades()
trade = Trade.query.first()
trade.update(limit_buy_order)
@ -2900,7 +2899,7 @@ def test_disable_ignore_roi_if_buy_signal(default_conf, limit_buy_order,
patch_get_signal(freqtrade)
freqtrade.strategy.min_roi_reached = MagicMock(return_value=True)
freqtrade.create_trade()
freqtrade.create_trades()
trade = Trade.query.first()
trade.update(limit_buy_order)
@ -3157,7 +3156,7 @@ def test_order_book_depth_of_market(default_conf, ticker, limit_buy_order, fee,
whitelist = deepcopy(default_conf['exchange']['pair_whitelist'])
freqtrade = FreqtradeBot(default_conf)
patch_get_signal(freqtrade)
freqtrade.create_trade()
freqtrade.create_trades()
trade = Trade.query.first()
assert trade is not None
@ -3191,7 +3190,7 @@ def test_order_book_depth_of_market_high_delta(default_conf, ticker, limit_buy_o
# Save state of current whitelist
freqtrade = FreqtradeBot(default_conf)
patch_get_signal(freqtrade)
freqtrade.create_trade()
freqtrade.create_trades()
trade = Trade.query.first()
assert trade is None
@ -3297,7 +3296,7 @@ def test_order_book_ask_strategy(default_conf, limit_buy_order, limit_sell_order
freqtrade = FreqtradeBot(default_conf)
patch_get_signal(freqtrade)
freqtrade.create_trade()
freqtrade.create_trades()
trade = Trade.query.first()
assert trade