@usherlabs/cex-broker 0.2.29 → 0.2.30
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/dist/commands/cli.js +10 -3
- package/dist/index.js +11 -4
- package/dist/index.js.map +4 -4
- package/dist/schemas/action-payloads.d.ts +1 -0
- package/package.json +1 -1
package/dist/commands/cli.js
CHANGED
|
@@ -330710,6 +330710,7 @@ var CreateOrderPayloadSchema = exports_external.object({
|
|
|
330710
330710
|
toToken: exports_external.string().min(1),
|
|
330711
330711
|
price: exports_external.coerce.number().positive(),
|
|
330712
330712
|
marketType: marketTypeSchema,
|
|
330713
|
+
clientOrderId: exports_external.string().min(1).optional(),
|
|
330713
330714
|
params: exports_external.preprocess(parseJsonString, stringNumberRecordSchema).default({})
|
|
330714
330715
|
});
|
|
330715
330716
|
var GetPerpConfigStatePayloadSchema = exports_external.object({
|
|
@@ -331481,6 +331482,12 @@ async function handleCreateOrder(ctx) {
|
|
|
331481
331482
|
const orderValue = parsePayloadForAction(ctx, CreateOrderPayloadSchema);
|
|
331482
331483
|
if (orderValue === null)
|
|
331483
331484
|
return;
|
|
331485
|
+
const createOrderParams = {
|
|
331486
|
+
...orderValue.params,
|
|
331487
|
+
...orderValue.clientOrderId !== undefined && {
|
|
331488
|
+
clientOrderId: orderValue.clientOrderId
|
|
331489
|
+
}
|
|
331490
|
+
};
|
|
331484
331491
|
let resolvedOrderTelemetry = {};
|
|
331485
331492
|
try {
|
|
331486
331493
|
if (!broker) {
|
|
@@ -331504,7 +331511,7 @@ async function handleCreateOrder(ctx) {
|
|
|
331504
331511
|
if (selectedBrokerAccount?.label) {
|
|
331505
331512
|
orderActivityTracker?.record(cex3, selectedBrokerAccount.label, resolution.symbol);
|
|
331506
331513
|
}
|
|
331507
|
-
const telemetryIds = extractOrderTelemetryIds(
|
|
331514
|
+
const telemetryIds = extractOrderTelemetryIds(createOrderParams);
|
|
331508
331515
|
const submissionTimestamp = new Date().toISOString();
|
|
331509
331516
|
const marketMetadataHash = await captureMarketMetadataSnapshot(brokerArchiver, broker, {
|
|
331510
331517
|
exchange: cex3,
|
|
@@ -331514,7 +331521,7 @@ async function handleCreateOrder(ctx) {
|
|
|
331514
331521
|
brokerObservedTimestamp: submissionTimestamp,
|
|
331515
331522
|
...telemetryIds
|
|
331516
331523
|
});
|
|
331517
|
-
const order = await broker.createOrder(resolution.symbol, orderValue.orderType, resolution.side, resolution.amountBase ?? orderValue.amount, orderValue.price,
|
|
331524
|
+
const order = await broker.createOrder(resolution.symbol, orderValue.orderType, resolution.side, resolution.amountBase ?? orderValue.amount, orderValue.price, createOrderParams);
|
|
331518
331525
|
const createOrderContext = {
|
|
331519
331526
|
action: "CreateOrder",
|
|
331520
331527
|
cex: cex3,
|
|
@@ -331542,7 +331549,7 @@ async function handleCreateOrder(ctx) {
|
|
|
331542
331549
|
orderType: orderValue.orderType,
|
|
331543
331550
|
requestedQuantity: resolvedOrderTelemetry.requestedQuantity ?? orderValue.amount,
|
|
331544
331551
|
requestedNotional: orderValue.amount * orderValue.price,
|
|
331545
|
-
...extractOrderTelemetryIds(
|
|
331552
|
+
...extractOrderTelemetryIds(createOrderParams)
|
|
331546
331553
|
};
|
|
331547
331554
|
emitOrderExecutionTelemetryInBackground(otelMetrics, failedCreateContext, undefined, error48);
|
|
331548
331555
|
archiveOrderExecutionInBackground(brokerArchiver, failedCreateContext, undefined, error48);
|
package/dist/index.js
CHANGED
|
@@ -306224,6 +306224,7 @@ var CreateOrderPayloadSchema = exports_external.object({
|
|
|
306224
306224
|
toToken: exports_external.string().min(1),
|
|
306225
306225
|
price: exports_external.coerce.number().positive(),
|
|
306226
306226
|
marketType: marketTypeSchema,
|
|
306227
|
+
clientOrderId: exports_external.string().min(1).optional(),
|
|
306227
306228
|
params: exports_external.preprocess(parseJsonString, stringNumberRecordSchema).default({})
|
|
306228
306229
|
});
|
|
306229
306230
|
var GetPerpConfigStatePayloadSchema = exports_external.object({
|
|
@@ -306995,6 +306996,12 @@ async function handleCreateOrder(ctx) {
|
|
|
306995
306996
|
const orderValue = parsePayloadForAction(ctx, CreateOrderPayloadSchema);
|
|
306996
306997
|
if (orderValue === null)
|
|
306997
306998
|
return;
|
|
306999
|
+
const createOrderParams = {
|
|
307000
|
+
...orderValue.params,
|
|
307001
|
+
...orderValue.clientOrderId !== undefined && {
|
|
307002
|
+
clientOrderId: orderValue.clientOrderId
|
|
307003
|
+
}
|
|
307004
|
+
};
|
|
306998
307005
|
let resolvedOrderTelemetry = {};
|
|
306999
307006
|
try {
|
|
307000
307007
|
if (!broker) {
|
|
@@ -307018,7 +307025,7 @@ async function handleCreateOrder(ctx) {
|
|
|
307018
307025
|
if (selectedBrokerAccount?.label) {
|
|
307019
307026
|
orderActivityTracker?.record(cex3, selectedBrokerAccount.label, resolution.symbol);
|
|
307020
307027
|
}
|
|
307021
|
-
const telemetryIds = extractOrderTelemetryIds(
|
|
307028
|
+
const telemetryIds = extractOrderTelemetryIds(createOrderParams);
|
|
307022
307029
|
const submissionTimestamp = new Date().toISOString();
|
|
307023
307030
|
const marketMetadataHash = await captureMarketMetadataSnapshot(brokerArchiver, broker, {
|
|
307024
307031
|
exchange: cex3,
|
|
@@ -307028,7 +307035,7 @@ async function handleCreateOrder(ctx) {
|
|
|
307028
307035
|
brokerObservedTimestamp: submissionTimestamp,
|
|
307029
307036
|
...telemetryIds
|
|
307030
307037
|
});
|
|
307031
|
-
const order = await broker.createOrder(resolution.symbol, orderValue.orderType, resolution.side, resolution.amountBase ?? orderValue.amount, orderValue.price,
|
|
307038
|
+
const order = await broker.createOrder(resolution.symbol, orderValue.orderType, resolution.side, resolution.amountBase ?? orderValue.amount, orderValue.price, createOrderParams);
|
|
307032
307039
|
const createOrderContext = {
|
|
307033
307040
|
action: "CreateOrder",
|
|
307034
307041
|
cex: cex3,
|
|
@@ -307056,7 +307063,7 @@ async function handleCreateOrder(ctx) {
|
|
|
307056
307063
|
orderType: orderValue.orderType,
|
|
307057
307064
|
requestedQuantity: resolvedOrderTelemetry.requestedQuantity ?? orderValue.amount,
|
|
307058
307065
|
requestedNotional: orderValue.amount * orderValue.price,
|
|
307059
|
-
...extractOrderTelemetryIds(
|
|
307066
|
+
...extractOrderTelemetryIds(createOrderParams)
|
|
307060
307067
|
};
|
|
307061
307068
|
emitOrderExecutionTelemetryInBackground(otelMetrics, failedCreateContext, undefined, error48);
|
|
307062
307069
|
archiveOrderExecutionInBackground(brokerArchiver, failedCreateContext, undefined, error48);
|
|
@@ -310119,4 +310126,4 @@ export {
|
|
|
310119
310126
|
CEXBroker as default
|
|
310120
310127
|
};
|
|
310121
310128
|
|
|
310122
|
-
//# debugId=
|
|
310129
|
+
//# debugId=6BC6E31BFE4D8B3F64756E2164756E21
|