Revert some pointless changes.
This commit is contained in:
parent
b4ff50c3be
commit
268b191cc2
@ -310,7 +310,6 @@ def test_rpc_daily_profit(default_conf, update, ticker, fee,
|
|||||||
|
|
||||||
# Simulate buy & sell
|
# Simulate buy & sell
|
||||||
oobj = Order.parse_from_ccxt_object(limit_buy_order, limit_buy_order['symbol'], 'buy')
|
oobj = Order.parse_from_ccxt_object(limit_buy_order, limit_buy_order['symbol'], 'buy')
|
||||||
trade.orders[0] = oobj
|
|
||||||
trade.update_trade(oobj)
|
trade.update_trade(oobj)
|
||||||
oobj = Order.parse_from_ccxt_object(limit_sell_order, limit_sell_order['symbol'], 'sell')
|
oobj = Order.parse_from_ccxt_object(limit_sell_order, limit_sell_order['symbol'], 'sell')
|
||||||
trade.update_trade(oobj)
|
trade.update_trade(oobj)
|
||||||
@ -453,7 +452,6 @@ def test_rpc_trade_statistics(default_conf, ticker, ticker_sell_up, fee,
|
|||||||
trade = Trade.query.first()
|
trade = Trade.query.first()
|
||||||
# Simulate fulfilled LIMIT_BUY order for trade
|
# Simulate fulfilled LIMIT_BUY order for trade
|
||||||
oobj = Order.parse_from_ccxt_object(limit_buy_order, limit_buy_order['symbol'], 'buy')
|
oobj = Order.parse_from_ccxt_object(limit_buy_order, limit_buy_order['symbol'], 'buy')
|
||||||
trade.orders[0] = oobj
|
|
||||||
trade.update_trade(oobj)
|
trade.update_trade(oobj)
|
||||||
|
|
||||||
# Update the ticker with a market going up
|
# Update the ticker with a market going up
|
||||||
@ -467,23 +465,20 @@ def test_rpc_trade_statistics(default_conf, ticker, ticker_sell_up, fee,
|
|||||||
trade.is_open = False
|
trade.is_open = False
|
||||||
|
|
||||||
freqtradebot.enter_positions()
|
freqtradebot.enter_positions()
|
||||||
|
trade = Trade.query.first()
|
||||||
# TODO: updated the first trade again
|
# Simulate fulfilled LIMIT_BUY order for trade
|
||||||
# trade = Trade.query.first()
|
oobj = Order.parse_from_ccxt_object(limit_buy_order, limit_buy_order['symbol'], 'buy')
|
||||||
# # Simulate fulfilled LIMIT_BUY order for trade
|
trade.update_trade(oobj)
|
||||||
# oobj = Order.parse_from_ccxt_object(limit_buy_order, limit_buy_order['symbol'], 'buy')
|
|
||||||
# trade.orders[0] = oobj
|
|
||||||
# trade.update_trade(oobj)
|
|
||||||
|
|
||||||
# Update the ticker with a market going up
|
# Update the ticker with a market going up
|
||||||
# mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
# 'freqtrade.exchange.Exchange',
|
'freqtrade.exchange.Exchange',
|
||||||
# fetch_ticker=ticker_sell_up
|
fetch_ticker=ticker_sell_up
|
||||||
# )
|
)
|
||||||
# oobj = Order.parse_from_ccxt_object(limit_sell_order, limit_sell_order['symbol'], 'sell')
|
oobj = Order.parse_from_ccxt_object(limit_sell_order, limit_sell_order['symbol'], 'sell')
|
||||||
# trade.update_trade(oobj)
|
trade.update_trade(oobj)
|
||||||
# trade.close_date = datetime.utcnow()
|
trade.close_date = datetime.utcnow()
|
||||||
# trade.is_open = False
|
trade.is_open = False
|
||||||
|
|
||||||
stats = rpc._rpc_trade_statistics(stake_currency, fiat_display_currency)
|
stats = rpc._rpc_trade_statistics(stake_currency, fiat_display_currency)
|
||||||
assert prec_satoshi(stats['profit_closed_coin'], 6.217e-05)
|
assert prec_satoshi(stats['profit_closed_coin'], 6.217e-05)
|
||||||
@ -541,7 +536,6 @@ def test_rpc_trade_statistics_closed(mocker, default_conf, ticker, fee,
|
|||||||
trade = Trade.query.first()
|
trade = Trade.query.first()
|
||||||
# Simulate fulfilled LIMIT_BUY order for trade
|
# Simulate fulfilled LIMIT_BUY order for trade
|
||||||
oobj = Order.parse_from_ccxt_object(limit_buy_order, limit_buy_order['symbol'], 'buy')
|
oobj = Order.parse_from_ccxt_object(limit_buy_order, limit_buy_order['symbol'], 'buy')
|
||||||
trade.orders[0] = oobj
|
|
||||||
trade.update_trade(oobj)
|
trade.update_trade(oobj)
|
||||||
# Update the ticker with a market going up
|
# Update the ticker with a market going up
|
||||||
mocker.patch.multiple(
|
mocker.patch.multiple(
|
||||||
@ -913,7 +907,7 @@ def test_rpc_force_exit(default_conf, ticker, fee, mocker) -> None:
|
|||||||
'amount': amount,
|
'amount': amount,
|
||||||
'remaining': amount,
|
'remaining': amount,
|
||||||
'filled': 0.0,
|
'filled': 0.0,
|
||||||
'id': trade.orders[0].order_id
|
'id': trade.orders[0].order_id,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
msg = rpc._rpc_force_exit('3')
|
msg = rpc._rpc_force_exit('3')
|
||||||
@ -943,7 +937,6 @@ def test_performance_handle(default_conf, ticker, limit_buy_order, fee,
|
|||||||
|
|
||||||
# Simulate fulfilled LIMIT_BUY order for trade
|
# Simulate fulfilled LIMIT_BUY order for trade
|
||||||
oobj = Order.parse_from_ccxt_object(limit_buy_order, limit_buy_order['symbol'], 'buy')
|
oobj = Order.parse_from_ccxt_object(limit_buy_order, limit_buy_order['symbol'], 'buy')
|
||||||
trade.orders[0] = oobj
|
|
||||||
trade.update_trade(oobj)
|
trade.update_trade(oobj)
|
||||||
|
|
||||||
# Simulate fulfilled LIMIT_SELL order for trade
|
# Simulate fulfilled LIMIT_SELL order for trade
|
||||||
@ -980,7 +973,6 @@ def test_enter_tag_performance_handle(default_conf, ticker, limit_buy_order, fee
|
|||||||
|
|
||||||
# Simulate fulfilled LIMIT_BUY order for trade
|
# Simulate fulfilled LIMIT_BUY order for trade
|
||||||
oobj = Order.parse_from_ccxt_object(limit_buy_order, limit_buy_order['symbol'], 'buy')
|
oobj = Order.parse_from_ccxt_object(limit_buy_order, limit_buy_order['symbol'], 'buy')
|
||||||
trade.orders[0] = oobj
|
|
||||||
trade.update_trade(oobj)
|
trade.update_trade(oobj)
|
||||||
|
|
||||||
# Simulate fulfilled LIMIT_SELL order for trade
|
# Simulate fulfilled LIMIT_SELL order for trade
|
||||||
@ -1055,7 +1047,6 @@ def test_exit_reason_performance_handle(default_conf, ticker, limit_buy_order, f
|
|||||||
|
|
||||||
# Simulate fulfilled LIMIT_BUY order for trade
|
# Simulate fulfilled LIMIT_BUY order for trade
|
||||||
oobj = Order.parse_from_ccxt_object(limit_buy_order, limit_buy_order['symbol'], 'buy')
|
oobj = Order.parse_from_ccxt_object(limit_buy_order, limit_buy_order['symbol'], 'buy')
|
||||||
trade.orders[0] = oobj
|
|
||||||
trade.update_trade(oobj)
|
trade.update_trade(oobj)
|
||||||
|
|
||||||
# Simulate fulfilled LIMIT_SELL order for trade
|
# Simulate fulfilled LIMIT_SELL order for trade
|
||||||
@ -1130,7 +1121,6 @@ def test_mix_tag_performance_handle(default_conf, ticker, limit_buy_order, fee,
|
|||||||
|
|
||||||
# Simulate fulfilled LIMIT_BUY order for trade
|
# Simulate fulfilled LIMIT_BUY order for trade
|
||||||
oobj = Order.parse_from_ccxt_object(limit_buy_order, limit_buy_order['symbol'], 'buy')
|
oobj = Order.parse_from_ccxt_object(limit_buy_order, limit_buy_order['symbol'], 'buy')
|
||||||
trade.orders[0] = oobj
|
|
||||||
trade.update_trade(oobj)
|
trade.update_trade(oobj)
|
||||||
|
|
||||||
# Simulate fulfilled LIMIT_SELL order for trade
|
# Simulate fulfilled LIMIT_SELL order for trade
|
||||||
|
@ -474,7 +474,6 @@ def test_daily_handle(default_conf, update, ticker, limit_buy_order, fee,
|
|||||||
|
|
||||||
trades = Trade.query.all()
|
trades = Trade.query.all()
|
||||||
for trade in trades:
|
for trade in trades:
|
||||||
trade.orders[0] = oobj
|
|
||||||
trade.update_trade(oobj)
|
trade.update_trade(oobj)
|
||||||
trade.update_trade(oobjs)
|
trade.update_trade(oobjs)
|
||||||
trade.close_date = datetime.utcnow()
|
trade.close_date = datetime.utcnow()
|
||||||
@ -592,7 +591,6 @@ def test_weekly_handle(default_conf, update, ticker, limit_buy_order, fee,
|
|||||||
|
|
||||||
trades = Trade.query.all()
|
trades = Trade.query.all()
|
||||||
for trade in trades:
|
for trade in trades:
|
||||||
trade.orders[0] = oobj
|
|
||||||
trade.update_trade(oobj)
|
trade.update_trade(oobj)
|
||||||
trade.update_trade(oobjs)
|
trade.update_trade(oobjs)
|
||||||
trade.close_date = datetime.utcnow()
|
trade.close_date = datetime.utcnow()
|
||||||
@ -713,7 +711,6 @@ def test_monthly_handle(default_conf, update, ticker, limit_buy_order, fee,
|
|||||||
|
|
||||||
trades = Trade.query.all()
|
trades = Trade.query.all()
|
||||||
for trade in trades:
|
for trade in trades:
|
||||||
trade.orders[0] = oobj
|
|
||||||
trade.update_trade(oobj)
|
trade.update_trade(oobj)
|
||||||
trade.update_trade(oobjs)
|
trade.update_trade(oobjs)
|
||||||
trade.close_date = datetime.utcnow()
|
trade.close_date = datetime.utcnow()
|
||||||
@ -2000,14 +1997,15 @@ def test_send_msg_entry_fill_notification(default_conf, mocker, message_type, en
|
|||||||
'open_date': arrow.utcnow().shift(hours=-1)
|
'open_date': arrow.utcnow().shift(hours=-1)
|
||||||
})
|
})
|
||||||
|
|
||||||
assert msg_mock.call_args[0][0] \
|
assert msg_mock.call_args[0][0] == (
|
||||||
== f'\N{CHECK MARK} *Binance:* {entered}ed ETH/BTC (#1)\n' \
|
f'\N{CHECK MARK} *Binance:* {entered}ed ETH/BTC (#1)\n'
|
||||||
f'*Enter Tag:* `{enter_signal}`\n' \
|
f'*Enter Tag:* `{enter_signal}`\n'
|
||||||
'*Amount:* `1333.33333333`\n' \
|
'*Amount:* `1333.33333333`\n'
|
||||||
f"{leverage_text}" \
|
f"{leverage_text}"
|
||||||
'*Open Rate:* `0.00001099`\n' \
|
'*Open Rate:* `0.00001099`\n'
|
||||||
'*Total:* `(0.01465333 BTC, 180.895 USD)`\n' \
|
'*Total:* `(0.01465333 BTC, 180.895 USD)`\n'
|
||||||
'*Balance:* `(0.01465333 BTC, 180.895 USD)`'
|
'*Balance:* `(0.01465333 BTC, 180.895 USD)`'
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_send_msg_sell_notification(default_conf, mocker) -> None:
|
def test_send_msg_sell_notification(default_conf, mocker) -> None:
|
||||||
@ -2076,18 +2074,18 @@ def test_send_msg_sell_notification(default_conf, mocker) -> None:
|
|||||||
'stake_amount': 1234,
|
'stake_amount': 1234,
|
||||||
'sub_trade': True
|
'sub_trade': True
|
||||||
})
|
})
|
||||||
assert msg_mock.call_args[0][0] \
|
assert msg_mock.call_args[0][0] == (
|
||||||
== ('\N{WARNING SIGN} *Binance:* Exiting KEY/ETH (#1)\n'
|
'\N{WARNING SIGN} *Binance:* Exiting KEY/ETH (#1)\n'
|
||||||
'*Unrealized Cumulative Profit:* `-57.41% (loss: -0.05746268 ETH / -24.812 USD)`\n'
|
'*Unrealized Cumulative Profit:* `-57.41% (loss: -0.05746268 ETH / -24.812 USD)`\n'
|
||||||
'*Enter Tag:* `buy_signal1`\n'
|
'*Enter Tag:* `buy_signal1`\n'
|
||||||
'*Exit Reason:* `stop_loss`\n'
|
'*Exit Reason:* `stop_loss`\n'
|
||||||
'*Direction:* `Long`\n'
|
'*Direction:* `Long`\n'
|
||||||
'*Amount:* `1333.33333333`\n'
|
'*Amount:* `1333.33333333`\n'
|
||||||
'*Open Rate:* `0.00007500`\n'
|
'*Open Rate:* `0.00007500`\n'
|
||||||
'*Current Rate:* `0.00003201`\n'
|
'*Current Rate:* `0.00003201`\n'
|
||||||
'*Close Rate:* `0.00003201`\n'
|
'*Close Rate:* `0.00003201`\n'
|
||||||
'*Remaining:* `(1234 ETH, -24.812 USD)`'
|
'*Remaining:* `(1234 ETH, -24.812 USD)`'
|
||||||
)
|
)
|
||||||
|
|
||||||
msg_mock.reset_mock()
|
msg_mock.reset_mock()
|
||||||
telegram.send_msg({
|
telegram.send_msg({
|
||||||
@ -2110,18 +2108,18 @@ def test_send_msg_sell_notification(default_conf, mocker) -> None:
|
|||||||
'open_date': arrow.utcnow().shift(days=-1, hours=-2, minutes=-30),
|
'open_date': arrow.utcnow().shift(days=-1, hours=-2, minutes=-30),
|
||||||
'close_date': arrow.utcnow(),
|
'close_date': arrow.utcnow(),
|
||||||
})
|
})
|
||||||
assert msg_mock.call_args[0][0] \
|
assert msg_mock.call_args[0][0] == (
|
||||||
== ('\N{WARNING SIGN} *Binance:* Exiting KEY/ETH (#1)\n'
|
'\N{WARNING SIGN} *Binance:* Exiting KEY/ETH (#1)\n'
|
||||||
'*Unrealized Profit:* `-57.41% (loss: -0.05746268 ETH)`\n'
|
'*Unrealized Profit:* `-57.41% (loss: -0.05746268 ETH)`\n'
|
||||||
'*Enter Tag:* `buy_signal1`\n'
|
'*Enter Tag:* `buy_signal1`\n'
|
||||||
'*Exit Reason:* `stop_loss`\n'
|
'*Exit Reason:* `stop_loss`\n'
|
||||||
'*Direction:* `Long`\n'
|
'*Direction:* `Long`\n'
|
||||||
'*Amount:* `1333.33333333`\n'
|
'*Amount:* `1333.33333333`\n'
|
||||||
'*Open Rate:* `0.00007500`\n'
|
'*Open Rate:* `0.00007500`\n'
|
||||||
'*Current Rate:* `0.00003201`\n'
|
'*Current Rate:* `0.00003201`\n'
|
||||||
'*Close Rate:* `0.00003201`\n'
|
'*Close Rate:* `0.00003201`\n'
|
||||||
'*Duration:* `1 day, 2:30:00 (1590.0 min)`'
|
'*Duration:* `1 day, 2:30:00 (1590.0 min)`'
|
||||||
)
|
)
|
||||||
# Reset singleton function to avoid random breaks
|
# Reset singleton function to avoid random breaks
|
||||||
telegram._rpc._fiat_converter.convert_amount = old_convamount
|
telegram._rpc._fiat_converter.convert_amount = old_convamount
|
||||||
|
|
||||||
|
@ -1133,7 +1133,6 @@ def test_handle_stoploss_on_exchange(mocker, default_conf_usdt, fee, caplog, is_
|
|||||||
trade.is_open = True
|
trade.is_open = True
|
||||||
trade.open_order_id = None
|
trade.open_order_id = None
|
||||||
trade.stoploss_order_id = "100"
|
trade.stoploss_order_id = "100"
|
||||||
|
|
||||||
trade.orders.append(Order(
|
trade.orders.append(Order(
|
||||||
ft_order_side='stoploss',
|
ft_order_side='stoploss',
|
||||||
order_id='100',
|
order_id='100',
|
||||||
@ -3277,7 +3276,7 @@ def test_execute_trade_exit_down(default_conf_usdt, ticker_usdt, fee, ticker_usd
|
|||||||
'close_rate': ANY,
|
'close_rate': ANY,
|
||||||
'sub_trade': False,
|
'sub_trade': False,
|
||||||
'stake_amount': pytest.approx(60),
|
'stake_amount': pytest.approx(60),
|
||||||
} == last_msg
|
} == last_msg
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
|
@ -2411,7 +2411,7 @@ def test_recalc_trade_from_orders(fee):
|
|||||||
assert pytest.approx(trade.fee_open_cost) == o1_fee_cost + o2_fee_cost + o3_fee_cost
|
assert pytest.approx(trade.fee_open_cost) == o1_fee_cost + o2_fee_cost + o3_fee_cost
|
||||||
assert pytest.approx(trade.open_trade_value) == o1_trade_val + o2_trade_val + o3_trade_val
|
assert pytest.approx(trade.open_trade_value) == o1_trade_val + o2_trade_val + o3_trade_val
|
||||||
|
|
||||||
# Just to make sure non partial sell orders are ignored, let's calculate one more time.
|
# Just to make sure full sell orders are ignored, let's calculate one more time.
|
||||||
|
|
||||||
sell1 = Order(
|
sell1 = Order(
|
||||||
ft_order_side='sell',
|
ft_order_side='sell',
|
||||||
@ -2574,7 +2574,7 @@ def test_recalc_trade_from_orders_ignores_bad_orders(fee, is_short):
|
|||||||
assert trade.open_trade_value == 2 * o1_trade_val
|
assert trade.open_trade_value == 2 * o1_trade_val
|
||||||
assert trade.nr_of_successful_entries == 2
|
assert trade.nr_of_successful_entries == 2
|
||||||
|
|
||||||
# Just to make sure non partial exit orders are ignored, let's calculate one more time.
|
# Reduce position - this will reduce amount again.
|
||||||
sell1 = Order(
|
sell1 = Order(
|
||||||
ft_order_side=exit_side,
|
ft_order_side=exit_side,
|
||||||
ft_pair=trade.pair,
|
ft_pair=trade.pair,
|
||||||
|
Loading…
Reference in New Issue
Block a user