Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/development' into feat/connector…
Browse files Browse the repository at this point in the history
…-coinzoom
  • Loading branch information
TheHolyRoger committed Apr 2, 2021
2 parents 745933a + 37df326 commit b65fb5d
Show file tree
Hide file tree
Showing 34 changed files with 1,679 additions and 109 deletions.
2 changes: 1 addition & 1 deletion hummingbot/client/command/config_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def list_configs(self, # type: HummingbotApplication
self._notify("\n".join(lines))

if self.strategy_name is not None:
data = [[cv.key, cv.value] for cv in self.strategy_config_map.values() if not cv.is_secure]
data = [[cv.printable_key or cv.key, cv.value] for cv in self.strategy_config_map.values() if not cv.is_secure]
df = pd.DataFrame(data=data, columns=columns)
self._notify("\nStrategy Configurations:")
lines = [" " + line for line in df.to_string(index=False, max_colwidth=50).split("\n")]
Expand Down
4 changes: 3 additions & 1 deletion hummingbot/client/config/config_var.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ def __init__(self,
# Whether to prompt a user for value when new strategy config file is created
prompt_on_new: bool = False,
# Whether this is a config var used in connect command
is_connect_key: bool = False):
is_connect_key: bool = False,
printable_key: str = None):
self.prompt = prompt
self.key = key
self.value = None
Expand All @@ -36,6 +37,7 @@ def __init__(self,
self._on_validated = on_validated
self.prompt_on_new = prompt_on_new
self.is_connect_key = is_connect_key
self.printable_key = printable_key

async def get_prompt(self):
if inspect.iscoroutinefunction(self.prompt):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,8 @@ async def _order_book_diff_router(self):

now: float = time.time()
if int(now / 60.0) > int(last_message_timestamp / 60.0):
self.logger().debug("Diff messages process: %d, rejected: %d, queued: %d",
messages_accepted,
messages_rejected,
messages_queued)
self.logger().debug(f"Diff messages processed: {messages_accepted}, "
f"rejected: {messages_rejected}, queued: {messages_queued}")
messages_accepted = 0
messages_rejected = 0
messages_queued = 0
Expand Down Expand Up @@ -128,14 +126,13 @@ async def _track_single_book(self, trading_pair: str):

now: float = time.time()
if int(now / 60.0) > int(last_message_timestamp / 60.0):
self.logger().debug("Processed %d order book diffs for %s.",
diff_messages_accepted, trading_pair)
self.logger().debug(f"Processed {diff_messages_accepted} order book diffs for {trading_pair}.")
diff_messages_accepted = 0
last_message_timestamp = now
elif message.type is OrderBookMessageType.SNAPSHOT:
past_diffs: List[OrderBookMessage] = list(past_diffs_window)
order_book.restore_from_snapshot_and_diffs(message, past_diffs)
self.logger().debug("Processed order book snapshot for %s.", trading_pair)
self.logger().debug(f"Processed order book snapshot for {trading_pair}.")
except asyncio.CancelledError:
raise
except Exception:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ async def _track_single_book(self, trading_pair: str):
# Output some statistics periodically.
now: float = time.time()
if int(now / 60.0) > int(last_message_timestamp / 60.0):
self.logger().debug("Processed %d order book diffs for %s.",
diff_messages_accepted, trading_pair)
self.logger().debug(f"Processed {diff_messages_accepted} order book diffs for {trading_pair}.")
diff_messages_accepted = 0
last_message_timestamp = now
elif message.type is OrderBookMessageType.SNAPSHOT:
Expand All @@ -100,7 +99,7 @@ async def _track_single_book(self, trading_pair: str):
d_bids, d_asks = active_order_tracker.convert_diff_message_to_order_book_row(diff_message)
order_book.apply_diffs(d_bids, d_asks, diff_message.update_id)

self.logger().debug("Processed order book snapshot for %s.", trading_pair)
self.logger().debug(f"Processed order book snapshot for {trading_pair}.")
except asyncio.CancelledError:
raise
except Exception:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,8 @@ async def _order_book_diff_router(self):
# Log some statistics.
now: float = time.time()
if int(now / 60.0) > int(last_message_timestamp / 60.0):
self.logger().debug("Diff messages processed: %d, rejected: %d, queued: %d",
messages_accepted,
messages_rejected,
messages_queued)
self.logger().debug(f"Diff messages processed: {messages_accepted}, "
f"rejected: {messages_rejected}, queued: {messages_queued}")
messages_accepted = 0
messages_rejected = 0
messages_queued = 0
Expand Down Expand Up @@ -175,7 +173,7 @@ async def _track_single_book(self, trading_pair: str):
s_bids, s_asks = active_order_tracker.convert_snapshot_message_to_order_book_row(message)
order_book.apply_snapshot(s_bids, s_asks, message.update_id)

self.logger().debug("Processed order book snapshot for %s.", trading_pair)
self.logger().debug(f"Processed order book snapshot for {trading_pair}.")
except asyncio.CancelledError:
raise
except Exception:
Expand Down
11 changes: 4 additions & 7 deletions hummingbot/connector/exchange/beaxy/beaxy_order_book_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,8 @@ async def _order_book_diff_router(self):
# Log some statistics.
now: float = time.time()
if int(now / 60.0) > int(last_message_timestamp / 60.0):
self.logger().debug('Messages processed: %d, rejected: %d, queued: %d',
messages_accepted,
messages_rejected,
messages_queued)
self.logger().debug(f"Messages processed: {messages_accepted}, "
f"rejected: {messages_rejected}, queued: {messages_queued}")
messages_accepted = 0
messages_rejected = 0
messages_queued = 0
Expand Down Expand Up @@ -163,8 +161,7 @@ async def _track_single_book(self, trading_pair: str):
# Output some statistics periodically.
now: float = time.time()
if int(now / 60.0) > int(last_message_timestamp / 60.0):
self.logger().debug('Processed %d order book diffs for %s.',
diff_messages_accepted, trading_pair)
self.logger().debug(f"Processed {diff_messages_accepted} order book diffs for {trading_pair}.")
diff_messages_accepted = 0
last_message_timestamp = now
elif message.type is OrderBookMessageType.SNAPSHOT:
Expand All @@ -178,7 +175,7 @@ async def _track_single_book(self, trading_pair: str):
d_bids, d_asks = active_order_tracker.convert_diff_message_to_order_book_row(diff_message)
order_book.apply_diffs(d_bids, d_asks, diff_message.update_id)

self.logger().debug('Processed order book snapshot for %s.', trading_pair)
self.logger().debug(f"Processed order book snapshot for {trading_pair}.")
except asyncio.CancelledError:
raise
except Exception:
Expand Down
6 changes: 3 additions & 3 deletions hummingbot/connector/exchange/binance/binance_exchange.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ cdef class BinanceExchange(ExchangeBase):
trading_pairs = list(trading_pairs_to_order_map.keys())
tasks = [self.query_api(self._binance_client.get_my_trades, symbol=convert_to_exchange_trading_pair(trading_pair))
for trading_pair in trading_pairs]
self.logger().debug("Polling for order fills of %d trading pairs.", len(tasks))
self.logger().debug(f"Polling for order fills of {len(tasks)} trading pairs.")
results = await safe_gather(*tasks, return_exceptions=True)
for trades, trading_pair in zip(results, trading_pairs):
order_map = trading_pairs_to_order_map[trading_pair]
Expand Down Expand Up @@ -448,7 +448,7 @@ cdef class BinanceExchange(ExchangeBase):
trading_pairs = self._order_book_tracker._trading_pairs
tasks = [self.query_api(self._binance_client.get_my_trades, symbol=convert_to_exchange_trading_pair(trading_pair))
for trading_pair in trading_pairs]
self.logger().debug("Polling for order fills of %d trading pairs.", len(tasks))
self.logger().debug(f"Polling for order fills of {len(tasks)} trading pairs.")
exchange_history = await safe_gather(*tasks, return_exceptions=True)
for trades, trading_pair in zip(exchange_history, trading_pairs):
if isinstance(trades, Exception):
Expand Down Expand Up @@ -494,7 +494,7 @@ cdef class BinanceExchange(ExchangeBase):
tasks = [self.query_api(self._binance_client.get_order,
symbol=convert_to_exchange_trading_pair(o.trading_pair), origClientOrderId=o.client_order_id)
for o in tracked_orders]
self.logger().debug("Polling for order status updates of %d orders.", len(tasks))
self.logger().debug(f"Polling for order status updates of {len(tasks)} orders.")
results = await safe_gather(*tasks, return_exceptions=True)
for order_update, tracked_order in zip(results, tracked_orders):
client_order_id = tracked_order.client_order_id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,8 @@ async def _order_book_diff_router(self):
# Log some statistics.
now: float = time.time()
if int(now / 60.0) > int(last_message_timestamp / 60.0):
self.logger().debug("Diff messages processed: %d, rejected: %d, queued: %d",
messages_accepted,
messages_rejected,
messages_queued)
self.logger().debug(f"Diff messages processed: {messages_accepted}, "
f"rejected: {messages_rejected}, queued: {messages_queued}")
messages_accepted = 0
messages_rejected = 0
messages_queued = 0
Expand Down Expand Up @@ -129,14 +127,13 @@ async def _track_single_book(self, trading_pair: str):
# Output some statistics periodically.
now: float = time.time()
if int(now / 60.0) > int(last_message_timestamp / 60.0):
self.logger().debug("Processed %d order book diffs for %s.",
diff_messages_accepted, trading_pair)
self.logger().debug(f"Processed {diff_messages_accepted} order book diffs for {trading_pair}.")
diff_messages_accepted = 0
last_message_timestamp = now
elif message.type is OrderBookMessageType.SNAPSHOT:
past_diffs: List[OrderBookMessage] = list(past_diffs_window)
order_book.restore_from_snapshot_and_diffs(message, past_diffs)
self.logger().debug("Processed order book snapshot for %s.", trading_pair)
self.logger().debug(f"Processed order book snapshot for {trading_pair}.")
except asyncio.CancelledError:
raise
except Exception:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,8 @@ async def _order_book_diff_router(self):
# Log some statistics.
now: float = time.time()
if int(now / CALC_STAT_MINUTE) > int(last_message_timestamp / CALC_STAT_MINUTE):
self.logger().debug("Diff messages processed: %d, rejected: %d, queued: %d",
messages_accepted,
messages_rejected,
messages_queued)
self.logger().debug(f"Diff messages processed: {messages_accepted}, "
f"rejected: {messages_rejected}, queued: {messages_queued}")
messages_accepted = 0
messages_rejected = 0
messages_queued = 0
Expand Down Expand Up @@ -171,8 +169,7 @@ async def _track_single_book(self, trading_pair: str):
# Output some statistics periodically.
now: float = time.time()
if int(now / CALC_STAT_MINUTE) > int(last_message_timestamp / CALC_STAT_MINUTE):
self.logger().debug(
"Processed %d order book diffs for %s.", diff_messages_accepted, trading_pair)
self.logger().debug(f"Processed {diff_messages_accepted} order book diffs for {trading_pair}.")
diff_messages_accepted = 0

last_message_timestamp = now
Expand All @@ -193,7 +190,7 @@ async def _track_single_book(self, trading_pair: str):
)
order_book.apply_diffs(d_bids, d_asks, diff_message.update_id)

