@polyester/sdk 0.9.0 → 0.9.1
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.
- package/CHANGELOG.md +14 -0
- package/dist/catalogs/decimal.js +6 -4
- package/dist/catalogs/decimal.js.map +1 -1
- package/dist/services/orders/orders-batch.schemas.d.ts +187 -13
- package/dist/services/orders/orders-batch.schemas.d.ts.map +1 -1
- package/dist/services/orders/orders-batch.schemas.js +4 -1
- package/dist/services/orders/orders-batch.schemas.js.map +1 -1
- package/dist/services/orders/orders-input.schemas.d.ts +25 -25
- package/dist/services/orders/orders-input.schemas.d.ts.map +1 -1
- package/dist/services/orders/orders-input.schemas.js +2 -2
- package/dist/services/orders/orders-input.schemas.js.map +1 -1
- package/dist/services/orders/orders-modify.schemas.d.ts +18 -18
- package/dist/services/orders/orders-risk.schemas.d.ts +12 -12
- package/dist/services/orders/orders-risk.schemas.d.ts.map +1 -1
- package/dist/services/orders/orders-risk.schemas.js +7 -6
- package/dist/services/orders/orders-risk.schemas.js.map +1 -1
- package/dist/services/subaccounts/subaccounts.schemas.d.ts +5 -5
- package/dist/services/triggers/trigger-input.schemas.d.ts +2 -2
- package/dist/services/triggers/triggers-output.schemas.d.ts +14 -14
- package/dist/shared/decimal-surface.d.ts.map +1 -1
- package/dist/shared/decimal-surface.js +1 -1
- package/dist/shared/decimal-surface.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @polyester/sdk
|
|
2
2
|
|
|
3
|
+
## 0.9.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Reject trailing-stop maximum slippage above 10,000 basis points. ([#79](https://github.com/Fabric-Labs/polyester-sdk-typescript/pull/79))
|
|
8
|
+
|
|
9
|
+
- Accept exact decimal inputs with zero padding beyond the configured wire scale. ([#79](https://github.com/Fabric-Labs/polyester-sdk-typescript/pull/79))
|
|
10
|
+
|
|
11
|
+
- Reject OCO risk policies that do not include both take-profit and a stop leg. ([#79](https://github.com/Fabric-Labs/polyester-sdk-typescript/pull/79))
|
|
12
|
+
|
|
13
|
+
- Reject duplicate non-empty client order IDs in one batch create request. ([#79](https://github.com/Fabric-Labs/polyester-sdk-typescript/pull/79))
|
|
14
|
+
|
|
15
|
+
- Reject unsupported characters in cancel-all request IDs, matching other order mutations. ([#79](https://github.com/Fabric-Labs/polyester-sdk-typescript/pull/79))
|
|
16
|
+
|
|
3
17
|
## 0.9.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
package/dist/catalogs/decimal.js
CHANGED
|
@@ -4,8 +4,9 @@ const INPUT_DECIMAL_PATTERN = /^(?:\d+(?:\.\d*)?|\.\d+)$/;
|
|
|
4
4
|
const SCALED_INTEGER_PATTERN = /^-?\d+$/;
|
|
5
5
|
/**
|
|
6
6
|
* Strictly converts a non-negative decimal string into a scaled bigint.
|
|
7
|
-
* Fails on anything that is not a plain decimal number or
|
|
8
|
-
*
|
|
7
|
+
* Fails on anything that is not a plain decimal number or whose fractional
|
|
8
|
+
* component still exceeds the scale after trailing zero padding is removed.
|
|
9
|
+
* Zero padding beyond the scale remains exact and is accepted. Never rounds.
|
|
9
10
|
*/
|
|
10
11
|
function tryDecimalToScaled(decimal, scale) {
|
|
11
12
|
const raw = decimal.trim();
|
|
@@ -14,7 +15,8 @@ function tryDecimalToScaled(decimal, scale) {
|
|
|
14
15
|
failure: { reason: "invalid" }
|
|
15
16
|
};
|
|
16
17
|
const [intPart = "0", fracPart = ""] = raw.split(".");
|
|
17
|
-
|
|
18
|
+
const exactFraction = fracPart.replace(/0+$/, "");
|
|
19
|
+
if (exactFraction.length > scale) return {
|
|
18
20
|
ok: false,
|
|
19
21
|
failure: {
|
|
20
22
|
reason: "precision",
|
|
@@ -23,7 +25,7 @@ function tryDecimalToScaled(decimal, scale) {
|
|
|
23
25
|
};
|
|
24
26
|
return {
|
|
25
27
|
ok: true,
|
|
26
|
-
scaled: BigInt(intPart +
|
|
28
|
+
scaled: BigInt(intPart + exactFraction.padEnd(scale, "0"))
|
|
27
29
|
};
|
|
28
30
|
}
|
|
29
31
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decimal.js","names":[],"sources":["../../src/catalogs/decimal.ts"],"sourcesContent":["/**\n * Internal decimal-string math backing catalog conversions.\n *\n * Catalog conversions operate on JSON-safe strings only: human decimal strings\n * on one side and scaled integer strings on the SDK/API side. BigInt is an\n * implementation detail of this module and never crosses the public surface.\n */\n\n/** Raw scaled integer accepted on the SDK side of a conversion. */\nexport type ScaledIntegerLike = bigint | number | string;\n\nconst STRICT_DECIMAL_PATTERN = /^\\d+(?:\\.\\d+)?$/;\nconst INPUT_DECIMAL_PATTERN = /^(?:\\d+(?:\\.\\d*)?|\\.\\d+)$/;\nconst SCALED_INTEGER_PATTERN = /^-?\\d+$/;\n\nexport type DecimalToScaledFailure =\n | { reason: \"invalid\" }\n | { reason: \"precision\"; maxDecimals: number };\n\nexport type DecimalToScaledResult =\n | { ok: true; scaled: bigint }\n | { ok: false; failure: DecimalToScaledFailure };\n\n/**\n * Strictly converts a non-negative decimal string into a scaled bigint.\n * Fails on anything that is not a plain decimal number or
|
|
1
|
+
{"version":3,"file":"decimal.js","names":[],"sources":["../../src/catalogs/decimal.ts"],"sourcesContent":["/**\n * Internal decimal-string math backing catalog conversions.\n *\n * Catalog conversions operate on JSON-safe strings only: human decimal strings\n * on one side and scaled integer strings on the SDK/API side. BigInt is an\n * implementation detail of this module and never crosses the public surface.\n */\n\n/** Raw scaled integer accepted on the SDK side of a conversion. */\nexport type ScaledIntegerLike = bigint | number | string;\n\nconst STRICT_DECIMAL_PATTERN = /^\\d+(?:\\.\\d+)?$/;\nconst INPUT_DECIMAL_PATTERN = /^(?:\\d+(?:\\.\\d*)?|\\.\\d+)$/;\nconst SCALED_INTEGER_PATTERN = /^-?\\d+$/;\n\nexport type DecimalToScaledFailure =\n | { reason: \"invalid\" }\n | { reason: \"precision\"; maxDecimals: number };\n\nexport type DecimalToScaledResult =\n | { ok: true; scaled: bigint }\n | { ok: false; failure: DecimalToScaledFailure };\n\n/**\n * Strictly converts a non-negative decimal string into a scaled bigint.\n * Fails on anything that is not a plain decimal number or whose fractional\n * component still exceeds the scale after trailing zero padding is removed.\n * Zero padding beyond the scale remains exact and is accepted. Never rounds.\n */\nexport function tryDecimalToScaled(decimal: string, scale: number): DecimalToScaledResult {\n const raw = decimal.trim();\n if (!STRICT_DECIMAL_PATTERN.test(raw)) return { ok: false, failure: { reason: \"invalid\" } };\n const [intPart = \"0\", fracPart = \"\"] = raw.split(\".\");\n const exactFraction = fracPart.replace(/0+$/, \"\");\n if (exactFraction.length > scale) {\n return { ok: false, failure: { reason: \"precision\", maxDecimals: scale } };\n }\n return { ok: true, scaled: BigInt(intPart + exactFraction.padEnd(scale, \"0\")) };\n}\n\n/**\n * Coerces a raw scaled integer (bigint, safe integer number, or base-10\n * integer string) into a bigint. Returns null for anything else — including\n * decimal strings, which indicate the caller is holding an unscaled value.\n */\nexport function tryToScaledBigInt(value: ScaledIntegerLike): bigint | null {\n if (typeof value === \"bigint\") return value;\n if (typeof value === \"number\") {\n return Number.isSafeInteger(value) ? BigInt(value) : null;\n }\n const raw = value.trim();\n return SCALED_INTEGER_PATTERN.test(raw) ? BigInt(raw) : null;\n}\n\n/**\n * Renders a scaled bigint as an exact decimal string with trailing zeros\n * trimmed (`1500000n` at scale 6 → `\"1.5\"`).\n */\nexport function scaledToDecimal(scaled: bigint, scale: number): string {\n const negative = scaled < 0n;\n const digits = (negative ? -scaled : scaled).toString();\n if (scale <= 0) return negative && digits !== \"0\" ? `-${digits}` : digits;\n const padded = digits.padStart(scale + 1, \"0\");\n const intPart = padded.slice(0, -scale);\n const fracPart = padded.slice(-scale).replace(/0+$/, \"\");\n const body = fracPart ? `${intPart}.${fracPart}` : intPart;\n return negative && body !== \"0\" ? `-${body}` : body;\n}\n\n/**\n * Renders a scaled bigint as a display-normalized decimal string: rounded\n * half-up (away from zero) to `displayDecimals` and trailing zeros trimmed.\n * Not locale-aware — display strings stay plain decimal strings.\n */\nexport function scaledToDisplay(scaled: bigint, scale: number, displayDecimals: number): string {\n const decimals = Math.max(0, Math.trunc(displayDecimals));\n if (decimals >= scale) return scaledToDecimal(scaled, scale);\n const negative = scaled < 0n;\n const abs = negative ? -scaled : scaled;\n const divisor = 10n ** BigInt(scale - decimals);\n const rounded = (abs + divisor / 2n) / divisor;\n const body = scaledToDecimal(rounded, decimals);\n return negative && body !== \"0\" ? `-${body}` : body;\n}\n\n/**\n * Normalizes raw user input into a canonical decimal string, truncating (not\n * rounding) fractional digits beyond `maxDecimals`. Tolerates partial input\n * forms like `\".5\"` and `\"5.\"`. Returns null when the input is not a decimal.\n */\nexport function tryNormalizeDecimalInput(raw: string, maxDecimals: number): string | null {\n const trimmed = raw.trim();\n if (!INPUT_DECIMAL_PATTERN.test(trimmed)) return null;\n const [intRaw = \"\", fracRaw = \"\"] = trimmed.split(\".\");\n const intPart = intRaw.replace(/^0+(?=\\d)/, \"\") || \"0\";\n const fracPart = fracRaw.slice(0, Math.max(0, maxDecimals)).replace(/0+$/, \"\");\n return fracPart ? `${intPart}.${fracPart}` : intPart;\n}\n\n/**\n * Counts the significant fractional digits of a decimal string\n * (`\"0.010\"` → 2). Used to derive display precision from tick sizes.\n */\nexport function significantDecimalPlaces(decimal: string): number {\n const fracPart = decimal.split(\".\")[1];\n return fracPart ? fracPart.replace(/0+$/, \"\").length : 0;\n}\n"],"mappings":";AAWA,MAAM,yBAAyB;AAC/B,MAAM,wBAAwB;AAC9B,MAAM,yBAAyB;;;;;;;AAgB/B,SAAgB,mBAAmB,SAAiB,OAAsC;CACtF,MAAM,MAAM,QAAQ,KAAK;CACzB,IAAI,CAAC,uBAAuB,KAAK,GAAG,GAAG,OAAO;EAAE,IAAI;EAAO,SAAS,EAAE,QAAQ,UAAU;CAAE;CAC1F,MAAM,CAAC,UAAU,KAAK,WAAW,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MAAM,OAAO,iBADI,MAAM,UAAU,MAAM,SACD,QAAQ;CAC9C,OAAO,YAAY,SAAS,MAAM,IAAI,SAAS;AACnD;;;;;;AAOA,SAAgB,yBAAyB,KAAa,aAAoC;CACtF,MAAM,UAAU,IAAI,KAAK;CACzB,IAAI,CAAC,sBAAsB,KAAK,OAAO,GAAG,OAAO;CACjD,MAAM,CAAC,SAAS,IAAI,UAAU,MAAM,QAAQ,MAAM,GAAG;CACrD,MAAM,UAAU,OAAO,QAAQ,aAAa,EAAE,KAAK;CACnD,MAAM,WAAW,QAAQ,MAAM,GAAG,KAAK,IAAI,GAAG,WAAW,CAAC,CAAC,CAAC,QAAQ,OAAO,EAAE;CAC7E,OAAO,WAAW,GAAG,QAAQ,GAAG,aAAa;AACjD;;;;;AAMA,SAAgB,yBAAyB,SAAyB;CAC9D,MAAM,WAAW,QAAQ,MAAM,GAAG,CAAC,CAAC;CACpC,OAAO,WAAW,SAAS,QAAQ,OAAO,EAAE,CAAC,CAAC,SAAS;AAC3D"}
|
|
@@ -300,7 +300,7 @@ declare function createBatchCreateOrdersInputSchema(scales: SdkScales): v.Schema
|
|
|
300
300
|
}>]>;
|
|
301
301
|
readonly stopLoss: v.OptionalSchema<v.NeverSchema<undefined>, undefined>;
|
|
302
302
|
readonly trailingStop: v.OptionalSchema<v.NeverSchema<undefined>, undefined>;
|
|
303
|
-
readonly oco: v.OptionalSchema<v.
|
|
303
|
+
readonly oco: v.OptionalSchema<v.LiteralSchema<false, "oco requires takeProfit and exactly one stop leg">, undefined>;
|
|
304
304
|
}, undefined>, v.StrictObjectSchema<{
|
|
305
305
|
readonly takeProfit: v.OptionalSchema<v.NeverSchema<undefined>, undefined>;
|
|
306
306
|
readonly stopLoss: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
@@ -332,7 +332,7 @@ declare function createBatchCreateOrdersInputSchema(scales: SdkScales): v.Schema
|
|
|
332
332
|
};
|
|
333
333
|
}>]>;
|
|
334
334
|
readonly trailingStop: v.OptionalSchema<v.NeverSchema<undefined>, undefined>;
|
|
335
|
-
readonly oco: v.OptionalSchema<v.
|
|
335
|
+
readonly oco: v.OptionalSchema<v.LiteralSchema<false, "oco requires takeProfit and exactly one stop leg">, undefined>;
|
|
336
336
|
}, undefined>, v.StrictObjectSchema<{
|
|
337
337
|
readonly takeProfit: v.OptionalSchema<v.NeverSchema<undefined>, undefined>;
|
|
338
338
|
readonly stopLoss: v.OptionalSchema<v.NeverSchema<undefined>, undefined>;
|
|
@@ -399,7 +399,7 @@ declare function createBatchCreateOrdersInputSchema(scales: SdkScales): v.Schema
|
|
|
399
399
|
};
|
|
400
400
|
activationPriceTicks: bigint;
|
|
401
401
|
}>]>;
|
|
402
|
-
readonly oco: v.OptionalSchema<v.
|
|
402
|
+
readonly oco: v.OptionalSchema<v.LiteralSchema<false, "oco requires takeProfit and exactly one stop leg">, undefined>;
|
|
403
403
|
}, undefined>], undefined>, undefined>, v.TransformAction<{
|
|
404
404
|
takeProfit: {
|
|
405
405
|
triggerPriceTicks: bigint;
|
|
@@ -480,7 +480,7 @@ declare function createBatchCreateOrdersInputSchema(scales: SdkScales): v.Schema
|
|
|
480
480
|
};
|
|
481
481
|
stopLoss?: undefined;
|
|
482
482
|
trailingStop?: undefined;
|
|
483
|
-
oco?:
|
|
483
|
+
oco?: false | undefined;
|
|
484
484
|
} | {
|
|
485
485
|
takeProfit?: undefined;
|
|
486
486
|
stopLoss: {
|
|
@@ -496,7 +496,7 @@ declare function createBatchCreateOrdersInputSchema(scales: SdkScales): v.Schema
|
|
|
496
496
|
};
|
|
497
497
|
};
|
|
498
498
|
trailingStop?: undefined;
|
|
499
|
-
oco?:
|
|
499
|
+
oco?: false | undefined;
|
|
500
500
|
} | {
|
|
501
501
|
takeProfit?: undefined;
|
|
502
502
|
stopLoss?: undefined;
|
|
@@ -523,7 +523,7 @@ declare function createBatchCreateOrdersInputSchema(scales: SdkScales): v.Schema
|
|
|
523
523
|
};
|
|
524
524
|
activationPriceTicks: bigint;
|
|
525
525
|
};
|
|
526
|
-
oco?:
|
|
526
|
+
oco?: false | undefined;
|
|
527
527
|
} | undefined, {
|
|
528
528
|
takeProfit: {
|
|
529
529
|
triggerPriceTicks: bigint;
|
|
@@ -831,7 +831,7 @@ declare function createBatchCreateOrdersInputSchema(scales: SdkScales): v.Schema
|
|
|
831
831
|
}>]>;
|
|
832
832
|
readonly stopLoss: v.OptionalSchema<v.NeverSchema<undefined>, undefined>;
|
|
833
833
|
readonly trailingStop: v.OptionalSchema<v.NeverSchema<undefined>, undefined>;
|
|
834
|
-
readonly oco: v.OptionalSchema<v.
|
|
834
|
+
readonly oco: v.OptionalSchema<v.LiteralSchema<false, "oco requires takeProfit and exactly one stop leg">, undefined>;
|
|
835
835
|
}, undefined>, v.StrictObjectSchema<{
|
|
836
836
|
readonly takeProfit: v.OptionalSchema<v.NeverSchema<undefined>, undefined>;
|
|
837
837
|
readonly stopLoss: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
@@ -863,7 +863,7 @@ declare function createBatchCreateOrdersInputSchema(scales: SdkScales): v.Schema
|
|
|
863
863
|
};
|
|
864
864
|
}>]>;
|
|
865
865
|
readonly trailingStop: v.OptionalSchema<v.NeverSchema<undefined>, undefined>;
|
|
866
|
-
readonly oco: v.OptionalSchema<v.
|
|
866
|
+
readonly oco: v.OptionalSchema<v.LiteralSchema<false, "oco requires takeProfit and exactly one stop leg">, undefined>;
|
|
867
867
|
}, undefined>, v.StrictObjectSchema<{
|
|
868
868
|
readonly takeProfit: v.OptionalSchema<v.NeverSchema<undefined>, undefined>;
|
|
869
869
|
readonly stopLoss: v.OptionalSchema<v.NeverSchema<undefined>, undefined>;
|
|
@@ -930,7 +930,7 @@ declare function createBatchCreateOrdersInputSchema(scales: SdkScales): v.Schema
|
|
|
930
930
|
};
|
|
931
931
|
activationPriceTicks: bigint;
|
|
932
932
|
}>]>;
|
|
933
|
-
readonly oco: v.OptionalSchema<v.
|
|
933
|
+
readonly oco: v.OptionalSchema<v.LiteralSchema<false, "oco requires takeProfit and exactly one stop leg">, undefined>;
|
|
934
934
|
}, undefined>], undefined>, undefined>, v.TransformAction<{
|
|
935
935
|
takeProfit: {
|
|
936
936
|
triggerPriceTicks: bigint;
|
|
@@ -1011,7 +1011,7 @@ declare function createBatchCreateOrdersInputSchema(scales: SdkScales): v.Schema
|
|
|
1011
1011
|
};
|
|
1012
1012
|
stopLoss?: undefined;
|
|
1013
1013
|
trailingStop?: undefined;
|
|
1014
|
-
oco?:
|
|
1014
|
+
oco?: false | undefined;
|
|
1015
1015
|
} | {
|
|
1016
1016
|
takeProfit?: undefined;
|
|
1017
1017
|
stopLoss: {
|
|
@@ -1027,7 +1027,7 @@ declare function createBatchCreateOrdersInputSchema(scales: SdkScales): v.Schema
|
|
|
1027
1027
|
};
|
|
1028
1028
|
};
|
|
1029
1029
|
trailingStop?: undefined;
|
|
1030
|
-
oco?:
|
|
1030
|
+
oco?: false | undefined;
|
|
1031
1031
|
} | {
|
|
1032
1032
|
takeProfit?: undefined;
|
|
1033
1033
|
stopLoss?: undefined;
|
|
@@ -1054,7 +1054,7 @@ declare function createBatchCreateOrdersInputSchema(scales: SdkScales): v.Schema
|
|
|
1054
1054
|
};
|
|
1055
1055
|
activationPriceTicks: bigint;
|
|
1056
1056
|
};
|
|
1057
|
-
oco?:
|
|
1057
|
+
oco?: false | undefined;
|
|
1058
1058
|
} | undefined, {
|
|
1059
1059
|
takeProfit: {
|
|
1060
1060
|
triggerPriceTicks: bigint;
|
|
@@ -2095,7 +2095,181 @@ declare function createBatchCreateOrdersInputSchema(scales: SdkScales): v.Schema
|
|
|
2095
2095
|
readonly account: v.OptionalSchema<v.UnionSchema<[v.PicklistSchema<["active", "main"], undefined>, v.StrictObjectSchema<{
|
|
2096
2096
|
readonly subaccountId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
|
|
2097
2097
|
}, undefined>], undefined>, undefined>;
|
|
2098
|
-
}, undefined>, v.
|
|
2098
|
+
}, undefined>, v.CheckAction<{
|
|
2099
|
+
requestId?: string | undefined;
|
|
2100
|
+
items: ({
|
|
2101
|
+
sizing: {
|
|
2102
|
+
readonly case: "baseQtyScaled";
|
|
2103
|
+
readonly value: bigint;
|
|
2104
|
+
} | {
|
|
2105
|
+
readonly case: "maxQuoteDebitScaled";
|
|
2106
|
+
readonly value: bigint;
|
|
2107
|
+
};
|
|
2108
|
+
feeAsset: FeeAsset.QUOTE | FeeAsset.BASE;
|
|
2109
|
+
attachedRisk: {
|
|
2110
|
+
takeProfit: {
|
|
2111
|
+
triggerPriceTicks: bigint;
|
|
2112
|
+
child: {
|
|
2113
|
+
execution: {
|
|
2114
|
+
value: RiskMarketIoc;
|
|
2115
|
+
case: "marketIoc";
|
|
2116
|
+
} | {
|
|
2117
|
+
value: RiskLimitGtc;
|
|
2118
|
+
case: "limitGtc";
|
|
2119
|
+
};
|
|
2120
|
+
};
|
|
2121
|
+
} | undefined;
|
|
2122
|
+
stopLeg: {
|
|
2123
|
+
readonly case: "stopLoss";
|
|
2124
|
+
readonly value: {
|
|
2125
|
+
triggerPriceTicks: bigint;
|
|
2126
|
+
child: {
|
|
2127
|
+
execution: {
|
|
2128
|
+
value: RiskMarketIoc;
|
|
2129
|
+
case: "marketIoc";
|
|
2130
|
+
} | {
|
|
2131
|
+
value: RiskLimitGtc;
|
|
2132
|
+
case: "limitGtc";
|
|
2133
|
+
};
|
|
2134
|
+
};
|
|
2135
|
+
};
|
|
2136
|
+
} | {
|
|
2137
|
+
readonly case: "trailingStop";
|
|
2138
|
+
readonly value: {
|
|
2139
|
+
trailingDistance: {
|
|
2140
|
+
value: bigint;
|
|
2141
|
+
case: "trailingDistanceTicks";
|
|
2142
|
+
} | {
|
|
2143
|
+
value: number;
|
|
2144
|
+
case: "trailingDistanceBps";
|
|
2145
|
+
} | {
|
|
2146
|
+
case: undefined;
|
|
2147
|
+
value?: undefined;
|
|
2148
|
+
};
|
|
2149
|
+
maxSlippage: {
|
|
2150
|
+
value: number;
|
|
2151
|
+
case: "maxSlippageTicks";
|
|
2152
|
+
} | {
|
|
2153
|
+
value: number;
|
|
2154
|
+
case: "maxSlippageBps";
|
|
2155
|
+
} | {
|
|
2156
|
+
case: undefined;
|
|
2157
|
+
value?: undefined;
|
|
2158
|
+
};
|
|
2159
|
+
activationPriceTicks: bigint;
|
|
2160
|
+
};
|
|
2161
|
+
} | {
|
|
2162
|
+
readonly case: undefined;
|
|
2163
|
+
readonly value: undefined;
|
|
2164
|
+
};
|
|
2165
|
+
oco: boolean;
|
|
2166
|
+
} | undefined;
|
|
2167
|
+
symbolId: number;
|
|
2168
|
+
side: Side.BUY | Side.SELL;
|
|
2169
|
+
execution: {
|
|
2170
|
+
case: "marketIoc";
|
|
2171
|
+
value: MarketIoc;
|
|
2172
|
+
} | {
|
|
2173
|
+
case: "limitGtc";
|
|
2174
|
+
value: LimitGtc;
|
|
2175
|
+
} | {
|
|
2176
|
+
case: "limitIoc";
|
|
2177
|
+
value: LimitIoc;
|
|
2178
|
+
} | {
|
|
2179
|
+
case: "limitFok";
|
|
2180
|
+
value: LimitFok;
|
|
2181
|
+
};
|
|
2182
|
+
clientOrderId?: string | undefined;
|
|
2183
|
+
selfTradePreventionMode?: SelfTradePreventionMode.EXPIRE_MAKER | SelfTradePreventionMode.EXPIRE_TAKER | SelfTradePreventionMode.EXPIRE_BOTH | undefined;
|
|
2184
|
+
} | {
|
|
2185
|
+
sizing: {
|
|
2186
|
+
readonly case: "baseQtyScaled";
|
|
2187
|
+
readonly value: bigint;
|
|
2188
|
+
} | {
|
|
2189
|
+
readonly case: "maxQuoteDebitScaled";
|
|
2190
|
+
readonly value: bigint;
|
|
2191
|
+
};
|
|
2192
|
+
feeAsset: FeeAsset.QUOTE | FeeAsset.BASE;
|
|
2193
|
+
attachedRisk: {
|
|
2194
|
+
takeProfit: {
|
|
2195
|
+
triggerPriceTicks: bigint;
|
|
2196
|
+
child: {
|
|
2197
|
+
execution: {
|
|
2198
|
+
value: RiskMarketIoc;
|
|
2199
|
+
case: "marketIoc";
|
|
2200
|
+
} | {
|
|
2201
|
+
value: RiskLimitGtc;
|
|
2202
|
+
case: "limitGtc";
|
|
2203
|
+
};
|
|
2204
|
+
};
|
|
2205
|
+
} | undefined;
|
|
2206
|
+
stopLeg: {
|
|
2207
|
+
readonly case: "stopLoss";
|
|
2208
|
+
readonly value: {
|
|
2209
|
+
triggerPriceTicks: bigint;
|
|
2210
|
+
child: {
|
|
2211
|
+
execution: {
|
|
2212
|
+
value: RiskMarketIoc;
|
|
2213
|
+
case: "marketIoc";
|
|
2214
|
+
} | {
|
|
2215
|
+
value: RiskLimitGtc;
|
|
2216
|
+
case: "limitGtc";
|
|
2217
|
+
};
|
|
2218
|
+
};
|
|
2219
|
+
};
|
|
2220
|
+
} | {
|
|
2221
|
+
readonly case: "trailingStop";
|
|
2222
|
+
readonly value: {
|
|
2223
|
+
trailingDistance: {
|
|
2224
|
+
value: bigint;
|
|
2225
|
+
case: "trailingDistanceTicks";
|
|
2226
|
+
} | {
|
|
2227
|
+
value: number;
|
|
2228
|
+
case: "trailingDistanceBps";
|
|
2229
|
+
} | {
|
|
2230
|
+
case: undefined;
|
|
2231
|
+
value?: undefined;
|
|
2232
|
+
};
|
|
2233
|
+
maxSlippage: {
|
|
2234
|
+
value: number;
|
|
2235
|
+
case: "maxSlippageTicks";
|
|
2236
|
+
} | {
|
|
2237
|
+
value: number;
|
|
2238
|
+
case: "maxSlippageBps";
|
|
2239
|
+
} | {
|
|
2240
|
+
case: undefined;
|
|
2241
|
+
value?: undefined;
|
|
2242
|
+
};
|
|
2243
|
+
activationPriceTicks: bigint;
|
|
2244
|
+
};
|
|
2245
|
+
} | {
|
|
2246
|
+
readonly case: undefined;
|
|
2247
|
+
readonly value: undefined;
|
|
2248
|
+
};
|
|
2249
|
+
oco: boolean;
|
|
2250
|
+
} | undefined;
|
|
2251
|
+
symbolId: number;
|
|
2252
|
+
side: Side.BUY | Side.SELL;
|
|
2253
|
+
execution: {
|
|
2254
|
+
case: "marketIoc";
|
|
2255
|
+
value: MarketIoc;
|
|
2256
|
+
} | {
|
|
2257
|
+
case: "limitGtc";
|
|
2258
|
+
value: LimitGtc;
|
|
2259
|
+
} | {
|
|
2260
|
+
case: "limitIoc";
|
|
2261
|
+
value: LimitIoc;
|
|
2262
|
+
} | {
|
|
2263
|
+
case: "limitFok";
|
|
2264
|
+
value: LimitFok;
|
|
2265
|
+
};
|
|
2266
|
+
clientOrderId?: string | undefined;
|
|
2267
|
+
selfTradePreventionMode?: SelfTradePreventionMode.EXPIRE_MAKER | SelfTradePreventionMode.EXPIRE_TAKER | SelfTradePreventionMode.EXPIRE_BOTH | undefined;
|
|
2268
|
+
})[];
|
|
2269
|
+
account?: "active" | "main" | {
|
|
2270
|
+
subaccountId: string;
|
|
2271
|
+
} | undefined;
|
|
2272
|
+
}, "Each non-empty batch create clientOrderId must be unique.">, v.TransformAction<{
|
|
2099
2273
|
requestId?: string | undefined;
|
|
2100
2274
|
items: ({
|
|
2101
2275
|
sizing: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orders-batch.schemas.d.ts","names":[],"sources":["../../../src/services/orders/orders-batch.schemas.ts"],"mappings":";;;;;;;;cAsDa,2BAAyB,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;KAc1B,sBAAsB,EAAE,kBAAkB;cAEzC,4BAA0B,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;KAgB3B,uBAAuB,EAAE,mBAAmB;iBAExC,mCAAmC,QAAQ,YAAS,EAAA,yBAAA,EAAA
|
|
1
|
+
{"version":3,"file":"orders-batch.schemas.d.ts","names":[],"sources":["../../../src/services/orders/orders-batch.schemas.ts"],"mappings":";;;;;;;;cAsDa,2BAAyB,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;KAc1B,sBAAsB,EAAE,kBAAkB;cAEzC,4BAA0B,EAAA,yBAAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAkB9B,0BAA0B,EAAE,mBAAmB"}
|
|
@@ -48,7 +48,10 @@ function createBatchCreateOrdersInputSchema(scales) {
|
|
|
48
48
|
...AccountScopeInputEntries,
|
|
49
49
|
requestId: v.optional(OrderRequestIdInputSchema),
|
|
50
50
|
items: v.pipe(v.array(createOrderIntentInputSchema(scales)), v.minLength(1, "At least one order is required."), v.maxLength(20, "Batch create accepts at most 20 orders."))
|
|
51
|
-
}), v.
|
|
51
|
+
}), v.check((input) => {
|
|
52
|
+
const clientOrderIds = input.items.map((item) => item.clientOrderId).filter((clientOrderId) => clientOrderId !== void 0 && clientOrderId !== "");
|
|
53
|
+
return new Set(clientOrderIds).size === clientOrderIds.length;
|
|
54
|
+
}, "Each non-empty batch create clientOrderId must be unique."), v.transform(({ account, ...input }) => ({
|
|
52
55
|
...input,
|
|
53
56
|
subaccountId: accountScopeToSubaccountId(account)
|
|
54
57
|
})));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orders-batch.schemas.js","names":["ProtoWrite.RiskPolicySchema","ProtoWrite.BatchReplaceItemAdmissionStatus","ProtoWrite.BatchReplaceAdmissionStatus","ProtoRead.BatchReplacePhase","ProtoRead.OrderStatus"],"sources":["../../../src/services/orders/orders-batch.schemas.ts"],"sourcesContent":["import * as ProtoWrite from \"../../gen/orders/v1/orders_pb.js\";\nimport * as ProtoRead from \"../../gen/orders/v1/orders_read_pb.js\";\nimport { create } from \"@bufbuild/protobuf\";\nimport * as v from \"valibot\";\nimport {\n AccountScopeInputEntries,\n accountScopeToSubaccountId,\n} from \"../../shared/account-scope.js\";\nimport { OptionalPublicIdSchema, PublicIdSchema, idInputSchema } from \"../../shared/schemas.js\";\nimport { requiredEnumLabel } from \"../../shared/proto-enum-codec.js\";\nimport { tsNsToMs } from \"../../utils/time.js\";\nimport { formatId } from \"../../utils/base58-id.js\";\nimport { SideSchema, SymbolIdInputSchema } from \"../shared.js\";\nimport {\n positiveDecimalInputToScaled,\n scaledToDecimalOutput,\n type SdkScales,\n} from \"../../shared/decimal-surface.js\";\nimport {\n BatchReplaceAdmissionStatusCodec,\n BatchReplaceItemAdmissionStatusCodec,\n BatchReplacePhaseCodec,\n OrderStatusCodec,\n OrderSideCodec,\n} from \"./orders.codecs.js\";\nimport { createOrderIntentInputSchema } from \"./orders-input.schemas.js\";\nimport { createRequiredRiskPolicyInputSchema } from \"./orders-risk.schemas.js\";\nimport {\n ClientOrderIdInputSchema,\n OrderRequestIdInputSchema,\n} from \"./orders-identifiers.schemas.js\";\nimport { OrderErrorDetailSchema } from \"./order-errors.schemas.js\";\n\nconst BatchCountSchema = v.pipe(v.number(), v.integer(), v.minValue(0));\nconst BatchItemIndexSchema = v.pipe(v.number(), v.integer(), v.minValue(0));\nconst PositivePublicIdSchema = v.pipe(\n v.bigint(),\n v.gtValue(0n),\n v.transform((value) => formatId(value)),\n);\nconst OptionalSideInputSchema = v.pipe(\n v.optional(SideSchema),\n v.transform((side) => (side ? OrderSideCodec.inputToProto[side] : undefined)),\n);\n\nconst CancelAllAfterTimeoutInputSchema = v.pipe(\n v.number(),\n v.integer(),\n v.check(\n (timeoutSec) => timeoutSec === 0 || (timeoutSec >= 10 && timeoutSec <= 120),\n \"timeoutSec must be 0 to disable or between 10 and 120 seconds to arm\",\n ),\n);\n\nexport const CancelAllAfterInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n timeoutSec: CancelAllAfterTimeoutInputSchema,\n symbolId: v.optional(SymbolIdInputSchema),\n side: OptionalSideInputSchema,\n requestId: v.optional(OrderRequestIdInputSchema),\n }),\n v.transform(({ account, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\nexport type CancelAllAfterInput = v.InferInput<typeof CancelAllAfterInputSchema>;\n\nexport const CancelAllAfterResultSchema = v.pipe(\n v.object({\n status: v.picklist([\"armed\", \"disabled\"]),\n effectiveTimeoutSec: v.pipe(v.number(), v.integer(), v.minValue(0)),\n expiresAtTsNs: v.bigint(),\n tsNs: v.bigint(),\n }),\n v.transform(({ expiresAtTsNs, tsNs, ...result }) => ({\n ...result,\n expiresAt: tsNsToMs(expiresAtTsNs),\n expiresAtNs: expiresAtTsNs.toString(),\n ts: tsNsToMs(tsNs),\n tsNs: tsNs.toString(),\n })),\n);\n\nexport type CancelAllAfterResult = v.InferOutput<typeof CancelAllAfterResultSchema>;\n\nexport function createBatchCreateOrdersInputSchema(scales: SdkScales) {\n return v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n requestId: v.optional(OrderRequestIdInputSchema),\n items: v.pipe(\n v.array(createOrderIntentInputSchema(scales)),\n v.minLength(1, \"At least one order is required.\"),\n v.maxLength(20, \"Batch create accepts at most 20 orders.\"),\n ),\n }),\n v.transform(({ account, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n })),\n );\n}\n\nexport type BatchCreateOrdersInput = v.InferInput<\n ReturnType<typeof createBatchCreateOrdersInputSchema>\n>;\n\nconst BatchCreateOrderResultRawSchema = v.object({\n clientOrderId: v.string(),\n outcome: v.variant(\"case\", [\n v.object({\n case: v.literal(\"accepted\"),\n value: v.object({\n orderId: PublicIdSchema,\n takeProfitTriggerId: OptionalPublicIdSchema,\n stopLossTriggerId: OptionalPublicIdSchema,\n trailingStopTriggerId: OptionalPublicIdSchema,\n resolvedBaseQtyScaled: v.bigint(),\n submittedMaxQuoteDebitScaled: v.optional(v.bigint()),\n }),\n }),\n v.object({\n case: v.literal(\"rejected\"),\n value: v.object({\n // The server may reject without a structured detail (e.g. capacity\n // limits); surface the rejection instead of failing the parse.\n error: v.optional(OrderErrorDetailSchema),\n }),\n }),\n ]),\n});\n\nexport function createBatchCreateOrdersResultSchema(scales: SdkScales, symbolIds: number[]) {\n return v.pipe(\n v.object({\n results: v.array(BatchCreateOrderResultRawSchema),\n acceptedCount: BatchCountSchema,\n rejectedCount: BatchCountSchema,\n tsNs: v.bigint(),\n }),\n v.check(\n (response) =>\n response.acceptedCount + response.rejectedCount === response.results.length,\n \"Batch create result counts do not match the returned results.\",\n ),\n v.check(\n (response) => response.results.length === symbolIds.length,\n \"Batch create result count does not match the submitted item count.\",\n ),\n v.transform(({ tsNs, ...response }) => ({\n ...response,\n results: response.results.map(({ clientOrderId, outcome }, index) => {\n if (outcome.case === \"rejected\") {\n return {\n status: \"rejected\" as const,\n clientOrderId,\n error: outcome.value.error,\n };\n }\n const { resolvedBaseQtyScaled, submittedMaxQuoteDebitScaled, ...accepted } =\n outcome.value;\n const symbolId = symbolIds[index]!;\n return {\n status: \"accepted\" as const,\n clientOrderId,\n ...accepted,\n resolvedBaseQty: scaledToDecimalOutput(\n resolvedBaseQtyScaled,\n scales.baseQty(symbolId),\n ),\n ...(submittedMaxQuoteDebitScaled === undefined\n ? {}\n : {\n submittedMaxQuoteDebit: scaledToDecimalOutput(\n submittedMaxQuoteDebitScaled,\n scales.quoteAmount(symbolId),\n ),\n }),\n };\n }),\n ts: tsNsToMs(tsNs),\n tsNs: tsNs.toString(),\n })),\n );\n}\n\nexport type BatchCreateOrdersResult = v.InferOutput<\n ReturnType<typeof createBatchCreateOrdersResultSchema>\n>;\nexport type BatchCreateOrderResult = BatchCreateOrdersResult[\"results\"][number];\n\nconst DecimalInputStringSchema = v.pipe(v.string(), v.trim(), v.minLength(1));\nconst BATCH_REPLACE_ITEM_INPUT_KEYS = new Set([\n \"orderId\",\n \"clientOrderId\",\n \"newPrice\",\n \"newQty\",\n \"risk\",\n \"clearRisk\",\n \"newClientOrderId\",\n]);\n\nexport function assertKnownBatchReplaceOrderItemInputKeys(input: object): void {\n for (const key of Object.keys(input)) {\n if (!BATCH_REPLACE_ITEM_INPUT_KEYS.has(key)) {\n throw new Error(`Unknown key \"${key}\" in batch replace order item.`);\n }\n }\n}\n\nconst BatchReplaceTargetInputSchema = v.union([\n v.pipe(\n v.object({\n orderId: v.pipe(\n idInputSchema(\"items.orderId\"),\n v.check((value) => value > 0n, \"items.orderId must be greater than zero\"),\n ),\n clientOrderId: v.optional(v.never()),\n }),\n v.transform(({ orderId }) => ({\n key: { case: \"orderId\" as const, value: orderId },\n })),\n ),\n v.pipe(\n v.object({\n orderId: v.optional(v.never()),\n clientOrderId: ClientOrderIdInputSchema,\n }),\n v.transform(({ clientOrderId }) => ({\n key: { case: \"clientOrderId\" as const, value: clientOrderId },\n })),\n ),\n]);\n\nfunction createBatchReplaceOrderItemInputSchema(scales: SdkScales, symbolId: number) {\n const patchSchema = v.union([\n v.object({\n newPrice: DecimalInputStringSchema,\n newQty: v.optional(DecimalInputStringSchema),\n risk: v.optional(createRequiredRiskPolicyInputSchema(scales)),\n clearRisk: v.optional(v.literal(false)),\n }),\n v.object({\n newPrice: v.optional(DecimalInputStringSchema),\n newQty: DecimalInputStringSchema,\n risk: v.optional(createRequiredRiskPolicyInputSchema(scales)),\n clearRisk: v.optional(v.literal(false)),\n }),\n v.object({\n newPrice: v.optional(v.never()),\n newQty: v.optional(v.never()),\n risk: createRequiredRiskPolicyInputSchema(scales),\n clearRisk: v.optional(v.literal(false)),\n }),\n v.object({\n newPrice: v.optional(v.never()),\n newQty: v.optional(v.never()),\n risk: v.optional(v.never()),\n clearRisk: v.literal(true),\n }),\n ]);\n return v.pipe(\n v.intersect([\n BatchReplaceTargetInputSchema,\n patchSchema,\n v.object({\n newClientOrderId: v.optional(ClientOrderIdInputSchema),\n }),\n ]),\n v.transform((input) => ({\n key: input.key,\n newPriceTicks:\n input.newPrice === undefined\n ? undefined\n : positiveDecimalInputToScaled(\n \"items.newPrice\",\n input.newPrice,\n scales.price(),\n ),\n newQtyScaled:\n input.newQty === undefined\n ? undefined\n : positiveDecimalInputToScaled(\n \"items.newQty\",\n input.newQty,\n scales.baseQty(symbolId),\n ),\n newAttachedRisk:\n input.clearRisk === true ? create(ProtoWrite.RiskPolicySchema) : input.risk,\n newClientOrderId: input.newClientOrderId ?? \"\",\n })),\n );\n}\n\nexport function createBatchReplaceOrdersInputSchema(scales: SdkScales, symbolId: number) {\n return v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n symbolId: v.pipe(v.literal(symbolId), v.integer(), v.minValue(1)),\n requestId: v.optional(OrderRequestIdInputSchema),\n items: v.pipe(\n v.array(createBatchReplaceOrderItemInputSchema(scales, symbolId)),\n v.minLength(1, \"At least one replacement is required.\"),\n v.maxLength(50, \"Batch replace accepts at most 50 replacements.\"),\n ),\n }),\n v.check((input) => {\n const targets = input.items.map(\n (item) => `${item.key.case}:${item.key.value.toString()}`,\n );\n return new Set(targets).size === targets.length;\n }, \"Each batch replace target must be unique.\"),\n v.transform(({ account, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n })),\n );\n}\n\nexport type BatchReplaceOrdersInput = {\n account?: v.InferInput<typeof AccountScopeInputEntries.account>;\n symbolId: number;\n requestId?: string;\n items: Array<{\n orderId?: string;\n clientOrderId?: string;\n newPrice?: string;\n newQty?: string;\n risk?: v.InferInput<ReturnType<typeof createRequiredRiskPolicyInputSchema>>;\n clearRisk?: boolean;\n newClientOrderId?: string;\n }>;\n};\n\nconst BatchReplaceAdmissionItemSchema = v.pipe(\n v.object({\n itemIndex: BatchItemIndexSchema,\n status: v.pipe(\n v.enum(ProtoWrite.BatchReplaceItemAdmissionStatus),\n v.transform((status) =>\n requiredEnumLabel(\n BatchReplaceItemAdmissionStatusCodec.protoToOutput,\n status,\n \"BatchReplaceAdmissionItemSchema\",\n \"status\",\n ),\n ),\n ),\n oldOrderId: OptionalPublicIdSchema,\n replacementOrderId: OptionalPublicIdSchema,\n clientOrderId: v.string(),\n code: v.string(),\n error: v.optional(OrderErrorDetailSchema),\n }),\n v.transform((item) => ({\n ...item,\n code: item.code || undefined,\n })),\n);\n\nexport type BatchReplaceAdmissionItem = v.InferOutput<typeof BatchReplaceAdmissionItemSchema>;\n\nexport const BatchReplaceOrdersResultSchema = v.pipe(\n v.object({\n batchRequestId: PositivePublicIdSchema,\n status: v.pipe(\n v.enum(ProtoWrite.BatchReplaceAdmissionStatus),\n v.transform((status) =>\n requiredEnumLabel(\n BatchReplaceAdmissionStatusCodec.protoToOutput,\n status,\n \"BatchReplaceOrdersResultSchema\",\n \"status\",\n ),\n ),\n ),\n results: v.array(BatchReplaceAdmissionItemSchema),\n acceptedCount: BatchCountSchema,\n rejectedCount: BatchCountSchema,\n acceptedTsNs: v.bigint(),\n }),\n v.check(\n (response) => response.acceptedCount + response.rejectedCount === response.results.length,\n \"Batch replace result counts do not match the returned results.\",\n ),\n v.check(\n (response) => response.results.every((item, index) => item.itemIndex === index),\n \"Batch replace results must preserve request item order.\",\n ),\n v.transform(({ acceptedTsNs, ...response }) => ({\n ...response,\n acceptedTs: tsNsToMs(acceptedTsNs),\n acceptedTsNs: acceptedTsNs.toString(),\n })),\n);\n\nexport type BatchReplaceOrdersResult = v.InferOutput<typeof BatchReplaceOrdersResultSchema>;\n\nexport const GetBatchReplaceStatusInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n batchRequestId: v.pipe(\n idInputSchema(\"batchRequestId\"),\n v.check((value) => value > 0n, \"batchRequestId must be greater than zero\"),\n ),\n }),\n v.transform(({ account, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\nexport type GetBatchReplaceStatusInput = v.InferInput<typeof GetBatchReplaceStatusInputSchema>;\n\nconst BatchReplaceStatusItemSchema = v.pipe(\n v.object({\n itemIndex: BatchItemIndexSchema,\n phase: v.pipe(\n v.enum(ProtoRead.BatchReplacePhase),\n v.transform((phase) =>\n requiredEnumLabel(\n BatchReplacePhaseCodec.protoToOutput,\n phase,\n \"BatchReplaceStatusItemSchema\",\n \"phase\",\n ),\n ),\n ),\n oldOrderId: OptionalPublicIdSchema,\n replacementOrderId: OptionalPublicIdSchema,\n orderStatus: v.pipe(\n v.enum(ProtoRead.OrderStatus),\n v.transform((status) =>\n requiredEnumLabel(\n OrderStatusCodec.protoToOutput,\n status,\n \"BatchReplaceStatusItemSchema\",\n \"order status\",\n ),\n ),\n ),\n code: v.string(),\n updatedTsNs: v.bigint(),\n }),\n v.transform(({ updatedTsNs, ...item }) => ({\n ...item,\n code: item.code || undefined,\n updatedTs: tsNsToMs(updatedTsNs),\n updatedTsNs: updatedTsNs.toString(),\n })),\n);\n\nexport const GetBatchReplaceStatusResultSchema = v.pipe(\n v.object({\n batchRequestId: PositivePublicIdSchema,\n admissionStatus: v.pipe(\n v.enum(ProtoWrite.BatchReplaceAdmissionStatus),\n v.transform((status) =>\n requiredEnumLabel(\n BatchReplaceAdmissionStatusCodec.protoToOutput,\n status,\n \"GetBatchReplaceStatusResultSchema\",\n \"admission status\",\n ),\n ),\n ),\n items: v.array(BatchReplaceStatusItemSchema),\n acceptedCount: BatchCountSchema,\n rejectedCount: BatchCountSchema,\n acceptedTsNs: v.bigint(),\n updatedTsNs: v.bigint(),\n }),\n v.check(\n (response) => response.acceptedCount + response.rejectedCount === response.items.length,\n \"Batch replace status counts do not match the returned items.\",\n ),\n v.check(\n (response) => response.items.every((item, index) => item.itemIndex === index),\n \"Batch replace status items must preserve request item order.\",\n ),\n v.transform(({ acceptedTsNs, updatedTsNs, ...response }) => ({\n ...response,\n acceptedTs: tsNsToMs(acceptedTsNs),\n acceptedTsNs: acceptedTsNs.toString(),\n updatedTs: tsNsToMs(updatedTsNs),\n updatedTsNs: updatedTsNs.toString(),\n })),\n);\n\nexport type GetBatchReplaceStatusResult = v.InferOutput<typeof GetBatchReplaceStatusResultSchema>;\n\nconst BatchCancelOrderInputSchema = v.union([\n v.pipe(\n v.strictObject({\n orderId: v.pipe(\n idInputSchema(\"items.orderId\"),\n v.check((value) => value > 0n, \"items.orderId must be greater than zero\"),\n ),\n clientOrderId: v.optional(v.never()),\n symbolId: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1))),\n }),\n v.transform(({ orderId, symbolId }) => ({ orderId, symbolId })),\n ),\n v.pipe(\n v.strictObject({\n orderId: v.optional(v.never()),\n clientOrderId: ClientOrderIdInputSchema,\n symbolId: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1))),\n }),\n v.transform(({ clientOrderId, symbolId }) => ({ clientOrderId, symbolId })),\n ),\n]);\n\nexport type BatchCancelOrderInput = v.InferInput<typeof BatchCancelOrderInputSchema>;\n\nexport const BatchCancelOrdersInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n requestId: v.optional(OrderRequestIdInputSchema),\n items: v.pipe(\n v.array(BatchCancelOrderInputSchema),\n v.minLength(1, \"At least one order is required.\"),\n v.maxLength(50, \"Batch cancel accepts at most 50 orders.\"),\n ),\n }),\n v.transform(({ account, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\nexport type BatchCancelOrdersInput = v.InferInput<typeof BatchCancelOrdersInputSchema>;\n\nconst BatchCancelOrderResultSchema = v.object({\n status: v.picklist([\"accepted\", \"rejected\"]),\n orderId: OptionalPublicIdSchema,\n clientOrderId: v.string(),\n code: v.string(),\n error: v.optional(OrderErrorDetailSchema),\n});\n\nexport type BatchCancelOrderResult = v.InferOutput<typeof BatchCancelOrderResultSchema>;\n\nexport const BatchCancelOrdersResultSchema = v.pipe(\n v.object({\n results: v.array(BatchCancelOrderResultSchema),\n acceptedCount: BatchCountSchema,\n rejectedCount: BatchCountSchema,\n tsNs: v.bigint(),\n }),\n v.check(\n (response) => response.acceptedCount + response.rejectedCount === response.results.length,\n \"Batch cancel result counts do not match the returned results.\",\n ),\n v.transform(({ tsNs, ...response }) => ({\n ...response,\n ts: tsNsToMs(tsNs),\n tsNs: tsNs.toString(),\n })),\n);\n\nexport type BatchCancelOrdersResult = v.InferOutput<typeof BatchCancelOrdersResultSchema>;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAiCA,MAAM,mBAAmB,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,QAAQ,GAAG,EAAE,SAAS,CAAC,CAAC;AACtE,MAAM,uBAAuB,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,QAAQ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U,IAAI,yCAAyC,CAC7D;AACJ,CAAC,GACD,EAAE,WAAW,EAAE,SAAS,GAAG,aAAa;CACpC,GAAG;CACH,cAAc,2BAA2B,OAAO;AACpD,EAAE,CACN;AAIA,MAAM,+BAA+B,EAAE,OAAO;CAC1C,QAAQ,EAAE,SAAS,CAAC,YAAY,UAAU,CAAC;CAC3C,SAAS;CACT,eAAe,EAAE,OAAO;CACxB,MAAM,EAAE,OAAO;CACf,OAAO,EAAE,SAAS,sBAAsB;AAC5C,CAAC;AAID,MAAa,gCAAgC,EAAE,KAC3C,EAAE,OAAO;CACL,SAAS,EAAE,MAAM,4BAA4B;CAC7C,eAAe;CACf,eAAe;CACf,MAAM,EAAE,OAAO;AACnB,CAAC,GACD,EAAE,OACG,aAAa,SAAS,gBAAgB,SAAS,kBAAkB,SAAS,QAAQ,QACnF,+DACJ,GACA,EAAE,WAAW,EAAE,MAAM,GAAG,gBAAgB;CACpC,GAAG;CACH,IAAI,SAAS,IAAI;CACjB,MAAM,KAAK,SAAS;AACxB,EAAE,CACN"}
|
|
1
|
+
{"version":3,"file":"orders-batch.schemas.js","names":["ProtoWrite.RiskPolicySchema","ProtoWrite.BatchReplaceItemAdmissionStatus","ProtoWrite.BatchReplaceAdmissionStatus","ProtoRead.BatchReplacePhase","ProtoRead.OrderStatus"],"sources":["../../../src/services/orders/orders-batch.schemas.ts"],"sourcesContent":["import * as ProtoWrite from \"../../gen/orders/v1/orders_pb.js\";\nimport * as ProtoRead from \"../../gen/orders/v1/orders_read_pb.js\";\nimport { create } from \"@bufbuild/protobuf\";\nimport * as v from \"valibot\";\nimport {\n AccountScopeInputEntries,\n accountScopeToSubaccountId,\n} from \"../../shared/account-scope.js\";\nimport { OptionalPublicIdSchema, PublicIdSchema, idInputSchema } from \"../../shared/schemas.js\";\nimport { requiredEnumLabel } from \"../../shared/proto-enum-codec.js\";\nimport { tsNsToMs } from \"../../utils/time.js\";\nimport { formatId } from \"../../utils/base58-id.js\";\nimport { SideSchema, SymbolIdInputSchema } from \"../shared.js\";\nimport {\n positiveDecimalInputToScaled,\n scaledToDecimalOutput,\n type SdkScales,\n} from \"../../shared/decimal-surface.js\";\nimport {\n BatchReplaceAdmissionStatusCodec,\n BatchReplaceItemAdmissionStatusCodec,\n BatchReplacePhaseCodec,\n OrderStatusCodec,\n OrderSideCodec,\n} from \"./orders.codecs.js\";\nimport { createOrderIntentInputSchema } from \"./orders-input.schemas.js\";\nimport { createRequiredRiskPolicyInputSchema } from \"./orders-risk.schemas.js\";\nimport {\n ClientOrderIdInputSchema,\n OrderRequestIdInputSchema,\n} from \"./orders-identifiers.schemas.js\";\nimport { OrderErrorDetailSchema } from \"./order-errors.schemas.js\";\n\nconst BatchCountSchema = v.pipe(v.number(), v.integer(), v.minValue(0));\nconst BatchItemIndexSchema = v.pipe(v.number(), v.integer(), v.minValue(0));\nconst PositivePublicIdSchema = v.pipe(\n v.bigint(),\n v.gtValue(0n),\n v.transform((value) => formatId(value)),\n);\nconst OptionalSideInputSchema = v.pipe(\n v.optional(SideSchema),\n v.transform((side) => (side ? OrderSideCodec.inputToProto[side] : undefined)),\n);\n\nconst CancelAllAfterTimeoutInputSchema = v.pipe(\n v.number(),\n v.integer(),\n v.check(\n (timeoutSec) => timeoutSec === 0 || (timeoutSec >= 10 && timeoutSec <= 120),\n \"timeoutSec must be 0 to disable or between 10 and 120 seconds to arm\",\n ),\n);\n\nexport const CancelAllAfterInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n timeoutSec: CancelAllAfterTimeoutInputSchema,\n symbolId: v.optional(SymbolIdInputSchema),\n side: OptionalSideInputSchema,\n requestId: v.optional(OrderRequestIdInputSchema),\n }),\n v.transform(({ account, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\nexport type CancelAllAfterInput = v.InferInput<typeof CancelAllAfterInputSchema>;\n\nexport const CancelAllAfterResultSchema = v.pipe(\n v.object({\n status: v.picklist([\"armed\", \"disabled\"]),\n effectiveTimeoutSec: v.pipe(v.number(), v.integer(), v.minValue(0)),\n expiresAtTsNs: v.bigint(),\n tsNs: v.bigint(),\n }),\n v.transform(({ expiresAtTsNs, tsNs, ...result }) => ({\n ...result,\n expiresAt: tsNsToMs(expiresAtTsNs),\n expiresAtNs: expiresAtTsNs.toString(),\n ts: tsNsToMs(tsNs),\n tsNs: tsNs.toString(),\n })),\n);\n\nexport type CancelAllAfterResult = v.InferOutput<typeof CancelAllAfterResultSchema>;\n\nexport function createBatchCreateOrdersInputSchema(scales: SdkScales) {\n return v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n requestId: v.optional(OrderRequestIdInputSchema),\n items: v.pipe(\n v.array(createOrderIntentInputSchema(scales)),\n v.minLength(1, \"At least one order is required.\"),\n v.maxLength(20, \"Batch create accepts at most 20 orders.\"),\n ),\n }),\n v.check((input) => {\n const clientOrderIds = input.items\n .map((item) => item.clientOrderId)\n .filter((clientOrderId) => clientOrderId !== undefined && clientOrderId !== \"\");\n return new Set(clientOrderIds).size === clientOrderIds.length;\n }, \"Each non-empty batch create clientOrderId must be unique.\"),\n v.transform(({ account, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n })),\n );\n}\n\nexport type BatchCreateOrdersInput = v.InferInput<\n ReturnType<typeof createBatchCreateOrdersInputSchema>\n>;\n\nconst BatchCreateOrderResultRawSchema = v.object({\n clientOrderId: v.string(),\n outcome: v.variant(\"case\", [\n v.object({\n case: v.literal(\"accepted\"),\n value: v.object({\n orderId: PublicIdSchema,\n takeProfitTriggerId: OptionalPublicIdSchema,\n stopLossTriggerId: OptionalPublicIdSchema,\n trailingStopTriggerId: OptionalPublicIdSchema,\n resolvedBaseQtyScaled: v.bigint(),\n submittedMaxQuoteDebitScaled: v.optional(v.bigint()),\n }),\n }),\n v.object({\n case: v.literal(\"rejected\"),\n value: v.object({\n // The server may reject without a structured detail (e.g. capacity\n // limits); surface the rejection instead of failing the parse.\n error: v.optional(OrderErrorDetailSchema),\n }),\n }),\n ]),\n});\n\nexport function createBatchCreateOrdersResultSchema(scales: SdkScales, symbolIds: number[]) {\n return v.pipe(\n v.object({\n results: v.array(BatchCreateOrderResultRawSchema),\n acceptedCount: BatchCountSchema,\n rejectedCount: BatchCountSchema,\n tsNs: v.bigint(),\n }),\n v.check(\n (response) =>\n response.acceptedCount + response.rejectedCount === response.results.length,\n \"Batch create result counts do not match the returned results.\",\n ),\n v.check(\n (response) => response.results.length === symbolIds.length,\n \"Batch create result count does not match the submitted item count.\",\n ),\n v.transform(({ tsNs, ...response }) => ({\n ...response,\n results: response.results.map(({ clientOrderId, outcome }, index) => {\n if (outcome.case === \"rejected\") {\n return {\n status: \"rejected\" as const,\n clientOrderId,\n error: outcome.value.error,\n };\n }\n const { resolvedBaseQtyScaled, submittedMaxQuoteDebitScaled, ...accepted } =\n outcome.value;\n const symbolId = symbolIds[index]!;\n return {\n status: \"accepted\" as const,\n clientOrderId,\n ...accepted,\n resolvedBaseQty: scaledToDecimalOutput(\n resolvedBaseQtyScaled,\n scales.baseQty(symbolId),\n ),\n ...(submittedMaxQuoteDebitScaled === undefined\n ? {}\n : {\n submittedMaxQuoteDebit: scaledToDecimalOutput(\n submittedMaxQuoteDebitScaled,\n scales.quoteAmount(symbolId),\n ),\n }),\n };\n }),\n ts: tsNsToMs(tsNs),\n tsNs: tsNs.toString(),\n })),\n );\n}\n\nexport type BatchCreateOrdersResult = v.InferOutput<\n ReturnType<typeof createBatchCreateOrdersResultSchema>\n>;\nexport type BatchCreateOrderResult = BatchCreateOrdersResult[\"results\"][number];\n\nconst DecimalInputStringSchema = v.pipe(v.string(), v.trim(), v.minLength(1));\nconst BATCH_REPLACE_ITEM_INPUT_KEYS = new Set([\n \"orderId\",\n \"clientOrderId\",\n \"newPrice\",\n \"newQty\",\n \"risk\",\n \"clearRisk\",\n \"newClientOrderId\",\n]);\n\nexport function assertKnownBatchReplaceOrderItemInputKeys(input: object): void {\n for (const key of Object.keys(input)) {\n if (!BATCH_REPLACE_ITEM_INPUT_KEYS.has(key)) {\n throw new Error(`Unknown key \"${key}\" in batch replace order item.`);\n }\n }\n}\n\nconst BatchReplaceTargetInputSchema = v.union([\n v.pipe(\n v.object({\n orderId: v.pipe(\n idInputSchema(\"items.orderId\"),\n v.check((value) => value > 0n, \"items.orderId must be greater than zero\"),\n ),\n clientOrderId: v.optional(v.never()),\n }),\n v.transform(({ orderId }) => ({\n key: { case: \"orderId\" as const, value: orderId },\n })),\n ),\n v.pipe(\n v.object({\n orderId: v.optional(v.never()),\n clientOrderId: ClientOrderIdInputSchema,\n }),\n v.transform(({ clientOrderId }) => ({\n key: { case: \"clientOrderId\" as const, value: clientOrderId },\n })),\n ),\n]);\n\nfunction createBatchReplaceOrderItemInputSchema(scales: SdkScales, symbolId: number) {\n const patchSchema = v.union([\n v.object({\n newPrice: DecimalInputStringSchema,\n newQty: v.optional(DecimalInputStringSchema),\n risk: v.optional(createRequiredRiskPolicyInputSchema(scales)),\n clearRisk: v.optional(v.literal(false)),\n }),\n v.object({\n newPrice: v.optional(DecimalInputStringSchema),\n newQty: DecimalInputStringSchema,\n risk: v.optional(createRequiredRiskPolicyInputSchema(scales)),\n clearRisk: v.optional(v.literal(false)),\n }),\n v.object({\n newPrice: v.optional(v.never()),\n newQty: v.optional(v.never()),\n risk: createRequiredRiskPolicyInputSchema(scales),\n clearRisk: v.optional(v.literal(false)),\n }),\n v.object({\n newPrice: v.optional(v.never()),\n newQty: v.optional(v.never()),\n risk: v.optional(v.never()),\n clearRisk: v.literal(true),\n }),\n ]);\n return v.pipe(\n v.intersect([\n BatchReplaceTargetInputSchema,\n patchSchema,\n v.object({\n newClientOrderId: v.optional(ClientOrderIdInputSchema),\n }),\n ]),\n v.transform((input) => ({\n key: input.key,\n newPriceTicks:\n input.newPrice === undefined\n ? undefined\n : positiveDecimalInputToScaled(\n \"items.newPrice\",\n input.newPrice,\n scales.price(),\n ),\n newQtyScaled:\n input.newQty === undefined\n ? undefined\n : positiveDecimalInputToScaled(\n \"items.newQty\",\n input.newQty,\n scales.baseQty(symbolId),\n ),\n newAttachedRisk:\n input.clearRisk === true ? create(ProtoWrite.RiskPolicySchema) : input.risk,\n newClientOrderId: input.newClientOrderId ?? \"\",\n })),\n );\n}\n\nexport function createBatchReplaceOrdersInputSchema(scales: SdkScales, symbolId: number) {\n return v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n symbolId: v.pipe(v.literal(symbolId), v.integer(), v.minValue(1)),\n requestId: v.optional(OrderRequestIdInputSchema),\n items: v.pipe(\n v.array(createBatchReplaceOrderItemInputSchema(scales, symbolId)),\n v.minLength(1, \"At least one replacement is required.\"),\n v.maxLength(50, \"Batch replace accepts at most 50 replacements.\"),\n ),\n }),\n v.check((input) => {\n const targets = input.items.map(\n (item) => `${item.key.case}:${item.key.value.toString()}`,\n );\n return new Set(targets).size === targets.length;\n }, \"Each batch replace target must be unique.\"),\n v.transform(({ account, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n })),\n );\n}\n\nexport type BatchReplaceOrdersInput = {\n account?: v.InferInput<typeof AccountScopeInputEntries.account>;\n symbolId: number;\n requestId?: string;\n items: Array<{\n orderId?: string;\n clientOrderId?: string;\n newPrice?: string;\n newQty?: string;\n risk?: v.InferInput<ReturnType<typeof createRequiredRiskPolicyInputSchema>>;\n clearRisk?: boolean;\n newClientOrderId?: string;\n }>;\n};\n\nconst BatchReplaceAdmissionItemSchema = v.pipe(\n v.object({\n itemIndex: BatchItemIndexSchema,\n status: v.pipe(\n v.enum(ProtoWrite.BatchReplaceItemAdmissionStatus),\n v.transform((status) =>\n requiredEnumLabel(\n BatchReplaceItemAdmissionStatusCodec.protoToOutput,\n status,\n \"BatchReplaceAdmissionItemSchema\",\n \"status\",\n ),\n ),\n ),\n oldOrderId: OptionalPublicIdSchema,\n replacementOrderId: OptionalPublicIdSchema,\n clientOrderId: v.string(),\n code: v.string(),\n error: v.optional(OrderErrorDetailSchema),\n }),\n v.transform((item) => ({\n ...item,\n code: item.code || undefined,\n })),\n);\n\nexport type BatchReplaceAdmissionItem = v.InferOutput<typeof BatchReplaceAdmissionItemSchema>;\n\nexport const BatchReplaceOrdersResultSchema = v.pipe(\n v.object({\n batchRequestId: PositivePublicIdSchema,\n status: v.pipe(\n v.enum(ProtoWrite.BatchReplaceAdmissionStatus),\n v.transform((status) =>\n requiredEnumLabel(\n BatchReplaceAdmissionStatusCodec.protoToOutput,\n status,\n \"BatchReplaceOrdersResultSchema\",\n \"status\",\n ),\n ),\n ),\n results: v.array(BatchReplaceAdmissionItemSchema),\n acceptedCount: BatchCountSchema,\n rejectedCount: BatchCountSchema,\n acceptedTsNs: v.bigint(),\n }),\n v.check(\n (response) => response.acceptedCount + response.rejectedCount === response.results.length,\n \"Batch replace result counts do not match the returned results.\",\n ),\n v.check(\n (response) => response.results.every((item, index) => item.itemIndex === index),\n \"Batch replace results must preserve request item order.\",\n ),\n v.transform(({ acceptedTsNs, ...response }) => ({\n ...response,\n acceptedTs: tsNsToMs(acceptedTsNs),\n acceptedTsNs: acceptedTsNs.toString(),\n })),\n);\n\nexport type BatchReplaceOrdersResult = v.InferOutput<typeof BatchReplaceOrdersResultSchema>;\n\nexport const GetBatchReplaceStatusInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n batchRequestId: v.pipe(\n idInputSchema(\"batchRequestId\"),\n v.check((value) => value > 0n, \"batchRequestId must be greater than zero\"),\n ),\n }),\n v.transform(({ account, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\nexport type GetBatchReplaceStatusInput = v.InferInput<typeof GetBatchReplaceStatusInputSchema>;\n\nconst BatchReplaceStatusItemSchema = v.pipe(\n v.object({\n itemIndex: BatchItemIndexSchema,\n phase: v.pipe(\n v.enum(ProtoRead.BatchReplacePhase),\n v.transform((phase) =>\n requiredEnumLabel(\n BatchReplacePhaseCodec.protoToOutput,\n phase,\n \"BatchReplaceStatusItemSchema\",\n \"phase\",\n ),\n ),\n ),\n oldOrderId: OptionalPublicIdSchema,\n replacementOrderId: OptionalPublicIdSchema,\n orderStatus: v.pipe(\n v.enum(ProtoRead.OrderStatus),\n v.transform((status) =>\n requiredEnumLabel(\n OrderStatusCodec.protoToOutput,\n status,\n \"BatchReplaceStatusItemSchema\",\n \"order status\",\n ),\n ),\n ),\n code: v.string(),\n updatedTsNs: v.bigint(),\n }),\n v.transform(({ updatedTsNs, ...item }) => ({\n ...item,\n code: item.code || undefined,\n updatedTs: tsNsToMs(updatedTsNs),\n updatedTsNs: updatedTsNs.toString(),\n })),\n);\n\nexport const GetBatchReplaceStatusResultSchema = v.pipe(\n v.object({\n batchRequestId: PositivePublicIdSchema,\n admissionStatus: v.pipe(\n v.enum(ProtoWrite.BatchReplaceAdmissionStatus),\n v.transform((status) =>\n requiredEnumLabel(\n BatchReplaceAdmissionStatusCodec.protoToOutput,\n status,\n \"GetBatchReplaceStatusResultSchema\",\n \"admission status\",\n ),\n ),\n ),\n items: v.array(BatchReplaceStatusItemSchema),\n acceptedCount: BatchCountSchema,\n rejectedCount: BatchCountSchema,\n acceptedTsNs: v.bigint(),\n updatedTsNs: v.bigint(),\n }),\n v.check(\n (response) => response.acceptedCount + response.rejectedCount === response.items.length,\n \"Batch replace status counts do not match the returned items.\",\n ),\n v.check(\n (response) => response.items.every((item, index) => item.itemIndex === index),\n \"Batch replace status items must preserve request item order.\",\n ),\n v.transform(({ acceptedTsNs, updatedTsNs, ...response }) => ({\n ...response,\n acceptedTs: tsNsToMs(acceptedTsNs),\n acceptedTsNs: acceptedTsNs.toString(),\n updatedTs: tsNsToMs(updatedTsNs),\n updatedTsNs: updatedTsNs.toString(),\n })),\n);\n\nexport type GetBatchReplaceStatusResult = v.InferOutput<typeof GetBatchReplaceStatusResultSchema>;\n\nconst BatchCancelOrderInputSchema = v.union([\n v.pipe(\n v.strictObject({\n orderId: v.pipe(\n idInputSchema(\"items.orderId\"),\n v.check((value) => value > 0n, \"items.orderId must be greater than zero\"),\n ),\n clientOrderId: v.optional(v.never()),\n symbolId: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1))),\n }),\n v.transform(({ orderId, symbolId }) => ({ orderId, symbolId })),\n ),\n v.pipe(\n v.strictObject({\n orderId: v.optional(v.never()),\n clientOrderId: ClientOrderIdInputSchema,\n symbolId: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1))),\n }),\n v.transform(({ clientOrderId, symbolId }) => ({ clientOrderId, symbolId })),\n ),\n]);\n\nexport type BatchCancelOrderInput = v.InferInput<typeof BatchCancelOrderInputSchema>;\n\nexport const BatchCancelOrdersInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n requestId: v.optional(OrderRequestIdInputSchema),\n items: v.pipe(\n v.array(BatchCancelOrderInputSchema),\n v.minLength(1, \"At least one order is required.\"),\n v.maxLength(50, \"Batch cancel accepts at most 50 orders.\"),\n ),\n }),\n v.transform(({ account, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\nexport type BatchCancelOrdersInput = v.InferInput<typeof BatchCancelOrdersInputSchema>;\n\nconst BatchCancelOrderResultSchema = v.object({\n status: v.picklist([\"accepted\", \"rejected\"]),\n orderId: OptionalPublicIdSchema,\n clientOrderId: v.string(),\n code: v.string(),\n error: v.optional(OrderErrorDetailSchema),\n});\n\nexport type BatchCancelOrderResult = v.InferOutput<typeof BatchCancelOrderResultSchema>;\n\nexport const BatchCancelOrdersResultSchema = v.pipe(\n v.object({\n results: v.array(BatchCancelOrderResultSchema),\n acceptedCount: BatchCountSchema,\n rejectedCount: BatchCountSchema,\n tsNs: v.bigint(),\n }),\n v.check(\n (response) => response.acceptedCount + response.rejectedCount === response.results.length,\n \"Batch cancel result counts do not match the returned results.\",\n ),\n v.transform(({ tsNs, ...response }) => ({\n ...response,\n ts: tsNsToMs(tsNs),\n tsNs: tsNs.toString(),\n })),\n);\n\nexport type BatchCancelOrdersResult = v.InferOutput<typeof BatchCancelOrdersResultSchema>;\n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