Type alias IDEXOrderEventData

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 IDEXOrderEventDataSystemFill where the fills property will include a FillTypeSystem fill matching IDEXOrderFillEventDataSystem
  • 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 '@idexio/idex-sdk';

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


See