refactor: enhance order handling and tracking in GridEngine

- Introduced a clientOrderId system for better order identification.
- Updated order creation logic to ensure unique clientOrderIds.
- Improved order cancellation methods to maintain accurate current orders.
- Added tests for new clientOrderId functionality and level state tracking.
- Ensured that desired orders have an intent field set for clarity.
- Enhanced snapshot functionality to include level states for grid lines.
This commit is contained in:
discountry
2026-04-06 20:05:03 +08:00
parent d925fd93ee
commit 345ad11ba3
10 changed files with 1067 additions and 550 deletions
+2 -2
View File
@@ -130,10 +130,10 @@ export class DryRunExchangeAdapter implements ExchangeAdapter {
function createSyntheticOrder(params: CreateOrderParams, counter: number): Order {
const now = Date.now();
const orderId = `dry-run-${now}-${counter}`;
const orderId = params.clientOrderId ?? `dry-run-${now}-${counter}`;
return {
orderId,
clientOrderId: orderId,
clientOrderId: params.clientOrderId ?? orderId,
symbol: params.symbol,
side: params.side,
type: params.type,