@pear-protocol/types 0.0.15 → 0.0.17

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.
Files changed (66) hide show
  1. package/dist/auth/entities.d.ts +10 -1
  2. package/dist/auth/entities.js +4 -2
  3. package/dist/auth/response.d.ts +13 -12
  4. package/dist/auth/response.js +6 -2
  5. package/dist/bundle.d.ts +1 -0
  6. package/dist/bundle.js +1 -0
  7. package/dist/common/address.d.ts +3 -0
  8. package/dist/common/address.js +5 -0
  9. package/dist/common/hex-string.d.ts +3 -0
  10. package/dist/common/hex-string.js +5 -0
  11. package/dist/common/refinement.d.ts +1 -0
  12. package/dist/common/refinement.js +9 -1
  13. package/dist/common/request.js +1 -1
  14. package/dist/common/schema.d.ts +1 -1
  15. package/dist/common/schema.js +1 -1
  16. package/dist/connector/index.d.ts +4 -1
  17. package/dist/execution/entities.d.ts +6 -6
  18. package/dist/execution/responses.d.ts +2 -2
  19. package/dist/fill/entities.d.ts +20 -2
  20. package/dist/fill/entities.js +30 -5
  21. package/dist/fill/queries.d.ts +1 -0
  22. package/dist/fill/queries.js +3 -3
  23. package/dist/fill/responses.d.ts +44 -4
  24. package/dist/fill/responses.js +10 -1
  25. package/dist/instrument/responses.d.ts +4 -0
  26. package/dist/instrument/responses.js +5 -2
  27. package/dist/misc/index.d.ts +3 -1
  28. package/dist/misc/index.js +2 -1
  29. package/dist/misc/payloads.d.ts +33 -0
  30. package/dist/misc/payloads.js +31 -0
  31. package/dist/misc/responses.d.ts +26 -0
  32. package/dist/misc/responses.js +24 -0
  33. package/dist/position/entities.d.ts +5 -5
  34. package/dist/position/responses.d.ts +32 -2
  35. package/dist/position/responses.js +13 -1
  36. package/dist/schedule/entities.d.ts +82 -16
  37. package/dist/schedule/entities.js +5 -5
  38. package/dist/schedule/payloads.d.ts +4 -4
  39. package/dist/schedule/payloads.js +7 -7
  40. package/dist/schedule/responses.d.ts +66 -14
  41. package/dist/statistics/entities.d.ts +10 -3
  42. package/dist/statistics/entities.js +9 -3
  43. package/dist/statistics/queries.d.ts +26 -3
  44. package/dist/statistics/queries.js +11 -2
  45. package/dist/statistics/responses.d.ts +12 -3
  46. package/dist/statistics/responses.js +7 -4
  47. package/dist/sync/index.d.ts +2 -0
  48. package/dist/sync/index.js +2 -0
  49. package/dist/sync/payloads.d.ts +279 -0
  50. package/dist/sync/payloads.js +78 -0
  51. package/dist/sync/responses.d.ts +10 -0
  52. package/dist/sync/responses.js +11 -0
  53. package/dist/trade/payloads.d.ts +14 -4
  54. package/dist/trade/responses.d.ts +8 -8
  55. package/dist/trade-accounts/entities.d.ts +6 -0
  56. package/dist/trade-accounts/entities.js +4 -1
  57. package/dist/trade-accounts/payloads.d.ts +46 -10
  58. package/dist/trade-accounts/payloads.js +30 -6
  59. package/dist/trade-accounts/response.d.ts +10 -0
  60. package/dist/trade-accounts/response.js +9 -1
  61. package/dist/trigger/entities/index.d.ts +216 -46
  62. package/dist/trigger/entities/index.js +35 -9
  63. package/dist/trigger/payloads/index.d.ts +21 -6
  64. package/dist/trigger/payloads/index.js +24 -7
  65. package/dist/trigger/responses.d.ts +128 -28
  66. package/package.json +2 -2
@@ -14,13 +14,19 @@ export declare const TriggerCancelledReason: z.ZodEnum<{
14
14
  USER: "USER";
15
15
  POSITION_CLOSED: "POSITION_CLOSED";
16
16
  SYSTEM: "SYSTEM";
17
+ POSITION_NETTED: "POSITION_NETTED";
17
18
  }>;
18
19
  export type TriggerCancelledReason = z.infer<typeof TriggerCancelledReason>;
19
20
  export declare const BracketType: z.ZodEnum<{
20
21
  STOP_LOSS: "STOP_LOSS";
21
22
  TAKE_PROFIT: "TAKE_PROFIT";
23
+ NONE: "NONE";
22
24
  }>;
23
25
  export type BracketType = z.infer<typeof BracketType>;
