Update mock_usdt trade method
This commit is contained in:
parent
76f87377ba
commit
2c7c5f9a6e
@ -325,7 +325,7 @@ def create_mock_trades_with_leverage(fee, use_db: bool = True):
|
|||||||
Trade.query.session.flush()
|
Trade.query.session.flush()
|
||||||
|
|
||||||
|
|
||||||
def create_mock_trades_usdt(fee, use_db: bool = True):
|
def create_mock_trades_usdt(fee, is_short: Optional[bool] = False, use_db: bool = True):
|
||||||
"""
|
"""
|
||||||
Create some fake trades ...
|
Create some fake trades ...
|
||||||
"""
|
"""
|
||||||
@ -335,26 +335,29 @@ def create_mock_trades_usdt(fee, use_db: bool = True):
|
|||||||
else:
|
else:
|
||||||
LocalTrade.add_bt_trade(trade)
|
LocalTrade.add_bt_trade(trade)
|
||||||
|
|
||||||
|
is_short1 = is_short if is_short is not None else True
|
||||||
|
is_short2 = is_short if is_short is not None else False
|
||||||
|
|
||||||
# Simulate dry_run entries
|
# Simulate dry_run entries
|
||||||
trade = mock_trade_usdt_1(fee)
|
trade = mock_trade_usdt_1(fee, is_short1)
|
||||||
add_trade(trade)
|
add_trade(trade)
|
||||||
|
|
||||||
trade = mock_trade_usdt_2(fee)
|
trade = mock_trade_usdt_2(fee, is_short1)
|
||||||
add_trade(trade)
|
add_trade(trade)
|
||||||
|
|
||||||
trade = mock_trade_usdt_3(fee)
|
trade = mock_trade_usdt_3(fee, is_short1)
|
||||||
add_trade(trade)
|
add_trade(trade)
|
||||||
|
|
||||||
trade = mock_trade_usdt_4(fee)
|
trade = mock_trade_usdt_4(fee, is_short2)
|
||||||
add_trade(trade)
|
add_trade(trade)
|
||||||
|
|
||||||
trade = mock_trade_usdt_5(fee)
|
trade = mock_trade_usdt_5(fee, is_short2)
|
||||||
add_trade(trade)
|
add_trade(trade)
|
||||||
|
|
||||||
trade = mock_trade_usdt_6(fee)
|
trade = mock_trade_usdt_6(fee, is_short1)
|
||||||
add_trade(trade)
|
add_trade(trade)
|
||||||
|
|
||||||
trade = mock_trade_usdt_7(fee)
|
trade = mock_trade_usdt_7(fee, is_short1)
|
||||||
add_trade(trade)
|
add_trade(trade)
|
||||||
if use_db:
|
if use_db:
|
||||||
Trade.commit()
|
Trade.commit()
|
||||||
|
@ -6,12 +6,24 @@ from freqtrade.persistence.models import Order, Trade
|
|||||||
MOCK_TRADE_COUNT = 6
|
MOCK_TRADE_COUNT = 6
|
||||||
|
|
||||||
|
|
||||||
def mock_order_usdt_1():
|
def entry_side(is_short: bool):
|
||||||
|
return "sell" if is_short else "buy"
|
||||||
|
|
||||||
|
|
||||||
|
def exit_side(is_short: bool):
|
||||||
|
return "buy" if is_short else "sell"
|
||||||
|
|
||||||
|
|
||||||
|
def direc(is_short: bool):
|
||||||
|
return "short" if is_short else "long"
|
||||||
|
|
||||||
|
|
||||||
|
def mock_order_usdt_1(is_short: bool):
|
||||||
return {
|
return {
|
||||||
'id': '1234',
|
'id': f'1234_{direc(is_short)}',
|
||||||
'symbol': 'ADA/USDT',
|
'symbol': 'ADA/USDT',
|
||||||
'status': 'closed',
|
'status': 'closed',
|
||||||
'side': 'buy',
|
'side': entry_side(is_short),
|
||||||
'type': 'limit',
|
'type': 'limit',
|
||||||
'price': 2.0,
|
'price': 2.0,
|
||||||
'amount': 10.0,
|
'amount': 10.0,
|
||||||
@ -20,7 +32,7 @@ def mock_order_usdt_1():
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def mock_trade_usdt_1(fee):
|
def mock_trade_usdt_1(fee, is_short: bool):
|
||||||
trade = Trade(
|
trade = Trade(
|
||||||
pair='ADA/USDT',
|
pair='ADA/USDT',
|
||||||
stake_amount=20.0,
|
stake_amount=20.0,
|
||||||
@ -32,21 +44,22 @@ def mock_trade_usdt_1(fee):
|
|||||||
open_date=datetime.now(tz=timezone.utc) - timedelta(minutes=17),
|
open_date=datetime.now(tz=timezone.utc) - timedelta(minutes=17),
|
||||||
open_rate=2.0,
|
open_rate=2.0,
|
||||||
exchange='binance',
|
exchange='binance',
|
||||||
open_order_id='dry_run_buy_12345',
|
open_order_id=f'1234_{direc(is_short)}',
|
||||||
strategy='StrategyTestV2',
|
strategy='StrategyTestV2',
|
||||||
timeframe=5,
|
timeframe=5,
|
||||||
|
is_short=is_short,
|
||||||
)
|
)
|
||||||
o = Order.parse_from_ccxt_object(mock_order_usdt_1(), 'ADA/USDT', 'buy')
|
o = Order.parse_from_ccxt_object(mock_order_usdt_1(is_short), 'ADA/USDT', entry_side(is_short))
|
||||||
trade.orders.append(o)
|
trade.orders.append(o)
|
||||||
return trade
|
return trade
|
||||||
|
|
||||||
|
|
||||||
def mock_order_usdt_2():
|
def mock_order_usdt_2(is_short: bool):
|
||||||
return {
|
return {
|
||||||
'id': '1235',
|
'id': f'1235_{direc(is_short)}',
|
||||||
'symbol': 'ETC/USDT',
|
'symbol': 'ETC/USDT',
|
||||||
'status': 'closed',
|
'status': 'closed',
|
||||||
'side': 'buy',
|
'side': entry_side(is_short),
|
||||||
'type': 'limit',
|
'type': 'limit',
|
||||||
'price': 2.0,
|
'price': 2.0,
|
||||||
'amount': 100.0,
|
'amount': 100.0,
|
||||||
@ -55,12 +68,12 @@ def mock_order_usdt_2():
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def mock_order_usdt_2_sell():
|
def mock_order_usdt_2_exit(is_short: bool):
|
||||||
return {
|
return {
|
||||||
'id': '12366',
|
'id': f'12366_{direc(is_short)}',
|
||||||
'symbol': 'ETC/USDT',
|
'symbol': 'ETC/USDT',
|
||||||
'status': 'closed',
|
'status': 'closed',
|
||||||
'side': 'sell',
|
'side': exit_side(is_short),
|
||||||
'type': 'limit',
|
'type': 'limit',
|
||||||
'price': 2.05,
|
'price': 2.05,
|
||||||
'amount': 100.0,
|
'amount': 100.0,
|
||||||
@ -69,7 +82,7 @@ def mock_order_usdt_2_sell():
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def mock_trade_usdt_2(fee):
|
def mock_trade_usdt_2(fee, is_short: bool):
|
||||||
"""
|
"""
|
||||||
Closed trade...
|
Closed trade...
|
||||||
"""
|
"""
|
||||||
@ -86,26 +99,28 @@ def mock_trade_usdt_2(fee):
|
|||||||
close_profit_abs=3.9875,
|
close_profit_abs=3.9875,
|
||||||
exchange='binance',
|
exchange='binance',
|
||||||
is_open=False,
|
is_open=False,
|
||||||
open_order_id='dry_run_sell_12345',
|
open_order_id=f'12366_{direc(is_short)}',
|
||||||
strategy='StrategyTestV2',
|
strategy='StrategyTestV2',
|
||||||
timeframe=5,
|
timeframe=5,
|
||||||
exit_reason='sell_signal',
|
exit_reason='exit_signal',
|
||||||
open_date=datetime.now(tz=timezone.utc) - timedelta(minutes=20),
|
open_date=datetime.now(tz=timezone.utc) - timedelta(minutes=20),
|
||||||
close_date=datetime.now(tz=timezone.utc) - timedelta(minutes=2),
|
close_date=datetime.now(tz=timezone.utc) - timedelta(minutes=2),
|
||||||
|
is_short=is_short,
|
||||||
)
|
)
|
||||||
o = Order.parse_from_ccxt_object(mock_order_usdt_2(), 'ETC/USDT', 'buy')
|
o = Order.parse_from_ccxt_object(mock_order_usdt_2(is_short), 'ETC/USDT', entry_side(is_short))
|
||||||
trade.orders.append(o)
|
trade.orders.append(o)
|
||||||
o = Order.parse_from_ccxt_object(mock_order_usdt_2_sell(), 'ETC/USDT', 'sell')
|
o = Order.parse_from_ccxt_object(
|
||||||
|
mock_order_usdt_2_exit(is_short), 'ETC/USDT', exit_side(is_short))
|
||||||
trade.orders.append(o)
|
trade.orders.append(o)
|
||||||
return trade
|
return trade
|
||||||
|
|
||||||
|
|
||||||
def mock_order_usdt_3():
|
def mock_order_usdt_3(is_short: bool):
|
||||||
return {
|
return {
|
||||||
'id': '41231a12a',
|
'id': f'41231a12a_{direc(is_short)}',
|
||||||
'symbol': 'XRP/USDT',
|
'symbol': 'XRP/USDT',
|
||||||
'status': 'closed',
|
'status': 'closed',
|
||||||
'side': 'buy',
|
'side': entry_side(is_short),
|
||||||
'type': 'limit',
|
'type': 'limit',
|
||||||
'price': 1.0,
|
'price': 1.0,
|
||||||
'amount': 30.0,
|
'amount': 30.0,
|
||||||
@ -114,12 +129,12 @@ def mock_order_usdt_3():
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def mock_order_usdt_3_sell():
|
def mock_order_usdt_3_exit(is_short: bool):
|
||||||
return {
|
return {
|
||||||
'id': '41231a666a',
|
'id': f'41231a666a_{direc(is_short)}',
|
||||||
'symbol': 'XRP/USDT',
|
'symbol': 'XRP/USDT',
|
||||||
'status': 'closed',
|
'status': 'closed',
|
||||||
'side': 'sell',
|
'side': exit_side(is_short),
|
||||||
'type': 'stop_loss_limit',
|
'type': 'stop_loss_limit',
|
||||||
'price': 1.1,
|
'price': 1.1,
|
||||||
'average': 1.1,
|
'average': 1.1,
|
||||||
@ -129,7 +144,7 @@ def mock_order_usdt_3_sell():
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def mock_trade_usdt_3(fee):
|
def mock_trade_usdt_3(fee, is_short: bool):
|
||||||
"""
|
"""
|
||||||
Closed trade
|
Closed trade
|
||||||
"""
|
"""
|
||||||
@ -151,20 +166,22 @@ def mock_trade_usdt_3(fee):
|
|||||||
exit_reason='roi',
|
exit_reason='roi',
|
||||||
open_date=datetime.now(tz=timezone.utc) - timedelta(minutes=20),
|
open_date=datetime.now(tz=timezone.utc) - timedelta(minutes=20),
|
||||||
close_date=datetime.now(tz=timezone.utc),
|
close_date=datetime.now(tz=timezone.utc),
|
||||||
|
is_short=is_short,
|
||||||
)
|
)
|
||||||
o = Order.parse_from_ccxt_object(mock_order_usdt_3(), 'XRP/USDT', 'buy')
|
o = Order.parse_from_ccxt_object(mock_order_usdt_3(is_short), 'XRP/USDT', entry_side(is_short))
|
||||||
trade.orders.append(o)
|
trade.orders.append(o)
|
||||||
o = Order.parse_from_ccxt_object(mock_order_usdt_3_sell(), 'XRP/USDT', 'sell')
|
o = Order.parse_from_ccxt_object(mock_order_usdt_3_exit(is_short),
|
||||||
|
'XRP/USDT', exit_side(is_short))
|
||||||
trade.orders.append(o)
|
trade.orders.append(o)
|
||||||
return trade
|
return trade
|
||||||
|
|
||||||
|
|
||||||
def mock_order_usdt_4():
|
def mock_order_usdt_4(is_short: bool):
|
||||||
return {
|
return {
|
||||||
'id': 'prod_buy_12345',
|
'id': f'prod_buy_12345_{direc(is_short)}',
|
||||||
'symbol': 'ETC/USDT',
|
'symbol': 'ETC/USDT',
|
||||||
'status': 'open',
|
'status': 'open',
|
||||||
'side': 'buy',
|
'side': entry_side(is_short),
|
||||||
'type': 'limit',
|
'type': 'limit',
|
||||||
'price': 2.0,
|
'price': 2.0,
|
||||||
'amount': 10.0,
|
'amount': 10.0,
|
||||||
@ -173,7 +190,7 @@ def mock_order_usdt_4():
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def mock_trade_usdt_4(fee):
|
def mock_trade_usdt_4(fee, is_short: bool):
|
||||||
"""
|
"""
|
||||||
Simulate prod entry
|
Simulate prod entry
|
||||||
"""
|
"""
|
||||||
@ -188,21 +205,22 @@ def mock_trade_usdt_4(fee):
|
|||||||
is_open=True,
|
is_open=True,
|
||||||
open_rate=2.0,
|
open_rate=2.0,
|
||||||
exchange='binance',
|
exchange='binance',
|
||||||
open_order_id='prod_buy_12345',
|
open_order_id=f'prod_buy_12345_{direc(is_short)}',
|
||||||
strategy='StrategyTestV2',
|
strategy='StrategyTestV2',
|
||||||
timeframe=5,
|
timeframe=5,
|
||||||
|
is_short=is_short,
|
||||||
)
|
)
|
||||||
o = Order.parse_from_ccxt_object(mock_order_usdt_4(), 'ETC/USDT', 'buy')
|
o = Order.parse_from_ccxt_object(mock_order_usdt_4(is_short), 'ETC/USDT', entry_side(is_short))
|
||||||
trade.orders.append(o)
|
trade.orders.append(o)
|
||||||
return trade
|
return trade
|
||||||
|
|
||||||
|
|
||||||
def mock_order_usdt_5():
|
def mock_order_usdt_5(is_short: bool):
|
||||||
return {
|
return {
|
||||||
'id': 'prod_buy_3455',
|
'id': f'prod_buy_3455_{direc(is_short)}',
|
||||||
'symbol': 'XRP/USDT',
|
'symbol': 'XRP/USDT',
|
||||||
'status': 'closed',
|
'status': 'closed',
|
||||||
'side': 'buy',
|
'side': entry_side(is_short),
|
||||||
'type': 'limit',
|
'type': 'limit',
|
||||||
'price': 2.0,
|
'price': 2.0,
|
||||||
'amount': 10.0,
|
'amount': 10.0,
|
||||||
@ -211,12 +229,12 @@ def mock_order_usdt_5():
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def mock_order_usdt_5_stoploss():
|
def mock_order_usdt_5_stoploss(is_short: bool):
|
||||||
return {
|
return {
|
||||||
'id': 'prod_stoploss_3455',
|
'id': f'prod_stoploss_3455_{direc(is_short)}',
|
||||||
'symbol': 'XRP/USDT',
|
'symbol': 'XRP/USDT',
|
||||||
'status': 'open',
|
'status': 'open',
|
||||||
'side': 'sell',
|
'side': exit_side(is_short),
|
||||||
'type': 'stop_loss_limit',
|
'type': 'stop_loss_limit',
|
||||||
'price': 2.0,
|
'price': 2.0,
|
||||||
'amount': 10.0,
|
'amount': 10.0,
|
||||||
@ -225,7 +243,7 @@ def mock_order_usdt_5_stoploss():
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def mock_trade_usdt_5(fee):
|
def mock_trade_usdt_5(fee, is_short: bool):
|
||||||
"""
|
"""
|
||||||
Simulate prod entry with stoploss
|
Simulate prod entry with stoploss
|
||||||
"""
|
"""
|
||||||
@ -241,22 +259,23 @@ def mock_trade_usdt_5(fee):
|
|||||||
open_rate=2.0,
|
open_rate=2.0,
|
||||||
exchange='binance',
|
exchange='binance',
|
||||||
strategy='SampleStrategy',
|
strategy='SampleStrategy',
|
||||||
stoploss_order_id='prod_stoploss_3455',
|
stoploss_order_id=f'prod_stoploss_3455_{direc(is_short)}',
|
||||||
timeframe=5,
|
timeframe=5,
|
||||||
|
is_short=is_short,
|
||||||
)
|
)
|
||||||
o = Order.parse_from_ccxt_object(mock_order_usdt_5(), 'XRP/USDT', 'buy')
|
o = Order.parse_from_ccxt_object(mock_order_usdt_5(is_short), 'XRP/USDT', entry_side(is_short))
|
||||||
trade.orders.append(o)
|
trade.orders.append(o)
|
||||||
o = Order.parse_from_ccxt_object(mock_order_usdt_5_stoploss(), 'XRP/USDT', 'stoploss')
|
o = Order.parse_from_ccxt_object(mock_order_usdt_5_stoploss(is_short), 'XRP/USDT', 'stoploss')
|
||||||
trade.orders.append(o)
|
trade.orders.append(o)
|
||||||
return trade
|
return trade
|
||||||
|
|
||||||
|
|
||||||
def mock_order_usdt_6():
|
def mock_order_usdt_6(is_short: bool):
|
||||||
return {
|
return {
|
||||||
'id': 'prod_buy_6',
|
'id': f'prod_entry_6_{direc(is_short)}',
|
||||||
'symbol': 'LTC/USDT',
|
'symbol': 'LTC/USDT',
|
||||||
'status': 'closed',
|
'status': 'closed',
|
||||||
'side': 'buy',
|
'side': entry_side(is_short),
|
||||||
'type': 'limit',
|
'type': 'limit',
|
||||||
'price': 10.0,
|
'price': 10.0,
|
||||||
'amount': 2.0,
|
'amount': 2.0,
|
||||||
@ -265,12 +284,12 @@ def mock_order_usdt_6():
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def mock_order_usdt_6_sell():
|
def mock_order_usdt_6_exit(is_short: bool):
|
||||||
return {
|
return {
|
||||||
'id': 'prod_sell_6',
|
'id': f'prod_exit_6_{direc(is_short)}',
|
||||||
'symbol': 'LTC/USDT',
|
'symbol': 'LTC/USDT',
|
||||||
'status': 'open',
|
'status': 'open',
|
||||||
'side': 'sell',
|
'side': exit_side(is_short),
|
||||||
'type': 'limit',
|
'type': 'limit',
|
||||||
'price': 12.0,
|
'price': 12.0,
|
||||||
'amount': 2.0,
|
'amount': 2.0,
|
||||||
@ -279,7 +298,7 @@ def mock_order_usdt_6_sell():
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def mock_trade_usdt_6(fee):
|
def mock_trade_usdt_6(fee, is_short: bool):
|
||||||
"""
|
"""
|
||||||
Simulate prod entry with open sell order
|
Simulate prod entry with open sell order
|
||||||
"""
|
"""
|
||||||
@ -295,22 +314,24 @@ def mock_trade_usdt_6(fee):
|
|||||||
open_rate=10.0,
|
open_rate=10.0,
|
||||||
exchange='binance',
|
exchange='binance',
|
||||||
strategy='SampleStrategy',
|
strategy='SampleStrategy',
|
||||||
open_order_id="prod_sell_6",
|
open_order_id=f'prod_exit_6_{direc(is_short)}',
|
||||||
timeframe=5,
|
timeframe=5,
|
||||||
|
is_short=is_short,
|
||||||
)
|
)
|
||||||
o = Order.parse_from_ccxt_object(mock_order_usdt_6(), 'LTC/USDT', 'buy')
|
o = Order.parse_from_ccxt_object(mock_order_usdt_6(is_short), 'LTC/USDT', entry_side(is_short))
|
||||||
trade.orders.append(o)
|
trade.orders.append(o)
|
||||||
o = Order.parse_from_ccxt_object(mock_order_usdt_6_sell(), 'LTC/USDT', 'sell')
|
o = Order.parse_from_ccxt_object(mock_order_usdt_6_exit(is_short),
|
||||||
|
'LTC/USDT', exit_side(is_short))
|
||||||
trade.orders.append(o)
|
trade.orders.append(o)
|
||||||
return trade
|
return trade
|
||||||
|
|
||||||
|
|
||||||
def mock_order_usdt_7():
|
def mock_order_usdt_7(is_short: bool):
|
||||||
return {
|
return {
|
||||||
'id': 'prod_buy_7',
|
'id': f'prod_entry_7_{direc(is_short)}',
|
||||||
'symbol': 'LTC/USDT',
|
'symbol': 'LTC/USDT',
|
||||||
'status': 'closed',
|
'status': 'closed',
|
||||||
'side': 'buy',
|
'side': entry_side(is_short),
|
||||||
'type': 'limit',
|
'type': 'limit',
|
||||||
'price': 10.0,
|
'price': 10.0,
|
||||||
'amount': 2.0,
|
'amount': 2.0,
|
||||||
@ -319,12 +340,12 @@ def mock_order_usdt_7():
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def mock_order_usdt_7_sell():
|
def mock_order_usdt_7_exit(is_short: bool):
|
||||||
return {
|
return {
|
||||||
'id': 'prod_sell_7',
|
'id': f'prod_exit_7_{direc(is_short)}',
|
||||||
'symbol': 'LTC/USDT',
|
'symbol': 'LTC/USDT',
|
||||||
'status': 'closed',
|
'status': 'closed',
|
||||||
'side': 'sell',
|
'side': exit_side(is_short),
|
||||||
'type': 'limit',
|
'type': 'limit',
|
||||||
'price': 8.0,
|
'price': 8.0,
|
||||||
'amount': 2.0,
|
'amount': 2.0,
|
||||||
@ -333,7 +354,7 @@ def mock_order_usdt_7_sell():
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def mock_trade_usdt_7(fee):
|
def mock_trade_usdt_7(fee, is_short: bool):
|
||||||
"""
|
"""
|
||||||
Simulate prod entry with open sell order
|
Simulate prod entry with open sell order
|
||||||
"""
|
"""
|
||||||
@ -342,8 +363,8 @@ def mock_trade_usdt_7(fee):
|
|||||||
stake_amount=20.0,
|
stake_amount=20.0,
|
||||||
amount=2.0,
|
amount=2.0,
|
||||||
amount_requested=2.0,
|
amount_requested=2.0,
|
||||||
open_date=datetime.now(tz=timezone.utc) - timedelta(minutes=20),
|
open_date=datetime.now(tz=timezone.utc) - timedelta(days=2, minutes=20),
|
||||||
close_date=datetime.now(tz=timezone.utc) - timedelta(minutes=5),
|
close_date=datetime.now(tz=timezone.utc) - timedelta(days=2, minutes=5),
|
||||||
fee_open=fee.return_value,
|
fee_open=fee.return_value,
|
||||||
fee_close=fee.return_value,
|
fee_close=fee.return_value,
|
||||||
is_open=False,
|
is_open=False,
|
||||||
@ -353,11 +374,13 @@ def mock_trade_usdt_7(fee):
|
|||||||
close_profit_abs=-4.0,
|
close_profit_abs=-4.0,
|
||||||
exchange='binance',
|
exchange='binance',
|
||||||
strategy='SampleStrategy',
|
strategy='SampleStrategy',
|
||||||
open_order_id="prod_sell_6",
|
open_order_id=f'prod_exit_7_{direc(is_short)}',
|
||||||
timeframe=5,
|
timeframe=5,
|
||||||
|
is_short=is_short,
|
||||||
)
|
)
|
||||||
o = Order.parse_from_ccxt_object(mock_order_usdt_7(), 'LTC/USDT', 'buy')
|
o = Order.parse_from_ccxt_object(mock_order_usdt_7(is_short), 'LTC/USDT', entry_side(is_short))
|
||||||
trade.orders.append(o)
|
trade.orders.append(o)
|
||||||
o = Order.parse_from_ccxt_object(mock_order_usdt_7_sell(), 'LTC/USDT', 'sell')
|
o = Order.parse_from_ccxt_object(mock_order_usdt_7_exit(is_short),
|
||||||
|
'LTC/USDT', exit_side(is_short))
|
||||||
trade.orders.append(o)
|
trade.orders.append(o)
|
||||||
return trade
|
return trade
|
||||||
|
@ -762,8 +762,8 @@ def test_PerformanceFilter_keep_mid_order(mocker, default_conf_usdt, fee, caplog
|
|||||||
with time_machine.travel("2021-09-01 05:00:00 +00:00") as t:
|
with time_machine.travel("2021-09-01 05:00:00 +00:00") as t:
|
||||||
create_mock_trades_usdt(fee)
|
create_mock_trades_usdt(fee)
|
||||||
pm.refresh_pairlist()
|
pm.refresh_pairlist()
|
||||||
assert pm.whitelist == ['XRP/USDT', 'ETC/USDT', 'ETH/USDT',
|
assert pm.whitelist == ['XRP/USDT', 'ETC/USDT', 'ETH/USDT', 'LTC/USDT',
|
||||||
'NEO/USDT', 'TKN/USDT', 'ADA/USDT', 'LTC/USDT']
|
'NEO/USDT', 'TKN/USDT', 'ADA/USDT', ]
|
||||||
# assert log_has_re(r'Removing pair .* since .* is below .*', caplog)
|
# assert log_has_re(r'Removing pair .* since .* is below .*', caplog)
|
||||||
|
|
||||||
# Move to "outside" of lookback window, so original sorting is restored.
|
# Move to "outside" of lookback window, so original sorting is restored.
|
||||||
|
Loading…
Reference in New Issue
Block a user