More consistency changes...

This commit is contained in:
Yazeed Al Oyoun 2020-02-04 01:57:24 +01:00
parent d457d43999
commit 91b4c9668c

View File

@ -427,23 +427,23 @@ class FreqtradeBot:
Checks depth of market before executing a buy Checks depth of market before executing a buy
""" """
conf_bids_to_ask_delta = conf.get('bids_to_ask_delta', 0) conf_bids_to_ask_delta = conf.get('bids_to_ask_delta', 0)
logger.info('checking depth of market for %s', pair) logger.info(f"Checking depth of market for {pair} ...")
order_book = self.exchange.get_order_book(pair, 1000) order_book = self.exchange.get_order_book(pair, 1000)
order_book_data_frame = order_book_to_dataframe(order_book['bids'], order_book['asks']) order_book_data_frame = order_book_to_dataframe(order_book['bids'], order_book['asks'])
order_book_bids = order_book_data_frame['b_size'].sum() order_book_bids = order_book_data_frame['b_size'].sum()
order_book_asks = order_book_data_frame['a_size'].sum() order_book_asks = order_book_data_frame['a_size'].sum()
bids_ask_delta = order_book_bids / order_book_asks bids_ask_delta = order_book_bids / order_book_asks
logger.info( logger.info(
f"bids: {order_book_bids}, asks: {order_book_asks}, delta: {bids_ask_delta}, " f"Bids: {order_book_bids}, Asks: {order_book_asks}, Delta: {bids_ask_delta}, "
f"askprice: {order_book['asks'][0][0]}, bidprice: {order_book['bids'][0][0]}, " f"Bid Price: {order_book['bids'][0][0]}, Ask Price: {order_book['asks'][0][0]}, "
f"immediate ask quantity: {order_book['asks'][0][1]}, " f"Immediate Bid Quantity: {order_book['bids'][0][1]}, "
f"immediate bid quantity: {order_book['bids'][0][1]}", f"Immediate Ask Quantity: {order_book['asks'][0][1]}."
) )
if bids_ask_delta >= conf_bids_to_ask_delta: if bids_ask_delta >= conf_bids_to_ask_delta:
logger.info('bids to ask delta DOES satisfy condition.') logger.info(f"Bids to asks delta for {pair} DOES satisfy condition.")
return True return True
else: else:
logger.info(f"bids to ask delta for {pair} does not satisfy condition.") logger.info(f"Bids to asks delta for {pair} does not satisfy condition.")
return False return False
def execute_buy(self, pair: str, stake_amount: float, price: Optional[float] = None) -> bool: def execute_buy(self, pair: str, stake_amount: float, price: Optional[float] = None) -> bool: