chore: update dry-run order-id generation to uuid

this is supposed to avoid insert errors in windows CI
due to time imprecisions on windows ...

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
Matthias
2026-04-27 07:16:55 +02:00
parent 5710fe4477
commit 820000fac4
2 changed files with 21 additions and 1 deletions
+19
View File
@@ -1,5 +1,6 @@
import copy
import logging
import re
from copy import deepcopy
from datetime import UTC, datetime, timedelta
from random import randint
@@ -1077,6 +1078,24 @@ def test_create_dry_run_order(default_conf, mocker, side, exchange_name, leverag
assert order["cost"] == 1 * 200
def test_create_dry_run_order_id_unique_with_same_timestamp(default_conf, mocker, time_machine):
exchange = get_patched_exchange(mocker, default_conf)
time_machine.move_to("2026-04-27T04:49:57.438232Z", tick=False)
order1 = exchange.create_dry_run_order(
pair="ETH/USDT", ordertype="limit", side="sell", amount=1, rate=2.05, leverage=1.0
)
order2 = exchange.create_dry_run_order(
pair="ETH/USDT", ordertype="limit", side="sell", amount=1, rate=2.05, leverage=1.0
)
assert order1["id"] != order2["id"]
assert re.match(
r"^dry_run_sell_ETH/USDT_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12}$",
order1["id"],
)
@pytest.mark.parametrize(
"side,is_short,order_reason",
[