Repository: hummingbot/hummingbot
Issue: AscendEX - Failed to create order due to DupNewCoid error

**Describe the bug**
Traceback (most recent call last):
  File "/root/mm2/hummingbot/connector/exchange/ascend_ex/ascend_ex_exchange.py", line 541, in _create_order
    raise Exception(f'Failed to create an order, reason: {resp["data"]["info"]["errorCode"]}')
Exception: Failed to create an order, reason: DupNewCoid

Based on the documentation on ascendex, it might be duplicated new client order id generated. It is unable to generate unique client order id per trade.

**Steps To Reproduce**
Run pure market making strategy with order refresh time 1s and order_level 3 in ascendex exchange

**Screenshots**
// If applicable, add screenshots to help explain your problem.

**Release version**
0.42.0.
Running Source build. Linux on cloud server

**Attachments**
[logs_conf_pure_mm_1.log](https://github.com/CoinAlpha/hummingbot/files/7032022/logs_conf_pure_mm_1.log)

_WARNING: Do NOT publish any exchange API keys or your wallet's private key. Whoever has access to them may steal your assets!_

**Optional: your discord username:**



┆Issue is synchronized with this [Clickup task](https://app.clickup.com/t/1ran00b) by [Unito](https://www.unito.io)


Changed files:
hummingbot/connector/exchange/ascend_ex/ascend_ex_exchange.py, hummingbot/connector/exchange/ascend_ex/ascend_ex_utils.py

diff --git a/hummingbot/connector/exchange/ascend_ex/ascend_ex_exchange.py b/hummingbot/connector/exchange/ascend_ex/ascend_ex_exchange.py
index a6bf15c54..2b10b70ff 100644
--- a/hummingbot/connector/exchange/ascend_ex/ascend_ex_exchange.py
+++ b/hummingbot/connector/exchange/ascend_ex/ascend_ex_exchange.py
@@ -503,8 +503,10 @@ class AscendExExchange(ExchangePyBase):
             raise ValueError("Order amount must be greater than zero.")
         try:
             timestamp = ascend_ex_utils.get_ms_timestamp()
+            # Order UUID is strictly used to enable AscendEx to construct a unique(still questionable) exchange_order_id
+            order_uuid = f"{ascend_ex_utils.HBOT_BROKER_ID}-{ascend_ex_utils.uuid32()}"[:32]
             api_params = {
-                "id": order_id,
+                "id": order_uuid,
                 "time": timestamp,
                 "symbol": ascend_ex_utils.convert_to_exchange_trading_pair(trading_pair),
                 "orderPrice": f"{price:f}",
diff --git a/hummingbot/connector/exchange/ascend_ex/ascend_ex_utils.py b/hummingbot/connector/exchange/ascend_ex/ascend_ex_utils.py
index f4e54436e..a781344eb 100644
--- a/hummingbot/connector/exchange/ascend_ex/ascend_ex_utils.py
+++ b/hummingbot/connector/exchange/ascend_ex/ascend_ex_utils.py
@@ -1,11 +1,10 @@
 import random
 import string
 from typing import Tuple
-from hummingbot.core.utils.tracking_nonce import get_tracking_nonce_low_res
+from hummingbot.core.utils.tracking_nonce import get_tracking_nonce_low_res, get_tracking_nonce
 
 from hummingbot.client.config.config_var import ConfigVar
 from hummingbot.client.config.config_methods import using_exchange
-from hummingbot.core.utils.tracking_nonce import get_tracking_nonce
 
 
 CENTRALIZED = True
@@ -51,6 +50,9 @@ def derive_order_id(user_uid: str, cl_order_id: str, ts: int) -> str:
     :param ts: order timestamp in milliseconds
     :return: order id of length 32
     """
+    # NOTE: The derived_order_id function details how AscendEx server generates the exchange_order_id
+    #       Currently, due to how the exchange constructs the exchange_order_id, there is a real possibility of
+    #       duplicate order ids
     return (HBOT_BROKER_ID + format(ts, 'x')[-11:] + user_uid[-11:] + cl_order_id[-5:])[:32]
 
 
@@ -73,6 +75,10 @@ def gen_exchange_order_id(userUid: str, client_order_id: str) -> Tuple[str, int]
 
 
 def gen_client_order_id(is_buy: bool, trading_pair: str) -> str:
+    """
+    Generates the client order id.
+    Note: All AscendEx API interactions, after order creation, utilizes the exchange_order_id instead.
+    """
     side = "B" if is_buy else "S"
     base, quote = trading_pair.split("-")
     return f"{HBOT_BROKER_ID}-{side}{base[:3]}{quote[:3]}{get_tracking_nonce()}"