This commit is contained in:
Nullart2 2018-08-05 21:08:07 +08:00
parent 4a9bf78770
commit 26d591ea43
3 changed files with 6 additions and 5 deletions

View File

@ -116,7 +116,7 @@ class Exchange(object):
api.urls['api'] = api.urls['test'] api.urls['api'] = api.urls['test']
logger.info("Enabled Sandbox API on %s", name) logger.info("Enabled Sandbox API on %s", name)
else: else:
logger.warning(self, "No Sandbox URL in CCXT, exiting. " logger.warning(name, "No Sandbox URL in CCXT, exiting. "
"Please check your config.json") "Please check your config.json")
raise OperationalException(f'Exchange {name} does not provide a sandbox api') raise OperationalException(f'Exchange {name} does not provide a sandbox api')

View File

@ -34,7 +34,7 @@ def parse_ticker_dataframe(ticker: list) -> DataFrame:
return frame return frame
def order_book_to_dataframe(data: list) -> DataFrame: def order_book_to_dataframe(bids: list, asks: list) -> DataFrame:
""" """
Gets order book list, returns dataframe with below format per suggested by creslin Gets order book list, returns dataframe with below format per suggested by creslin
------------------------------------------------------------------- -------------------------------------------------------------------
@ -42,11 +42,12 @@ def order_book_to_dataframe(data: list) -> DataFrame:
------------------------------------------------------------------- -------------------------------------------------------------------
""" """
cols = ['bids', 'b_size'] cols = ['bids', 'b_size']
bids_frame = DataFrame(data['bids'], columns=cols)
bids_frame = DataFrame(bids, columns=cols)
# add cumulative sum column # add cumulative sum column
bids_frame['b_sum'] = bids_frame['b_size'].cumsum() bids_frame['b_sum'] = bids_frame['b_size'].cumsum()
cols2 = ['asks', 'a_size'] cols2 = ['asks', 'a_size']
asks_frame = DataFrame(data['asks'], columns=cols2) asks_frame = DataFrame(asks, columns=cols2)
# add cumulative sum column # add cumulative sum column
asks_frame['a_sum'] = asks_frame['a_size'].cumsum() asks_frame['a_sum'] = asks_frame['a_size'].cumsum()

View File

@ -386,7 +386,7 @@ class FreqtradeBot(object):
conf_bids_to_ask_delta = experimental_check_depth_of_market.get('bids_to_ask_delta', 0) conf_bids_to_ask_delta = experimental_check_depth_of_market.get('bids_to_ask_delta', 0)
logger.info('checking depth of market for %s', pair) logger.info('checking depth of market for %s', 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) 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