26
+ export declare const Trailing: z.ZodObject<{
27
+ deltaValue: z.ZodNumber;
28
+ activationValue: z.ZodNumber;
29
+ }, z.core.$strip>;
24
30
  declare const BaseTrigger: z.ZodObject<{
25
31
  id: z.ZodUUID;
26
32
  tradeAccountId: z.ZodUUID;
@@ -42,10 +48,17 @@ declare const BaseTrigger: z.ZodObject<{
42
48
  USER: "USER";
43
49
  POSITION_CLOSED: "POSITION_CLOSED";
44
50
  SYSTEM: "SYSTEM";
51
+ POSITION_NETTED: "POSITION_NETTED";
45
52
  }>>;
46
53
  fills: z.ZodOptional<z.ZodArray<z.ZodObject<{
47
54
  id: z.ZodUUID;
48
- cloid: z.ZodOptional<z.ZodUUID>;
55
+ cloid: z.ZodOptional<z.ZodString>;
56
+ exchangeFillId: z.ZodOptional<z.ZodString>;
57
+ status: z.ZodEnum<{
58
+ PROVISIONAL: "PROVISIONAL";
59
+ CONFIRMED: "CONFIRMED";
60
+ RECONCILED: "RECONCILED";
61
+ }>;
49
62
  tradeAccountId: z.ZodUUID;
50
63
  symbol: z.ZodString;
51
64
  positionId: z.ZodUUID;
@@ -61,16 +74,23 @@ declare const BaseTrigger: z.ZodObject<{
61
74
  SELL: "SELL";
62
75
  }>;
63
76
  reduceOnly: z.ZodBoolean;
77
+ isExternal: z.ZodBoolean;
64
78
  quantity: z.ZodString;
65
79
  price: z.ZodString;
66
80
  usd: z.ZodString;
67
- fee: z.ZodOptional<z.ZodString>;
81
+ tradeFee: z.ZodOptional<z.ZodString>;
82
+ pearFee: z.ZodOptional<z.ZodString>;
68
83
  timestamp: z.ZodString;
84
+ original: z.ZodOptional<z.ZodObject<{
85
+ exchangeFillId: z.ZodString;
86
+ quantity: z.ZodString;
87
+ }, z.core.$strip>>;
69
88
  }, z.core.$strip>>>;
70
- bracketType: z.ZodOptional<z.ZodEnum<{
89
+ bracketType: z.ZodEnum<{
71
90
  STOP_LOSS: "STOP_LOSS";
72
91
  TAKE_PROFIT: "TAKE_PROFIT";
73
- }>>;
92
+ NONE: "NONE";
93
+ }>;
74
94
  createdAt: z.ZodString;
75
95
  updatedAt: z.ZodString;
76
96
  }, z.core.$strip>;
@@ -95,10 +115,17 @@ export declare const TriggerMarketOpen: z.ZodObject<{
95
115
  USER: "USER";
96
116
  POSITION_CLOSED: "POSITION_CLOSED";
97
117
  SYSTEM: "SYSTEM";
118
+ POSITION_NETTED: "POSITION_NETTED";
98
119
  }>>;
99
120
  fills: z.ZodOptional<z.ZodArray<z.ZodObject<{
100
121
  id: z.ZodUUID;
101
- cloid: z.ZodOptional<z.ZodUUID>;
122
+ cloid: z.ZodOptional<z.ZodString>;
123
+ exchangeFillId: z.ZodOptional<z.ZodString>;
124
+ status: z.ZodEnum<{
125
+ PROVISIONAL: "PROVISIONAL";
126
+ CONFIRMED: "CONFIRMED";
127
+ RECONCILED: "RECONCILED";
128
+ }>;
102
129
  tradeAccountId: z.ZodUUID;
103
130
  symbol: z.ZodString;
104
131
  positionId: z.ZodUUID;
@@ -114,16 +141,23 @@ export declare const TriggerMarketOpen: z.ZodObject<{
114
141
  SELL: "SELL";
115
142
  }>;
116
143
  reduceOnly: z.ZodBoolean;
144
+ isExternal: z.ZodBoolean;
117
145
  quantity: z.ZodString;
118
146
  price: z.ZodString;
119
147
  usd: z.ZodString;
120
- fee: z.ZodOptional<z.ZodString>;
148
+ tradeFee: z.ZodOptional<z.ZodString>;
149
+ pearFee: z.ZodOptional<z.ZodString>;
121
150
  timestamp: z.ZodString;
151
+ original: z.ZodOptional<z.ZodObject<{
152
+ exchangeFillId: z.ZodString;
153
+ quantity: z.ZodString;
154
+ }, z.core.$strip>>;
122
155
  }, z.core.$strip>>>;
123
- bracketType: z.ZodOptional<z.ZodEnum<{
156
+ bracketType: z.ZodEnum<{
124
157
  STOP_LOSS: "STOP_LOSS";
125
158
  TAKE_PROFIT: "TAKE_PROFIT";
126
- }>>;
159
+ NONE: "NONE";
160
+ }>;
127
161
  createdAt: z.ZodString;
128
162
  updatedAt: z.ZodString;
129
163
  intent: z.ZodLiteral<"OPEN">;
@@ -244,10 +278,17 @@ export declare const TriggerMarketAdjust: z.ZodObject<{
244
278
  USER: "USER";
245
279
  POSITION_CLOSED: "POSITION_CLOSED";
246
280
  SYSTEM: "SYSTEM";
281
+ POSITION_NETTED: "POSITION_NETTED";
247
282
  }>>;
