Readonly typeThe type property is used to determine the shape of the data property of the update event.
enum MessageEventType
Readonly dataOrder updates received from the WebSocket differ from orders retreived from the REST API in several ways.
undefined type indicating a KatanaPerpsOrderEventDataSystemFill
where the fills property will include a FillTypeSystem fill matching
KatanaPerpsOrderFillEventDataSystemtype property between these types and all the
others as shown in the example below. import { OrderEventType } from '@katanaperps/katana-perps-sdk';
// ...
const orderEventData = orderEvent.data
if (
orderEventData.type === OrderEventType.liquidation ||
orderEventData.type === OrderEventType.deleverage
) {
// orderEventData is of type KatanaPerpsOrderEventDataLiquidation | KatanaPerpsOrderEventDataDeleverage
} else {
// orderEventData is of type KatanaPerpsOrderEventDataGeneral
}
subscriptionWebsocket messages always include a type property which dictates the shape of itsdataproperty.typewill be the name of the subscription that the message correlates to.KatanaPerps<name>Eventinterface will document its provideddatashape and properties.subscriptionsproperty when dispatched.See
KatanaPerpsSubscriptionEventBase