@imbingox/acex 0.3.0-beta.0 → 0.3.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,7 +15,6 @@ import type {
15
15
  CancelAllOrdersInput,
16
16
  CancelOrderInput,
17
17
  CreateOrderInput,
18
- Exchange,
19
18
  GetOrderInput,
20
19
  OrderDataStatus,
21
20
  OrderEvent,
@@ -26,11 +25,12 @@ import type {
26
25
  OrderStatusChangedEvent,
27
26
  SubscribeOrdersInput,
28
27
  UnsubscribeOrdersInput,
28
+ Venue,
29
29
  } from "../types/index.ts";
30
30
 
31
31
  interface OrderRecord {
32
32
  accountId: string;
33
- exchange: Exchange;
33
+ venue: Venue;
34
34
  subscribed: boolean;
35
35
  snapshots: Map<string, OrderSnapshot>;
36
36
  status: OrderDataStatus;
@@ -78,7 +78,7 @@ export class OrderManagerImpl
78
78
  status: (filter) =>
79
79
  this.orderStatusBus.stream((event) =>
80
80
  matchesOrderFilter(
81
- { accountId: event.accountId, exchange: event.exchange },
81
+ { accountId: event.accountId, venue: event.venue },
82
82
  filter,
83
83
  ),
84
84
  ),
@@ -87,7 +87,7 @@ export class OrderManagerImpl
87
87
  matchesOrderFilter(
88
88
  {
89
89
  accountId: event.accountId,
90
- exchange: event.exchange,
90
+ venue: event.venue,
91
91
  symbol: "symbol" in event ? event.symbol : undefined,
92
92
  },
93
93
  filter,
@@ -103,7 +103,7 @@ export class OrderManagerImpl
103
103
  const account = this.context.getRegisteredAccount(input.accountId);
104
104
  this.context.ensurePrivateCredentials(input.accountId);
105
105
 
106
- const record = this.getOrCreateRecord(input.accountId, account.exchange);
106
+ const record = this.getOrCreateRecord(input.accountId, account.venue);
107
107
  record.subscribed = true;
108
108
 
109
109
  try {
@@ -136,11 +136,11 @@ export class OrderManagerImpl
136
136
  this.context.assertStarted();
137
137
  const account = this.context.getRegisteredAccount(input.accountId);
138
138
  this.context.ensurePrivateCredentials(input.accountId);
139
- this.validateCreateOrderInput(input, account.exchange);
139
+ this.validateCreateOrderInput(input, account.venue);
140
140
 
141
141
  try {
142
142
  const update = await this.context.createOrder(input);
143
- return this.applyCommandUpdate(input.accountId, account.exchange, update);
143
+ return this.applyCommandUpdate(input.accountId, account.venue, update);
144
144
  } catch (error) {
145
145
  throw this.wrapCommandError(
146
146
  "ORDER_CREATE_FAILED",
@@ -148,7 +148,7 @@ export class OrderManagerImpl
148
148
  error,
149
149
  {
150
150
  accountId: input.accountId,
151
- exchange: account.exchange,
151
+ venue: account.venue,
152
152
  symbol: input.symbol,
153
153
  },
154
154
  );
@@ -159,11 +159,11 @@ export class OrderManagerImpl
159
159
  this.context.assertStarted();
160
160
  const account = this.context.getRegisteredAccount(input.accountId);
161
161
  this.context.ensurePrivateCredentials(input.accountId);
162
- this.validateCancelOrderInput(input, account.exchange);
162
+ this.validateCancelOrderInput(input, account.venue);
163
163
 
164
164
  try {
165
165
  const update = await this.context.cancelOrder(input);
166
- return this.applyCommandUpdate(input.accountId, account.exchange, update);
166
+ return this.applyCommandUpdate(input.accountId, account.venue, update);
167
167
  } catch (error) {
168
168
  throw this.wrapCommandError(
169
169
  "ORDER_CANCEL_FAILED",
@@ -171,7 +171,7 @@ export class OrderManagerImpl
171
171
  error,
172
172
  {
173
173
  accountId: input.accountId,
174
- exchange: account.exchange,
174
+ venue: account.venue,
175
175
  symbol: input.symbol,
176
176
  },
177
177
  );
@@ -185,11 +185,7 @@ export class OrderManagerImpl
185
185
 
186
186
  try {
187
187
  const updates = await this.context.cancelAllOrders(input);
188
- return this.applyCommandUpdates(
189
- input.accountId,
190
- account.exchange,
191
- updates,
192
- );
188
+ return this.applyCommandUpdates(input.accountId, account.venue, updates);
193
189
  } catch (error) {
194
190
  throw this.wrapCommandError(
195
191
  "ORDER_CANCEL_ALL_FAILED",
@@ -197,7 +193,7 @@ export class OrderManagerImpl
197
193
  error,
198
194
  {
199
195
  accountId: input.accountId,
200
- exchange: account.exchange,
196
+ venue: account.venue,
201
197
  symbol: input.symbol,
202
198
  },
203
199
  );
@@ -293,25 +289,25 @@ export class OrderManagerImpl
293
289
  this.records.delete(accountId);
294
290
  }
295
291
 
296
- onCredentialsUpdated(accountId: string, exchange: Exchange): void {
292
+ onCredentialsUpdated(accountId: string, venue: Venue): void {
297
293
  const record = this.records.get(accountId);
298
294
  if (!record?.subscribed) {
299
295
  return;
300
296
  }
301
297
 
302
- this.onPrivateOrderPending(accountId, exchange);
298
+ this.onPrivateOrderPending(accountId, venue);
303
299
  }
304
300
 
305
301
  // --- PrivateOrderDataConsumer ---
306
302
 
307
- onPrivateOrderPending(accountId: string, exchange: Exchange): void {
308
- const record = this.getOrCreateRecord(accountId, exchange);
303
+ onPrivateOrderPending(accountId: string, venue: Venue): void {
304
+ const record = this.getOrCreateRecord(accountId, venue);
309
305
  if (!record.subscribed) {
310
306
  return;
311
307
  }
312
308
 
313
309
  record.status = {
314
- ...this.createStatus(accountId, exchange, "active"),
310
+ ...this.createStatus(accountId, venue, "active"),
315
311
  ready: record.snapshots.size > 0,
316
312
  runtimeStatus: "bootstrap_pending",
317
313
  reason: undefined,
@@ -324,10 +320,10 @@ export class OrderManagerImpl
324
320
 
325
321
  onPrivateOrderBootstrap(
326
322
  accountId: string,
327
- exchange: Exchange,
323
+ venue: Venue,
328
324
  snapshots: RawOrderUpdate[],
329
325
  ): void {
330
- const record = this.getOrCreateRecord(accountId, exchange);
326
+ const record = this.getOrCreateRecord(accountId, venue);
331
327
  if (!record.subscribed) {
332
328
  return;
333
329
  }
@@ -336,7 +332,7 @@ export class OrderManagerImpl
336
332
  for (const update of snapshots) {
337
333
  const snapshot = this.createSnapshot(
338
334
  accountId,
339
- exchange,
335
+ venue,
340
336
  update,
341
337
  this.getExistingSnapshot(record, update),
342
338
  );
@@ -363,7 +359,7 @@ export class OrderManagerImpl
363
359
  const event: OrderSnapshotReplacedEvent = {
364
360
  type: "order.snapshot_replaced",
365
361
  accountId,
366
- exchange,
362
+ venue,
367
363
  snapshot: orderedSnapshots,
368
364
  ts: this.context.now(),
369
365
  };
@@ -374,16 +370,16 @@ export class OrderManagerImpl
374
370
 
375
371
  onPrivateOrderUpdate(
376
372
  accountId: string,
377
- exchange: Exchange,
373
+ venue: Venue,
378
374
  update: RawOrderUpdate,
379
375
  ): void {
380
- const record = this.getOrCreateRecord(accountId, exchange);
376
+ const record = this.getOrCreateRecord(accountId, venue);
381
377
  if (!record.subscribed) {
382
378
  return;
383
379
  }
384
380
 
385
381
  const previous = this.getExistingSnapshot(record, update);
386
- const snapshot = this.createSnapshot(accountId, exchange, update, previous);
382
+ const snapshot = this.createSnapshot(accountId, venue, update, previous);
387
383
  this.setSnapshot(record.snapshots, snapshot);
388
384
 
389
385
  const eventType =
@@ -398,7 +394,7 @@ export class OrderManagerImpl
398
394
  this.orderBus.publish({
399
395
  type: eventType,
400
396
  accountId,
401
- exchange,
397
+ venue,
402
398
  symbol: snapshot.symbol,
403
399
  snapshot,
404
400
  ts: this.context.now(),
@@ -419,10 +415,10 @@ export class OrderManagerImpl
419
415
 
420
416
  onPrivateOrderStreamState(
421
417
  accountId: string,
422
- exchange: Exchange,
418
+ venue: Venue,
423
419
  state: PrivateSubscriptionState,
424
420
  ): void {
425
- const record = this.getOrCreateRecord(accountId, exchange);
421
+ const record = this.getOrCreateRecord(accountId, venue);
426
422
  if (!record.subscribed) {
427
423
  return;
428
424
  }
@@ -446,18 +442,15 @@ export class OrderManagerImpl
446
442
  return [...this.records.values()]
447
443
  .map((record) => cloneOrderStatus(record.status))
448
444
  .sort((left, right) =>
449
- `${left.exchange}:${left.accountId}`.localeCompare(
450
- `${right.exchange}:${right.accountId}`,
445
+ `${left.venue}:${left.accountId}`.localeCompare(
446
+ `${right.venue}:${right.accountId}`,
451
447
  ),
452
448
  );
453
449
  }
454
450
 
455
451
  // --- Internal helpers ---
456
452
 
457
- private getOrCreateRecord(
458
- accountId: string,
459
- exchange: Exchange,
460
- ): OrderRecord {
453
+ private getOrCreateRecord(accountId: string, venue: Venue): OrderRecord {
461
454
  const existing = this.records.get(accountId);
462
455
  if (existing) {
463
456
  return existing;
@@ -465,10 +458,10 @@ export class OrderManagerImpl
465
458
 
466
459
  const record: OrderRecord = {
467
460
  accountId,
468
- exchange,
461
+ venue,
469
462
  subscribed: false,
470
463
  snapshots: new Map(),
471
- status: this.createStatus(accountId, exchange, "inactive"),
464
+ status: this.createStatus(accountId, venue, "inactive"),
472
465
  };
473
466
 
474
467
  this.records.set(accountId, record);
@@ -477,12 +470,12 @@ export class OrderManagerImpl
477
470
 
478
471
  private createStatus(
479
472
  accountId: string,
480
- exchange: Exchange,
473
+ venue: Venue,
481
474
  activity: "active" | "inactive",
482
475
  ): OrderDataStatus {
483
476
  return {
484
477
  accountId,
485
- exchange,
478
+ venue,
486
479
  activity,
487
480
  ready: false,
488
481
  runtimeStatus: activity === "active" ? "bootstrap_pending" : "stopped",
@@ -525,7 +518,7 @@ export class OrderManagerImpl
525
518
 
526
519
  private createSnapshot(
527
520
  accountId: string,
528
- exchange: Exchange,
521
+ venue: Venue,
529
522
  input: RawOrderUpdate,
530
523
  previous?: OrderSnapshot,
531
524
  ): OrderSnapshot {
@@ -538,7 +531,7 @@ export class OrderManagerImpl
538
531
 
539
532
  return {
540
533
  accountId,
541
- exchange,
534
+ venue,
542
535
  orderId: input.orderId,
543
536
  clientOrderId: input.clientOrderId,
544
537
  symbol: input.symbol,
@@ -573,7 +566,7 @@ export class OrderManagerImpl
573
566
  const event: OrderStatusChangedEvent = {
574
567
  type: "order.status_changed",
575
568
  accountId: record.accountId,
576
- exchange: record.exchange,
569
+ venue: record.venue,
577
570
  status: cloneOrderStatus(record.status),
578
571
  ts: this.context.now(),
579
572
  };
@@ -584,7 +577,7 @@ export class OrderManagerImpl
584
577
 
585
578
  private validateCreateOrderInput(
586
579
  input: CreateOrderInput,
587
- exchange: Exchange,
580
+ venue: Venue,
588
581
  ): void {
589
582
  if (input.type === "limit" && !input.price) {
590
583
  throw this.createError(
@@ -592,7 +585,7 @@ export class OrderManagerImpl
592
585
  `Limit orders require price: ${input.accountId}`,
593
586
  {
594
587
  accountId: input.accountId,
595
- exchange,
588
+ venue,
596
589
  symbol: input.symbol,
597
590
  },
598
591
  );
@@ -601,7 +594,7 @@ export class OrderManagerImpl
601
594
 
602
595
  private validateCancelOrderInput(
603
596
  input: CancelOrderInput,
604
- exchange: Exchange,
597
+ venue: Venue,
605
598
  ): void {
606
599
  if (input.orderId || input.clientOrderId) {
607
600
  return;
@@ -612,7 +605,7 @@ export class OrderManagerImpl
612
605
  `cancelOrder requires orderId or clientOrderId: ${input.accountId}`,
613
606
  {
614
607
  accountId: input.accountId,
615
- exchange,
608
+ venue,
616
609
  symbol: input.symbol,
617
610
  },
618
611
  );
@@ -620,23 +613,23 @@ export class OrderManagerImpl
620
613
 
621
614
  private applyCommandUpdate(
622
615
  accountId: string,
623
- exchange: Exchange,
616
+ venue: Venue,
624
617
  update: RawOrderUpdate,
625
618
  ): OrderSnapshot {
626
- const record = this.getOrCreateRecord(accountId, exchange);
619
+ const record = this.getOrCreateRecord(accountId, venue);
627
620
  const previous = this.getExistingSnapshot(record, update);
628
- const snapshot = this.createSnapshot(accountId, exchange, update, previous);
621
+ const snapshot = this.createSnapshot(accountId, venue, update, previous);
629
622
  this.setSnapshot(record.snapshots, snapshot);
630
623
  return snapshot;
631
624
  }
632
625
 
633
626
  private applyCommandUpdates(
634
627
  accountId: string,
635
- exchange: Exchange,
628
+ venue: Venue,
636
629
  updates: RawOrderUpdate[],
637
630
  ): OrderSnapshot[] {
638
631
  return updates.map((update) =>
639
- this.applyCommandUpdate(accountId, exchange, update),
632
+ this.applyCommandUpdate(accountId, venue, update),
640
633
  );
641
634
  }
642
635
 
@@ -649,7 +642,7 @@ export class OrderManagerImpl
649
642
  message: string,
650
643
  metadata: {
651
644
  accountId: string;
652
- exchange: Exchange;
645
+ venue: Venue;
653
646
  symbol?: string;
654
647
  },
655
648
  ): AcexError {
@@ -667,7 +660,7 @@ export class OrderManagerImpl
667
660
  error: unknown,
668
661
  metadata: {
669
662
  accountId: string;
670
- exchange: Exchange;
663
+ venue: Venue;
671
664
  symbol: string;
672
665
  },
673
666
  ): AcexError {
@@ -1,14 +1,14 @@
1
1
  import type BigNumber from "bignumber.js";
2
2
  import type {
3
- Exchange,
4
3
  PrivateRuntimeReason,
5
4
  PrivateRuntimeStatus,
6
5
  SubscriptionActivity,
6
+ Venue,
7
7
  } from "./shared.ts";
8
8
 
9
9
  export interface AccountDataStatus {
10
10
  accountId: string;
11
- exchange: Exchange;
11
+ venue: Venue;
12
12
  activity: SubscriptionActivity;
13
13
  ready: boolean;
14
14
  runtimeStatus?: PrivateRuntimeStatus;
@@ -21,7 +21,7 @@ export interface AccountDataStatus {
21
21
  export interface AccountStatusChangedEvent {
22
22
  type: "account.status_changed";
23
23
  accountId: string;
24
- exchange: Exchange;
24
+ venue: Venue;
25
25
  status: AccountDataStatus;
26
26
  ts: number;
27
27
  }
@@ -44,13 +44,13 @@ export interface PositionKeyInput {
44
44
 
45
45
  export interface AccountEventFilter {
46
46
  accountId?: string;
47
- exchange?: Exchange;
47
+ venue?: Venue;
48
48
  symbol?: string;
49
49
  }
50
50
 
51
51
  export interface BalanceSnapshot {
52
52
  accountId: string;
53
- exchange: Exchange;
53
+ venue: Venue;
54
54
  asset: string;
55
55
  free: BigNumber;
56
56
  used: BigNumber;
@@ -59,11 +59,21 @@ export interface BalanceSnapshot {
59
59
  receivedAt: number;
60
60
  updatedAt: number;
61
61
  seq: number;
62
+ lending?: LendingBalanceFacet;
63
+ }
64
+
65
+ export interface LendingBalanceFacet {
66
+ supplied: BigNumber;
67
+ borrowed: BigNumber;
68
+ interest: BigNumber;
69
+ netAsset: BigNumber;
70
+ supplyAPY?: BigNumber;
71
+ borrowAPY?: BigNumber;
62
72
  }
63
73
 
64
74
  export interface PositionSnapshot {
65
75
  accountId: string;
66
- exchange: Exchange;
76
+ venue: Venue;
67
77
  symbol: string;
68
78
  side: PositionSide;
69
79
  size: BigNumber;
@@ -80,20 +90,30 @@ export interface PositionSnapshot {
80
90
 
81
91
  export interface RiskSnapshot {
82
92
  accountId: string;
83
- exchange: Exchange;
93
+ venue: Venue;
84
94
  equity?: BigNumber;
85
- marginRatio?: BigNumber;
95
+ riskRatio?: BigNumber;
86
96
  initialMargin?: BigNumber;
87
97
  maintenanceMargin?: BigNumber;
88
98
  exchangeTs?: number;
89
99
  receivedAt: number;
90
100
  updatedAt: number;
91
101
  seq: number;
102
+ lending?: LendingRiskFacet;
103
+ }
104
+
105
+ export interface LendingRiskFacet {
106
+ marginLevel?: BigNumber;
107
+ healthFactor?: BigNumber;
108
+ ltv?: BigNumber;
109
+ liquidationThreshold?: BigNumber;
110
+ totalCollateralUSD?: BigNumber;
111
+ totalDebtUSD?: BigNumber;
92
112
  }
93
113
 
94
114
  export interface AccountSnapshot {
95
115
  accountId: string;
96
- exchange: Exchange;
116
+ venue: Venue;
97
117
  balances: Record<string, BalanceSnapshot>;
98
118
  positions: PositionSnapshot[];
99
119
  risk?: RiskSnapshot;
@@ -104,7 +124,7 @@ export interface AccountSnapshot {
104
124
 
105
125
  export interface AccountEventBase {
106
126
  accountId: string;
107
- exchange: Exchange;
127
+ venue: Venue;
108
128
  ts: number;
109
129
  }
110
130
 
@@ -18,10 +18,10 @@ import type {
18
18
  AcexInternalError,
19
19
  ClientStatus,
20
20
  CreateClientOptions,
21
- Exchange,
22
21
  RegisterAccountInput,
23
22
  RegisterAccountResult,
24
23
  StopOptions,
24
+ Venue,
25
25
  } from "./shared.ts";
26
26
 
27
27
  export interface ClientHealthSnapshot {
@@ -46,7 +46,7 @@ export type HealthEvent =
46
46
 
47
47
  export interface HealthEventFilter {
48
48
  scope?: "client" | "market" | "account" | "order";
49
- exchange?: Exchange;
49
+ venue?: Venue;
50
50
  accountId?: string;
51
51
  symbol?: string;
52
52
  }
@@ -1,14 +1,10 @@
1
1
  import type BigNumber from "bignumber.js";
2
- import type {
3
- Exchange,
4
- MarketFreshness,
5
- SubscriptionActivity,
6
- } from "./shared.ts";
2
+ import type { MarketFreshness, SubscriptionActivity, Venue } from "./shared.ts";
7
3
 
8
4
  export type MarketType = "spot" | "swap" | "future";
9
5
 
10
6
  export interface MarketDefinition {
11
- exchange: Exchange;
7
+ venue: Venue;
12
8
  symbol: string;
13
9
  id: string;
14
10
  type: MarketType;
@@ -31,7 +27,7 @@ export interface MarketDefinition {
31
27
  }
32
28
 
33
29
  export interface MarketDataStatus {
34
- exchange: Exchange;
30
+ venue: Venue;
35
31
  symbol: string;
36
32
  activity: SubscriptionActivity;
37
33
  ready: boolean;
@@ -53,21 +49,48 @@ export interface MarketDataStreamStatus {
53
49
  }
54
50
 
55
51
  export interface MarketKeyInput {
56
- exchange: Exchange;
52
+ venue: Venue;
57
53
  symbol: string;
58
54
  }
59
55
 
56
+ export type DecimalInput = string | number | BigNumber;
57
+
58
+ export type NormalizeOrderInputRejectReason =
59
+ | "price_not_positive"
60
+ | "amount_not_positive"
61
+ | "amount_below_min"
62
+ | "notional_below_min";
63
+
64
+ export interface NormalizeOrderInputInput extends MarketKeyInput {
65
+ price: DecimalInput;
66
+ amount: DecimalInput;
67
+ }
68
+
69
+ export interface NormalizedOrderInput {
70
+ price: string;
71
+ amount: string;
72
+ rawPrice: string;
73
+ rawAmount: string;
74
+ adjusted: boolean;
75
+ accepted: boolean;
76
+ rejectReason?: NormalizeOrderInputRejectReason;
77
+ priceStep: string;
78
+ amountStep: string;
79
+ minAmount?: string;
80
+ minNotional?: string;
81
+ }
82
+
60
83
  export interface SubscribeL1BookInput extends MarketKeyInput {}
61
84
 
62
85
  export interface SubscribeFundingRateInput extends MarketKeyInput {}
63
86
 
64
87
  export interface MarketEventFilter {
65
- exchange?: Exchange;
88
+ venue?: Venue;
66
89
  symbol?: string;
67
90
  }
68
91
 
69
92
  export interface L1Book {
70
- exchange: Exchange;
93
+ venue: Venue;
71
94
  symbol: string;
72
95
  bidPrice: BigNumber;
73
96
  bidSize: BigNumber;
@@ -81,7 +104,7 @@ export interface L1Book {
81
104
  }
82
105
 
83
106
  export interface FundingRateSnapshot {
84
- exchange: Exchange;
107
+ venue: Venue;
85
108
  symbol: string;
86
109
  fundingRate: BigNumber;
87
110
  nextFundingTime?: number;
@@ -96,7 +119,7 @@ export interface FundingRateSnapshot {
96
119
 
97
120
  export interface MarketStatusChangedEvent {
98
121
  type: "market.status_changed";
99
- exchange: Exchange;
122
+ venue: Venue;
100
123
  symbol: string;
101
124
  status: MarketDataStatus;
102
125
  ts: number;
@@ -104,7 +127,7 @@ export interface MarketStatusChangedEvent {
104
127
 
105
128
  export interface L1BookUpdatedEvent {
106
129
  type: "l1_book.updated";
107
- exchange: Exchange;
130
+ venue: Venue;
108
131
  symbol: string;
109
132
  snapshot: L1Book;
110
133
  ts: number;
@@ -112,7 +135,7 @@ export interface L1BookUpdatedEvent {
112
135
 
113
136
  export interface FundingRateUpdatedEvent {
114
137
  type: "funding_rate.updated";
115
- exchange: Exchange;
138
+ venue: Venue;
116
139
  symbol: string;
117
140
  snapshot: FundingRateSnapshot;
118
141
  ts: number;
@@ -141,9 +164,10 @@ export interface MarketManager {
141
164
  subscribeFundingRate(input: SubscribeFundingRateInput): Promise<void>;
142
165
  unsubscribeFundingRate(input: SubscribeFundingRateInput): Promise<void>;
143
166
 
144
- getMarket(exchange: Exchange, symbol: string): MarketDefinition | undefined;
167
+ getMarket(venue: Venue, symbol: string): MarketDefinition | undefined;
145
168
  getMarkets(symbol: string): MarketDefinition[];
146
- listMarkets(exchange?: Exchange): MarketDefinition[];
169
+ listMarkets(venue?: Venue): MarketDefinition[];
170
+ normalizeOrderInput(input: NormalizeOrderInputInput): NormalizedOrderInput;
147
171
  getL1Book(key: MarketKeyInput): L1Book | undefined;
148
172
  getL1Books(symbol: string): L1Book[];
149
173
  getFundingRate(key: MarketKeyInput): FundingRateSnapshot | undefined;
@@ -1,15 +1,15 @@
1
1
  import type BigNumber from "bignumber.js";
2
2
  import type { PositionSide } from "./account.ts";
3
3
  import type {
4
- Exchange,
5
4
  PrivateRuntimeReason,
6
5
  PrivateRuntimeStatus,
7
6
  SubscriptionActivity,
7
+ Venue,
8
8
  } from "./shared.ts";
9
9
 
10
10
  export interface OrderDataStatus {
11
11
  accountId: string;
12
- exchange: Exchange;
12
+ venue: Venue;
13
13
  activity: SubscriptionActivity;
14
14
  ready: boolean;
15
15
  runtimeStatus?: PrivateRuntimeStatus;
@@ -22,7 +22,7 @@ export interface OrderDataStatus {
22
22
  export interface OrderStatusChangedEvent {
23
23
  type: "order.status_changed";
24
24
  accountId: string;
25
- exchange: Exchange;
25
+ venue: Venue;
26
26
  status: OrderDataStatus;
27
27
  ts: number;
28
28
  }
@@ -66,6 +66,7 @@ interface CreateOrderInputBase {
66
66
  export interface CreateLimitOrderInput extends CreateOrderInputBase {
67
67
  type: "limit";
68
68
  price: string;
69
+ postOnly?: boolean;
69
70
  }
70
71
 
71
72
  export interface CreateMarketOrderInput extends CreateOrderInputBase {
@@ -88,13 +89,13 @@ export interface CancelAllOrdersInput {
88
89
 
89
90
  export interface OrderEventFilter {
90
91
  accountId?: string;
91
- exchange?: Exchange;
92
+ venue?: Venue;
92
93
  symbol?: string;
93
94
  }
94
95
 
95
96
  export interface OrderSnapshot {
96
97
  accountId: string;
97
- exchange: Exchange;
98
+ venue: Venue;
98
99
  orderId?: string;
99
100
  clientOrderId?: string;
100
101
  symbol: string;
@@ -117,7 +118,7 @@ export interface OrderSnapshot {
117
118
 
118
119
  export interface OrderEventBase {
119
120
  accountId: string;
120
- exchange: Exchange;
121
+ venue: Venue;
121
122
  symbol: string;
122
123
  ts: number;
123
124
  }
@@ -145,7 +146,7 @@ export interface OrderRejectedEvent extends OrderEventBase {
145
146
  export interface OrderSnapshotReplacedEvent {
146
147
  type: "order.snapshot_replaced";
147
148
  accountId: string;
148
- exchange: Exchange;
149
+ venue: Venue;
149
150
  snapshot: OrderSnapshot[];
150
151
  ts: number;
151
152
  }