248
283
  fills: z.ZodOptional<z.ZodArray<z.ZodObject<{
249
284
  id: z.ZodUUID;
250
- cloid: z.ZodOptional<z.ZodUUID>;
285
+ cloid: z.ZodOptional<z.ZodString>;
286
+ exchangeFillId: z.ZodOptional<z.ZodString>;
287
+ status: z.ZodEnum<{
288
+ PROVISIONAL: "PROVISIONAL";
289
+ CONFIRMED: "CONFIRMED";
290
+ RECONCILED: "RECONCILED";
291
+ }>;
251
292
  tradeAccountId: z.ZodUUID;
252
293
  symbol: z.ZodString;
253
294
  positionId: z.ZodUUID;
@@ -263,16 +304,23 @@ export declare const TriggerMarketAdjust: z.ZodObject<{
263
304
  SELL: "SELL";
264
305
  }>;
265
306
  reduceOnly: z.ZodBoolean;
307
+ isExternal: z.ZodBoolean;
266
308
  quantity: z.ZodString;
267
309
  price: z.ZodString;
268
310
  usd: z.ZodString;
269
- fee: z.ZodOptional<z.ZodString>;
311
+ tradeFee: z.ZodOptional<z.ZodString>;
312
+ pearFee: z.ZodOptional<z.ZodString>;
270
313
  timestamp: z.ZodString;
314
+ original: z.ZodOptional<z.ZodObject<{
315
+ exchangeFillId: z.ZodString;
316
+ quantity: z.ZodString;
317
+ }, z.core.$strip>>;
271
318
  }, z.core.$strip>>>;
272
- bracketType: z.ZodOptional<z.ZodEnum<{
319
+ bracketType: z.ZodEnum<{
273
320
  STOP_LOSS: "STOP_LOSS";
274
321
  TAKE_PROFIT: "TAKE_PROFIT";
275
- }>>;
322
+ NONE: "NONE";
323
+ }>;
276
324
  createdAt: z.ZodString;
277
325
  updatedAt: z.ZodString;
278
326
  intent: z.ZodLiteral<"ADJUST">;
