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 KumaOrderEventDataSystemFill
where the fills property will include a FillTypeSystem fill matching
KumaOrderFillEventDataSystemtype property between these types and all the
others as shown in the example below. import { OrderEventType } from '@kumabid/kuma-sdk';
// ...
const orderEventData = orderEvent.data
if (
orderEventData.type === OrderEventType.liquidation ||
orderEventData.type === OrderEventType.deleverage
) {
// orderEventData is of type KumaOrderEventDataLiquidation | KumaOrderEventDataDeleverage
} else {
// orderEventData is of type KumaOrderEventDataGeneral
}
type KumaOrderEventData
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.Kuma<name>Eventinterface will document its provideddatashape and properties.subscriptionsproperty when dispatched.See
KumaSubscriptionEventBase