Type alias KatanaPerpsOrderEventData

Order updates received from the WebSocket differ from orders retreived from the REST API in several ways.

  • In addition to the order types received when getting orders from the REST API, WebSocket update events may also provide the following undefined type indicating a KatanaPerpsOrderEventDataSystemFill where the fills property will include a FillTypeSystem fill matching KatanaPerpsOrderFillEventDataSystem
  • It is best to narrow on the type property between these types and all the others as shown in the example below.
    • This is made easiest by using the OrderType enum as shown.

Example

 import { OrderType } from '@katanaperps/katana-perps-sdk';

if (!orderEventData.type) {
// orderLong is of type IKatanaPerpsOrderEventDataSystemFill
} else {
// orderLong is of type KatanaPerpsOrderEventDataGeneral
switch(orderEventData.type) {
case OrderType.fill:
break;
// ...etc
}
}


See