self.logger().debug("Processed order book snapshot for %s.", trading_pair)
self.logger().debug(f"Processed order book snapshot for {trading_pair}.")
except asyncio.CancelledError:
raise
except Exception as err:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ async def _track_single_book(self, trading_pair: str):
d_bids, d_asks = active_order_tracker.convert_diff_message_to_order_book_row(diff_message)
order_book.apply_diffs(d_bids, d_asks, diff_message.update_id)

self.logger().debug("Processed order book snapshot for %s.", trading_pair)
self.logger().debug(f"Processed order book snapshot for {trading_pair}.")
except asyncio.CancelledError:
raise
except Exception:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,8 @@ async def _order_book_diff_router(self):
# Log some statistics.
now: float = time.time()
if int(now / 60.0) > int(last_message_timestamp / 60.0):
# self.logger().debug("Diff messages processed: %d, rejected: %d, queued: %d",
# messages_accepted,
# messages_rejected,
# messages_queued)
# self.logger().debug(f"Diff messages processed: {messages_accepted}, "
# f"rejected: {messages_rejected}, queued: {messages_queued}")
messages_accepted = 0
messages_rejected = 0
messages_queued = 0
Expand Down Expand Up @@ -127,14 +125,13 @@ async def _track_single_book(self, trading_pair: str):
# Output some statistics periodically.
now: float = time.time()
if int(now / 60.0) > int(last_message_timestamp / 60.0):
# self.logger().debug("Processed %d order book diffs for %s.",
# diff_messages_accepted, trading_pair)
# self.logger().debug(f"Processed {diff_messages_accepted} order book diffs for {trading_pair}.")
diff_messages_accepted = 0
last_message_timestamp = now
elif message.type is OrderBookMessageType.SNAPSHOT:
past_diffs: List[OrderBookMessage] = list(past_diffs_window)
order_book.restore_from_snapshot_and_diffs(message, past_diffs)
# self.logger().debug("Processed order book snapshot for %s.", trading_pair)
# self.logger().debug(f"Processed order book snapshot for {trading_pair}.")
except asyncio.CancelledError:
raise
except Exception:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,8 @@ async def _order_book_diff_router(self):
# Log some statistics.
now: float = time.time()
if int(now / 60.0) > int(last_message_timestamp / 60.0):
self.logger().debug("Diff messages processed: %d, rejected: %d, queued: %d",
messages_accepted,
messages_rejected,
messages_queued)
self.logger().debug(f"Diff messages processed: {messages_accepted}, "
f"rejected: {messages_rejected}, queued: {messages_queued}")
messages_accepted = 0
messages_rejected = 0
messages_queued = 0
Expand Down Expand Up @@ -153,8 +151,7 @@ async def _track_single_book(self, trading_pair: str):
# Output some statistics periodically.
now: float = time.time()
if int(now / 60.0) > int(last_message_timestamp / 60.0):
self.logger().debug("Processed %d order book diffs for %s.",
diff_messages_accepted, trading_pair)
self.logger().debug(f"Processed {diff_messages_accepted} order book diffs for {trading_pair}.")
diff_messages_accepted = 0
last_message_timestamp = now
elif message.type is OrderBookMessageType.SNAPSHOT:
Expand All @@ -168,7 +165,7 @@ async def _track_single_book(self, trading_pair: str):
d_bids, d_asks = active_order_tracker.convert_diff_message_to_order_book_row(diff_message)
order_book.apply_diffs(d_bids, d_asks, diff_message.update_id)

self.logger().debug("Processed order book snapshot for %s.", trading_pair)
self.logger().debug(f"Processed order book snapshot for {trading_pair}.")
except asyncio.CancelledError:
raise
except Exception:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ async def _track_single_book(self, trading_pair: str):
# Output some statistics periodically.
now: float = time.time()
if int(now / 60.0) > int(last_message_timestamp / 60.0):
self.logger().debug("Processed %d order book diffs for %s.",
diff_messages_accepted, trading_pair)
self.logger().debug(f"Processed {diff_messages_accepted} order book diffs for {trading_pair}.")
diff_messages_accepted = 0
last_message_timestamp = now
elif message.type is OrderBookMessageType.SNAPSHOT:
Expand All @@ -98,7 +97,7 @@ async def _track_single_book(self, trading_pair: str):
d_bids, d_asks = active_order_tracker.convert_diff_message_to_order_book_row(diff_message)
order_book.apply_diffs(d_bids, d_asks, diff_message.update_id)

self.logger().debug("Processed order book snapshot for %s.", trading_pair)
self.logger().debug(f"Processed order book snapshot for {trading_pair}.")
except asyncio.CancelledError:
raise
except Exception:
Expand Down
Loading

0 comments on commit b65fb5d

Please sign in to comment.