mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
tests update
This commit is contained in:
parent
7143b64fb7
commit
1309c2b14f
|
@ -260,7 +260,8 @@ class FreqtradeBot(object):
|
|||
if ticker_rate < order_book_rate:
|
||||
logger.info('...using ticker rate instead %0.8f', ticker_rate)
|
||||
used_rate = ticker_rate
|
||||
used_rate = order_book_rate
|
||||
else:
|
||||
used_rate = order_book_rate
|
||||
else:
|
||||
logger.info('Using Last Ask / Last Price')
|
||||
used_rate = ticker_rate
|
||||
|
@ -557,8 +558,7 @@ class FreqtradeBot(object):
|
|||
ticker)
|
||||
|
||||
experimental_ask_strategy = self.config.get('experimental', {}).get('ask_strategy', {})
|
||||
if 'use_order_book' in experimental_ask_strategy and\
|
||||
experimental_ask_strategy.get('use_order_book', False):
|
||||
if experimental_ask_strategy.get('use_order_book', False):
|
||||
logger.info('Using order book for selling...')
|
||||
# logger.debug('Order book %s',orderBook)
|
||||
order_book_min = experimental_ask_strategy.get('order_book_min', 1)
|
||||
|
|
|
@ -1938,11 +1938,12 @@ def test_order_book_bid_strategy(default_conf) -> None:
|
|||
default_conf['exchange']['name'] = 'binance'
|
||||
default_conf['experimental']['bid_strategy']['use_order_book'] = True
|
||||
default_conf['experimental']['bid_strategy']['order_book_top'] = 2
|
||||
default_conf['bid_strategy']['ask_last_balance'] = 0
|
||||
default_conf['telegram']['enabled'] = False
|
||||
|
||||
freqtrade = FreqtradeBot(default_conf)
|
||||
|
||||
assert freqtrade.get_target_bid('ETH/BTC', {'ask': 20, 'last': 10}) != 20
|
||||
assert freqtrade.get_target_bid('BTC/USDT', {'ask': 2, 'last': 2}) == 2
|
||||
|
||||
|
||||
def test_trunc_num(default_conf) -> None:
|
||||
|
@ -1990,3 +1991,10 @@ def test_order_book_ask_strategy(default_conf, limit_buy_order, limit_sell_order
|
|||
|
||||
trade = Trade.query.first()
|
||||
assert trade
|
||||
|
||||
time.sleep(0.01) # Race condition fix
|
||||
trade.update(limit_buy_order)
|
||||
assert trade.is_open is True
|
||||
|
||||
patch_get_signal(freqtrade, value=(False, True))
|
||||
assert freqtrade.handle_trade(trade) is True
|
||||
|
|
Loading…
Reference in New Issue
Block a user