diff --git a/package.json b/package.json index 60f3eca..a4a3c62 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@orionprotocol/sdk", - "version": "0.17.36", + "version": "0.17.37-rc.2", "description": "Orion Protocol SDK", "main": "./lib/esm/index.js", "module": "./lib/esm/index.js", diff --git a/src/constants/cfdExecutionTypes.ts b/src/constants/cfdExecutionTypes.ts new file mode 100644 index 0000000..bc82566 --- /dev/null +++ b/src/constants/cfdExecutionTypes.ts @@ -0,0 +1,3 @@ +const executionTypes = ['LIMIT', 'STOP_LIMIT'] as const; + +export default executionTypes; 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 e7abacd..5037864 100644 --- a/src/services/OrionAggregator/ws/schemas/cfdBalancesSchema.ts +++ b/src/services/OrionAggregator/ws/schemas/cfdBalancesSchema.ts @@ -44,7 +44,7 @@ const cfdBalanceSchema = z longFundingRatePerDay: obj.lfrd, shortFundingRatePerSecond: obj.sfrs, shortFundingRatePerDay: obj.sfrd, - stopOutPrice: obj.sop + stopOutPrice: obj.sop, })); const cfdBalancesSchema = z.array(cfdBalanceSchema); diff --git a/src/types.ts b/src/types.ts index 891d740..a77b780 100644 --- a/src/types.ts +++ b/src/types.ts @@ -4,6 +4,7 @@ import type exchanges from './constants/exchanges'; import type subOrderStatuses from './constants/subOrderStatuses'; import type positionStatuses from './constants/positionStatuses'; import type { knownEnvs } from './config/schemas'; +import type executionTypes from './constants/cfdExecutionTypes'; export type DeepPartial = T extends object ? { [P in keyof T]?: DeepPartial; @@ -34,6 +35,7 @@ export type Balance = { } export type PositionStatus = typeof positionStatuses[number]; +export type ExecutionType = typeof executionTypes[number]; export type CFDBalance = { instrument: string