From f7b8b828e5786dee577851f076fe20e69901d92a Mon Sep 17 00:00:00 2001 From: Mikhail Gladchenko Date: Thu, 16 Mar 2023 14:52:14 +0000 Subject: [PATCH] Update orderUpdateSchema --- .../OrionAggregator/ws/schemas/addressUpdateSchema.ts | 9 +++++++++ .../OrionAggregator/ws/schemas/cfdBalancesSchema.ts | 4 ---- src/types.ts | 2 -- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/services/OrionAggregator/ws/schemas/addressUpdateSchema.ts b/src/services/OrionAggregator/ws/schemas/addressUpdateSchema.ts index 583c684..d9f53b5 100644 --- a/src/services/OrionAggregator/ws/schemas/addressUpdateSchema.ts +++ b/src/services/OrionAggregator/ws/schemas/addressUpdateSchema.ts @@ -5,6 +5,7 @@ import subOrderStatuses from '../../../../constants/subOrderStatuses'; import MessageType from '../MessageType'; import balancesSchema from './balancesSchema'; import baseMessageSchema from './baseMessageSchema'; +import executionTypes from '../../../../constants/cfdExecutionTypes'; const baseAddressUpdate = baseMessageSchema.extend({ id: z.string(), @@ -34,6 +35,8 @@ export const orderUpdateSchema = z.object({ S: z.enum(orderStatuses), // status l: z.boolean().optional(), // is liquidation order t: z.number(), // update time + E: z.enum(executionTypes).optional(), // execution type + C: z.string().optional(), // trigger condition c: subOrderSchema.array(), }) .transform((val) => ({ @@ -45,6 +48,8 @@ export const orderUpdateSchema = z.object({ settledAmount: o.A, status: o.S, liquidated: o.l, + executionType: o.E, + triggerCondition: o.C, subOrders: o.c.map((so) => ({ pair: so.P, exchange: so.e, @@ -75,6 +80,8 @@ export const fullOrderSchema = z.object({ T: z.number(), // creation time / unix timestamp t: z.number(), // update time c: subOrderSchema.array(), + E: z.enum(executionTypes).optional(), // execution type + C: z.string().optional(), // trigger condition }).transform((val) => ({ ...val, k: 'full' as const, @@ -93,6 +100,8 @@ export const fullOrderSchema = z.object({ pair: o.P, amount: o.a, price: o.p, + executionType: o.E, + triggerCondition: o.C, subOrders: o.c.map((so) => ({ pair: so.P, exchange: so.e, diff --git a/src/services/OrionAggregator/ws/schemas/cfdBalancesSchema.ts b/src/services/OrionAggregator/ws/schemas/cfdBalancesSchema.ts index 48d4a97..3f7c91b 100644 --- a/src/services/OrionAggregator/ws/schemas/cfdBalancesSchema.ts +++ b/src/services/OrionAggregator/ws/schemas/cfdBalancesSchema.ts @@ -24,8 +24,6 @@ const cfdBalanceSchema = z sfrs: z.string(), sfrd: z.string(), sop: z.string().optional(), - E: z.enum(executionTypes), - C: z.string().optional(), }) .transform((obj) => ({ instrument: obj.i, @@ -48,8 +46,6 @@ const cfdBalanceSchema = z shortFundingRatePerSecond: obj.sfrs, shortFundingRatePerDay: obj.sfrd, stopOutPrice: obj.sop, - executionType: obj.E, - triggerCondition: obj.C, })); const cfdBalancesSchema = z.array(cfdBalanceSchema); diff --git a/src/types.ts b/src/types.ts index b150dea..a77b780 100644 --- a/src/types.ts +++ b/src/types.ts @@ -58,8 +58,6 @@ export type CFDBalance = { shortFundingRatePerSecond: string shortFundingRatePerDay: string stopOutPrice: string | undefined - executionType: ExecutionType - triggerCondition: string | undefined } export type Order = {