@@ -388,7 +436,7 @@ export declare const TriggerMarketAdjust: z.ZodObject<{
388
436
  type: z.ZodLiteral<"MARKET">;
389
437
  position: z.ZodObject<{
390
438
  id: z.ZodUUID;
391
- initialExposure: z.ZodRecord<z.ZodString, z.ZodString>;
439
+ initialExposure: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>>;
392
440
  }, z.core.$strip>;
393
441
  legs: z.ZodTuple<[z.ZodObject<{
394
442
  symbol: z.ZodString;
@@ -416,6 +464,10 @@ export declare const TriggerMarketAdjust: z.ZodObject<{
416
464
  reduceOnly: z.ZodBoolean;
417
465
  }, z.core.$strip>>;
418
466
  }, z.core.$strip>;
467
+ trailing: z.ZodOptional<z.ZodObject<{
468
+ deltaValue: z.ZodNumber;
469
+ activationValue: z.ZodNumber;
470
+ }, z.core.$strip>>;
419
471
  }, z.core.$strip>;
420
472
  export declare const TriggerMarketClose: z.ZodObject<{
421
473
  id: z.ZodUUID;
@@ -438,10 +490,17 @@ export declare const TriggerMarketClose: z.ZodObject<{
438
490
  USER: "USER";
439
491
  POSITION_CLOSED: "POSITION_CLOSED";
440
492
  SYSTEM: "SYSTEM";
493
+ POSITION_NETTED: "POSITION_NETTED";
441
494
  }>>;
442
495
  fills: z.ZodOptional<z.ZodArray<z.ZodObject<{
443
496
  id: z.ZodUUID;
444
- cloid: z.ZodOptional<z.ZodUUID>;
497
+ cloid: z.ZodOptional<z.ZodString>;
498
+ exchangeFillId: z.ZodOptional<z.ZodString>;
499
+ status: z.ZodEnum<{
500
+ PROVISIONAL: "PROVISIONAL";
501
+ CONFIRMED: "CONFIRMED";
502
+ RECONCILED: "RECONCILED";
503
+ }>;
445
504
  tradeAccountId: z.ZodUUID;
446
505
  symbol: z.ZodString;
447
506
  positionId: z.ZodUUID;
@@ -457,16 +516,23 @@ export declare const TriggerMarketClose: z.ZodObject<{
457
516
  SELL: "SELL";
458
517
  }>;
459
518
  reduceOnly: z.ZodBoolean;
519
+ isExternal: z.ZodBoolean;
460
520
  quantity: z.ZodString;
461
521
  price: z.ZodString;
462
522
  usd: z.ZodString;
463
- fee: z.ZodOptional<z.ZodString>;
523
+ tradeFee: z.ZodOptional<z.ZodString>;
524
+ pearFee: z.ZodOptional<z.ZodString>;
464
525
  timestamp: z.ZodString;
526
+ original: z.ZodOptional<z.ZodObject<{
527
+ exchangeFillId: z.ZodString;
528
+ quantity: z.ZodString;
529
+ }, z.core.$strip>>;
465
530
  }, z.core.$strip>>>;
466
- bracketType: z.ZodOptional<z.ZodEnum<{
531
+ bracketType: z.ZodEnum<{
467
532
  STOP_LOSS: "STOP_LOSS";
468
533
  TAKE_PROFIT: "TAKE_PROFIT";
469
- }>>;
534
+ NONE: "NONE";
535
+ }>;
470
536
  createdAt: z.ZodString;
471
537
  updatedAt: z.ZodString;
472
538
  intent: z.ZodLiteral<"CLOSE">;
@@ -582,9 +648,13 @@ export declare const TriggerMarketClose: z.ZodObject<{
582
648
  type: z.ZodLiteral<"MARKET">;
583
649
  position: z.ZodObject<{
584
650
  id: z.ZodUUID;
585
- initialExposure: z.ZodRecord<z.ZodString, z.ZodString>;
651
+ initialExposure: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>>;
586
652
  }, z.core.$strip>;
587
653
  }, z.core.$strip>;
654
+ trailing: z.ZodOptional<z.ZodObject<{
655
+ deltaValue: z.ZodNumber;
656
+ activationValue: z.ZodNumber;
657
+ }, z.core.$strip>>;
588
658
  }, z.core.$strip>;
589
659
  export declare const TriggerMarket: z.ZodDiscriminatedUnion<[z.ZodObject<{
590
660
  id: z.ZodUUID;
@@ -607,10 +677,17 @@ export declare const TriggerMarket: z.ZodDiscriminatedUnion<[z.ZodObject<{
607
677
  USER: "USER";
608
678
  POSITION_CLOSED: "POSITION_CLOSED";
609
679
  SYSTEM: "SYSTEM";
680
+ POSITION_NETTED: "POSITION_NETTED";
610
681
  }>>;
611
682
  fills: z.ZodOptional<z.ZodArray<z.ZodObject<{
612
683
  id: z.ZodUUID;
613
- cloid: z.ZodOptional<z.ZodUUID>;
684
+ cloid: z.ZodOptional<z.ZodString>;
685
+ exchangeFillId: z.ZodOptional<z.ZodString>;
686
+ status: z.ZodEnum<{
687
+ PROVISIONAL: "PROVISIONAL";
688
+ CONFIRMED: "CONFIRMED";
689
+ RECONCILED: "RECONCILED";
690
+ }>;
614
691
  tradeAccountId: z.ZodUUID;
615
692
  symbol: z.ZodString;
616
693
  positionId: z.ZodUUID;
@@ -626,16 +703,23 @@ export declare const TriggerMarket: z.ZodDiscriminatedUnion<[z.ZodObject<{
626
703
  SELL: "SELL";
627
704
  }>;
628
705
  reduceOnly: z.ZodBoolean;
706
+ isExternal: z.ZodBoolean;
629
707
  quantity: z.ZodString;
630
708
  price: z.ZodString;
631
709
  usd: z.ZodString;
632
- fee: z.ZodOptional<z.ZodString>;
710
+ tradeFee: z.ZodOptional<z.ZodString>;
711
+ pearFee: z.ZodOptional<z.ZodString>;
633
712
  timestamp: z.ZodString;
713
+ original: z.ZodOptional<z.ZodObject<{
714
+ exchangeFillId: z.ZodString;
715
+ quantity: z.ZodString;
716
+ }, z.core.$strip>>;
634
717
  }, z.core.$strip>>>;
635
- bracketType: z.ZodOptional<z.ZodEnum<{
718
+ bracketType: z.ZodEnum<{
636
719
  STOP_LOSS: "STOP_LOSS";
637
720
  TAKE_PROFIT: "TAKE_PROFIT";
638
- }>>;
721
+ NONE: "NONE";
722
+ }>;
639
723
  createdAt: z.ZodString;
640
724
  updatedAt: z.ZodString;
641
725
  intent: z.ZodLiteral<"OPEN">;
@@ -755,10 +839,17 @@ export declare const TriggerMarket: z.ZodDiscriminatedUnion<[z.ZodObject<{
755
839
  USER: "USER";
756
840
  POSITION_CLOSED: "POSITION_CLOSED";
757
841
  SYSTEM: "SYSTEM";
842
+ POSITION_NETTED: "POSITION_NETTED";
758
843
  }>>;
759
844
  fills: z.ZodOptional<z.ZodArray<z.ZodObject<{
760
845
  id: z.ZodUUID;
761
- cloid: z.ZodOptional<z.ZodUUID>;
846
+ cloid: z.ZodOptional<z.ZodString>;
847
+ exchangeFillId: z.ZodOptional<z.ZodString>;
848
+ status: z.ZodEnum<{
849
+ PROVISIONAL: "PROVISIONAL";
850
+ CONFIRMED: "CONFIRMED";
851
+ RECONCILED: "RECONCILED";
852
+ }>;
762
853
  tradeAccountId: z.ZodUUID;
763
854
  symbol: z.ZodString;
764
855
  positionId: z.ZodUUID;
@@ -774,16 +865,23 @@ export declare const TriggerMarket: z.ZodDiscriminatedUnion<[z.ZodObject<{
774
865
  SELL: "SELL";
775
866
  }>;
776
867
  reduceOnly: z.ZodBoolean;
868
+ isExternal: z.ZodBoolean;
777
869
  quantity: z.ZodString;
778
870
  price: z.ZodString;
779
871
  usd: z.ZodString;
780
- fee: z.ZodOptional<z.ZodString>;
872
+ tradeFee: z.ZodOptional<z.ZodString>;
873
+ pearFee: z.ZodOptional<z.ZodString>;
781
874
  timestamp: z.ZodString;
875
+ original: z.ZodOptional<z.ZodObject<{
876
+ exchangeFillId: z.ZodString;
877
+ quantity: z.ZodString;
878
+ }, z.core.$strip>>;
782
879
  }, z.core.$strip>>>;
783
- bracketType: z.ZodOptional<z.ZodEnum<{
880
+ bracketType: z.ZodEnum<{
784
881
  STOP_LOSS: "STOP_LOSS";
785
882
  TAKE_PROFIT: "TAKE_PROFIT";
786
- }>>;
883
+ NONE: "NONE";
884
+ }>;
787
885
  createdAt: z.ZodString;
788
886
  updatedAt: z.ZodString;
789
887
  intent: z.ZodLiteral<"ADJUST">;
@@ -899,7 +997,7 @@ export declare const TriggerMarket: z.ZodDiscriminatedUnion<[z.ZodObject<{
899
997
  type: z.ZodLiteral<"MARKET">;
900
998
  position: z.ZodObject<{
901
999
  id: z.ZodUUID;
902
- initialExposure: z.ZodRecord<z.ZodString, z.ZodString>;
1000
+ initialExposure: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>>;
903
1001
  }, z.core.$strip>;
904
1002
  legs: z.ZodTuple<[z.ZodObject<{
905
1003
  symbol: z.ZodString;
@@ -927,6 +1025,10 @@ export declare const TriggerMarket: z.ZodDiscriminatedUnion<[z.ZodObject<{
927
1025
  reduceOnly: z.ZodBoolean;
928
1026
  }, z.core.$strip>>;
929
1027
  }, z.core.$strip>;
1028
+ trailing: z.ZodOptional<z.ZodObject<{
1029
+ deltaValue: z.ZodNumber;
1030
+ activationValue: z.ZodNumber;
1031
+ }, z.core.$strip>>;
930
1032
  }, z.core.$strip>, z.ZodObject<{
931
1033
  id: z.ZodUUID;
932
1034
  tradeAccountId: z.ZodUUID;
@@ -948,10 +1050,17 @@ export declare const TriggerMarket: z.ZodDiscriminatedUnion<[z.ZodObject<{
948
1050
  USER: "USER";
949
1051
  POSITION_CLOSED: "POSITION_CLOSED";
950
1052
  SYSTEM: "SYSTEM";
1053
+ POSITION_NETTED: "POSITION_NETTED";
951
1054
  }>>;
952
1055
  fills: z.ZodOptional<z.ZodArray<z.ZodObject<{
953
1056
  id: z.ZodUUID;
954
- cloid: z.ZodOptional<z.ZodUUID>;
1057
+ cloid: z.ZodOptional<z.ZodString>;
1058
+ exchangeFillId: z.ZodOptional<z.ZodString>;
1059
+ status: z.ZodEnum<{
1060
+ PROVISIONAL: "PROVISIONAL";
1061
+ CONFIRMED: "CONFIRMED";
1062
+ RECONCILED: "RECONCILED";
1063
+ }>;
955
1064
  tradeAccountId: z.ZodUUID;
956
1065
  symbol: z.ZodString;
957
1066
  positionId: z.ZodUUID;
@@ -967,16 +1076,23 @@ export declare const TriggerMarket: z.ZodDiscriminatedUnion<[z.ZodObject<{
967
1076
  SELL: "SELL";
968
1077
  }>;
969
1078
  reduceOnly: z.ZodBoolean;
1079
+ isExternal: z.ZodBoolean;
970
1080
  quantity: z.ZodString;
971
1081
  price: z.ZodString;
972
1082
  usd: z.ZodString;
973
- fee: z.ZodOptional<z.ZodString>;
1083
+ tradeFee: z.ZodOptional<z.ZodString>;
1084
+ pearFee: z.ZodOptional<z.ZodString>;
974
1085
  timestamp: z.ZodString;
1086
+ original: z.ZodOptional<z.ZodObject<{
1087
+ exchangeFillId: z.ZodString;
1088
+ quantity: z.ZodString;
1089
+ }, z.core.$strip>>;
975
1090
  }, z.core.$strip>>>;
976
- bracketType: z.ZodOptional<z.ZodEnum<{
1091
+ bracketType: z.ZodEnum<{
977
1092
  STOP_LOSS: "STOP_LOSS";
978
1093
  TAKE_PROFIT: "TAKE_PROFIT";
979
- }>>;
1094
+ NONE: "NONE";
1095
+ }>;
980
1096
  createdAt: z.ZodString;
981
1097
  updatedAt: z.ZodString;
982
1098
  intent: z.ZodLiteral<"CLOSE">;
@@ -1092,9 +1208,13 @@ export declare const TriggerMarket: z.ZodDiscriminatedUnion<[z.ZodObject<{
1092
1208
  type: z.ZodLiteral<"MARKET">;
1093
1209
  position: z.ZodObject<{
1094
1210
  id: z.ZodUUID;
1095
- initialExposure: z.ZodRecord<z.ZodString, z.ZodString>;
1211
+ initialExposure: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>>;
1096
1212
  }, z.core.$strip>;
1097
1213
  }, z.core.$strip>;
1214
+ trailing: z.ZodOptional<z.ZodObject<{
1215
+ deltaValue: z.ZodNumber;
1216
+ activationValue: z.ZodNumber;
1217
+ }, z.core.$strip>>;
1098
1218
  }, z.core.$strip>], "intent">;
1099
1219
  export declare const Trigger: z.ZodDiscriminatedUnion<[z.ZodDiscriminatedUnion<[z.ZodObject<{
1100
1220
  id: z.ZodUUID;
@@ -1117,10 +1237,17 @@ export declare const Trigger: z.ZodDiscriminatedUnion<[z.ZodDiscriminatedUnion<[
1117
1237
  USER: "USER";
1118
1238
  POSITION_CLOSED: "POSITION_CLOSED";
1119
1239
  SYSTEM: "SYSTEM";
1240
+ POSITION_NETTED: "POSITION_NETTED";
1120
1241
  }>>;
1121
1242
  fills: z.ZodOptional<z.ZodArray<z.ZodObject<{
1122
1243
  id: z.ZodUUID;
1123
- cloid: z.ZodOptional<z.ZodUUID>;
1244
+ cloid: z.ZodOptional<z.ZodString>;
1245
+ exchangeFillId: z.ZodOptional<z.ZodString>;
1246
+ status: z.ZodEnum<{
1247
+ PROVISIONAL: "PROVISIONAL";
1248
+ CONFIRMED: "CONFIRMED";
1249
+ RECONCILED: "RECONCILED";
1250
+ }>;
1124
1251
  tradeAccountId: z.ZodUUID;
1125
1252
  symbol: z.ZodString;
1126
1253
  positionId: z.ZodUUID;
@@ -1136,16 +1263,23 @@ export declare const Trigger: z.ZodDiscriminatedUnion<[z.ZodDiscriminatedUnion<[
1136
1263
  SELL: "SELL";
1137
1264
  }>;
1138
1265
  reduceOnly: z.ZodBoolean;
1266
+ isExternal: z.ZodBoolean;
1139
1267
  quantity: z.ZodString;
1140
1268
  price: z.ZodString;
1141
1269
  usd: z.ZodString;
1142
- fee: z.ZodOptional<z.ZodString>;
1270
+ tradeFee: z.ZodOptional<z.ZodString>;
1271
+ pearFee: z.ZodOptional<z.ZodString>;
1143
1272
  timestamp: z.ZodString;
1273
+ original: z.ZodOptional<z.ZodObject<{
1274
+ exchangeFillId: z.ZodString;
1275
+ quantity: z.ZodString;
1276
+ }, z.core.$strip>>;
1144
1277
  }, z.core.$strip>>>;
1145
- bracketType: z.ZodOptional<z.ZodEnum<{
1278
+ bracketType: z.ZodEnum<{
1146
1279
  STOP_LOSS: "STOP_LOSS";
1147
1280
  TAKE_PROFIT: "TAKE_PROFIT";
1148
- }>>;
1281
+ NONE: "NONE";
1282
+ }>;
1149
1283
  createdAt: z.ZodString;
1150
1284
  updatedAt: z.ZodString;
1151
1285
  intent: z.ZodLiteral<"OPEN">;
@@ -1265,10 +1399,17 @@ export declare const Trigger: z.ZodDiscriminatedUnion<[z.ZodDiscriminatedUnion<[
1265
1399
  USER: "USER";
1266
1400
  POSITION_CLOSED: "POSITION_CLOSED";
1267
1401
  SYSTEM: "SYSTEM";
1402
+ POSITION_NETTED: "POSITION_NETTED";
1268
1403
  }>>;
1269
1404
  fills: z.ZodOptional<z.ZodArray<z.ZodObject<{
1270
1405
  id: z.ZodUUID;
1271
- cloid: z.ZodOptional<z.ZodUUID>;
1406
+ cloid: z.ZodOptional<z.ZodString>;
1407
+ exchangeFillId: z.ZodOptional<z.ZodString>;
1408
+ status: z.ZodEnum<{
1409
+ PROVISIONAL: "PROVISIONAL";
1410
+ CONFIRMED: "CONFIRMED";
1411
+ RECONCILED: "RECONCILED";
1412
+ }>;
1272
1413
  tradeAccountId: z.ZodUUID;
1273
1414
  symbol: z.ZodString;
1274
1415
  positionId: z.ZodUUID;
@@ -1284,16 +1425,23 @@ export declare const Trigger: z.ZodDiscriminatedUnion<[z.ZodDiscriminatedUnion<[
1284
1425
  SELL: "SELL";
1285
1426
  }>;
1286
1427
  reduceOnly: z.ZodBoolean;
1428
+ isExternal: z.ZodBoolean;
1287
1429
  quantity: z.ZodString;
1288
1430
  price: z.ZodString;
1289
1431
  usd: z.ZodString;
1290
- fee: z.ZodOptional<z.ZodString>;
1432
+ tradeFee: z.ZodOptional<z.ZodString>;
1433
+ pearFee: z.ZodOptional<z.ZodString>;
1291
1434
  timestamp: z.ZodString;
1435
+ original: z.ZodOptional<z.ZodObject<{
1436
+ exchangeFillId: z.ZodString;
1437
+ quantity: z.ZodString;
1438
+ }, z.core.$strip>>;
1292
1439
  }, z.core.$strip>>>;
1293
- bracketType: z.ZodOptional<z.ZodEnum<{
1440
+ bracketType: z.ZodEnum<{
1294
1441
  STOP_LOSS: "STOP_LOSS";
1295
1442
  TAKE_PROFIT: "TAKE_PROFIT";
1296
- }>>;
1443
+ NONE: "NONE";
1444
+ }>;
1297
1445
  createdAt: z.ZodString;
1298
1446
  updatedAt: z.ZodString;
1299
1447
  intent: z.ZodLiteral<"ADJUST">;
@@ -1409,7 +1557,7 @@ export declare const Trigger: z.ZodDiscriminatedUnion<[z.ZodDiscriminatedUnion<[
1409
1557
  type: z.ZodLiteral<"MARKET">;
1410
1558
  position: z.ZodObject<{
1411
1559
  id: z.ZodUUID;
1412
- initialExposure: z.ZodRecord<z.ZodString, z.ZodString>;
1560
+ initialExposure: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>>;
1413
1561
  }, z.core.$strip>;
1414
1562
  legs: z.ZodTuple<[z.ZodObject<{
1415
1563
  symbol: z.ZodString;
@@ -1437,6 +1585,10 @@ export declare const Trigger: z.ZodDiscriminatedUnion<[z.ZodDiscriminatedUnion<[
1437
1585
  reduceOnly: z.ZodBoolean;
1438
1586
  }, z.core.$strip>>;
1439
1587
  }, z.core.$strip>;
1588
+ trailing: z.ZodOptional<z.ZodObject<{
1589
+ deltaValue: z.ZodNumber;
1590
+ activationValue: z.ZodNumber;
1591
+ }, z.core.$strip>>;
1440
1592
  }, z.core.$strip>, z.ZodObject<{
1441
1593
  id: z.ZodUUID;
1442
1594
  tradeAccountId: z.ZodUUID;
@@ -1458,10 +1610,17 @@ export declare const Trigger: z.ZodDiscriminatedUnion<[z.ZodDiscriminatedUnion<[
1458
1610
  USER: "USER";
1459
1611
  POSITION_CLOSED: "POSITION_CLOSED";
1460
1612
  SYSTEM: "SYSTEM";
1613
+ POSITION_NETTED: "POSITION_NETTED";
1461
1614
  }>>;
1462
1615
  fills: z.ZodOptional<z.ZodArray<z.ZodObject<{
1463
1616
  id: z.ZodUUID;
1464
- cloid: z.ZodOptional<z.ZodUUID>;
1617
+ cloid: z.ZodOptional<z.ZodString>;
1618
+ exchangeFillId: z.ZodOptional<z.ZodString>;
1619
+ status: z.ZodEnum<{
1620
+ PROVISIONAL: "PROVISIONAL";
1621
+ CONFIRMED: "CONFIRMED";
1622
+ RECONCILED: "RECONCILED";
1623
+ }>;
1465
1624
  tradeAccountId: z.ZodUUID;
1466
1625
  symbol: z.ZodString;
1467
1626
  positionId: z.ZodUUID;
@@ -1477,16 +1636,23 @@ export declare const Trigger: z.ZodDiscriminatedUnion<[z.ZodDiscriminatedUnion<[
1477
1636
  SELL: "SELL";
1478
1637
  }>;
1479
1638
  reduceOnly: z.ZodBoolean;
1639
+ isExternal: z.ZodBoolean;
1480
1640
  quantity: z.ZodString;
1481
1641
  price: z.ZodString;
1482
1642
  usd: z.ZodString;
1483
- fee: z.ZodOptional<z.ZodString>;
1643
+ tradeFee: z.ZodOptional<z.ZodString>;
1644
+ pearFee: z.ZodOptional<z.ZodString>;
1484
1645
  timestamp: z.ZodString;
1646
+ original: z.ZodOptional<z.ZodObject<{
1647
+ exchangeFillId: z.ZodString;
1648
+ quantity: z.ZodString;
1649
+ }, z.core.$strip>>;
1485
1650
  }, z.core.$strip>>>;
1486
- bracketType: z.ZodOptional<z.ZodEnum<{
1651
+ bracketType: z.ZodEnum<{
1487
1652
  STOP_LOSS: "STOP_LOSS";
1488
1653
  TAKE_PROFIT: "TAKE_PROFIT";
1489
- }>>;
1654
+ NONE: "NONE";
1655
+ }>;
1490
1656
  createdAt: z.ZodString;
1491
1657
  updatedAt: z.ZodString;
1492
1658
  intent: z.ZodLiteral<"CLOSE">;
@@ -1602,9 +1768,13 @@ export declare const Trigger: z.ZodDiscriminatedUnion<[z.ZodDiscriminatedUnion<[
1602
1768
  type: z.ZodLiteral<"MARKET">;
1603
1769
  position: z.ZodObject<{
1604
1770
  id: z.ZodUUID;
1605
- initialExposure: z.ZodRecord<z.ZodString, z.ZodString>;
1771
+ initialExposure: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>>;
1606
1772
  }, z.core.$strip>;
1607
1773
  }, z.core.$strip>;
1774
+ trailing: z.ZodOptional<z.ZodObject<{
1775
+ deltaValue: z.ZodNumber;
1776
+ activationValue: z.ZodNumber;
1777
+ }, z.core.$strip>>;
1608
1778
  }, z.core.$strip>], "intent">], "type">;
1609
1779
  export type BaseTrigger = z.output<typeof BaseTrigger>;
1610
1780
  export type TriggerMarketOpen = z.output<typeof TriggerMarketOpen>;
@@ -1,13 +1,25 @@
1
1
  import { z } from 'zod';
2
+ import { SignedDecimalString } from '../../common/schema';
2
3
  import { TradeLegPostOnly, TradeLeg } from '../../common/trade-legs';
3
4
  import { Connector } from '../../connector';
4
5
  import { Fill } from '../../fill';
6
+ import { InstrumentId } from '../../instrument';
5
7
  import { TriggerConditionOpen, TriggerConditionAdjust, TriggerConditionClose } from './conditions';
6
8
 
7
9
  const TriggerIntent = z.enum(["OPEN", "CLOSE"]);
8
10
  const TriggerStatus = z.enum(["ACTIVE", "TRIGGERED", "CANCELLED"]);
9
- const TriggerCancelledReason = z.enum(["POSITION_CLOSED", "USER", "SYSTEM"]);
10
- const BracketType = z.enum(["STOP_LOSS", "TAKE_PROFIT"]);
11
+ const TriggerCancelledReason = z.enum(["POSITION_CLOSED", "USER", "SYSTEM", "POSITION_NETTED"]);
12
+ const BracketType = z.enum(["STOP_LOSS", "TAKE_PROFIT", "NONE"]);
13
+ const Trailing = z.object({
14
+ /**
15
+ * Delta value in arbitrary units
16
+ */
17
+ deltaValue: z.number(),
18
+ /**
19
+ * Activation value in arbitrary units
20
+ */
21
+ activationValue: z.number()
22
+ });
11
23
  const BaseTrigger = z.object({
12
24
  /**
13
25
  * Trigger UUID
@@ -42,9 +54,9 @@ const BaseTrigger = z.object({
42
54
  */
43
55
  fills: z.array(Fill).optional(),
44
56
  /**
45
- * Optional: bracket type for CLOSE triggers (stop loss / take profit)
57
+ * Bracket type for trigger behavior
46
58
  */
47
- bracketType: BracketType.optional(),
59
+ bracketType: BracketType,
48
60
  /**
49
61
  * Created at timestamp
50
62
  */
@@ -93,9 +105,16 @@ const TriggerMarketAdjust = BaseTrigger.extend({
93
105
  */
94
106
  context: z.object({
95
107
  type: z.literal("MARKET"),
96
- position: z.object({ id: z.uuid(), initialExposure: z.record(z.string(), z.string()) }),
108
+ position: z.object({
109
+ id: z.uuid(),
110
+ initialExposure: z.record(InstrumentId, SignedDecimalString)
111
+ }),
97
112
  legs: z.tuple([TradeLeg]).rest(TradeLeg)
98
- })
113
+ }),
114
+ /**
115
+ * Optional: trailing configuration
116
+ */
117
+ trailing: Trailing.optional()
99
118
  });
100
119
  const TriggerMarketClose = BaseTrigger.extend({
101
120
  /**
@@ -115,8 +134,15 @@ const TriggerMarketClose = BaseTrigger.extend({
115
134
  */
116
135
  context: z.object({
117
136
  type: z.literal("MARKET"),
118
- position: z.object({ id: z.uuid(), initialExposure: z.record(z.string(), z.string()) })
119
- })
137
+ position: z.object({
138
+ id: z.uuid(),
139
+ initialExposure: z.record(InstrumentId, SignedDecimalString)
140
+ })
141
+ }),
142
+ /**
143
+ * Optional: trailing configuration
144
+ */
145
+ trailing: Trailing.optional()
120
146
  });
121
147
  const TriggerMarket = z.discriminatedUnion("intent", [
122
148
  TriggerMarketOpen,
@@ -125,4 +151,4 @@ const TriggerMarket = z.discriminatedUnion("intent", [
125
151
  ]);
126
152
  const Trigger = z.discriminatedUnion("type", [TriggerMarket]);
127
153
 
128
- export { BracketType, Trigger, TriggerCancelledReason, TriggerIntent, TriggerMarket, TriggerMarketAdjust, TriggerMarketClose, TriggerMarketOpen, TriggerStatus };
154
+ export { BracketType, Trailing, Trigger, TriggerCancelledReason, TriggerIntent, TriggerMarket, TriggerMarketAdjust, TriggerMarketClose, TriggerMarketOpen, TriggerStatus };