Async Messages

Note

For a more in depth documentation, you should check the comments from the protobuf file.

OrderEntryNotification

The Binary Order Routing API supports one type of asynchronous message - OrderEntryNotification. When the client successfully logs into the Order Entry account, the server begins sending an asynchronous message stream of type OrderEntryNotification. Each message contains one of the following fields with updated information (order, invoice, net position):

  • order

  • netPosition

  • accountInformation

  • textNotification

  • accountStatusUpdate

  • connectionStatusUpdateNotification

You can subscribe to handle each notification, for better understanding of what types of notification server sent and their purpose, we will consider each separately with examples of answers:

OETextNotification

Need to get a more detailed information, about action that happens in Binary Order Routing API, on server side generates a message with description of action, their type, account id, reason, etc.

Response example

const OETextNotification = {
  textNotification: {
      title: "username@SIM1(qstch1-fcmdb02:7008) Error Message",
      body: "Cancel/replace order rejected\nInvalid price: 589.625\nAccount #297999"
  }
}

Order

Contain a order data, send each time, when place, cancel, replace order or order was filled. Each Order notification accompanied by OETextNotification, with text, that explain, which action is happened (filling order, rejecting, placing, .etc)

Response example

const Order = {
   order: {
      orderUpdateType: "ORDER_UPDATE",
      oeProvider: "QOR",
      orderNumber: "115332",
      accountNumber: "297999",
      salesCode: "TSTSC",
      enteredBy: "dnahernyak",
      status: "New Order",
      orderDate: "1639052460612",
      side: "SELL",
      quantity: "1.0",
      contract: "ZCZ21",
      price: 588.75,
      lastTick: "588^2",
      session: "ELECTRONIC",
      orderType: "LMT_ORDER_TYPE",
      limit: "NaN",
      lifeTime: "DAY_ORDER_LIFE_TIME"
  }
}

AccountStatus

Sends, when user make login in OrderEntry account, switch account, logout. Contain a current Order Entry Account and Order Entry provider.

Response example

const AccountStatus = {
  oeAccount: {
      accountId: "17013",
      accountName: "[TC17] COTIUC, SERGHEI"
  },
  orderEntryProvider: "QOR"
}

NetPosition

Contain a data about updated NetPosition, that we are interested.

Response example

const NetPosition = {
  netPosition: {
      positionId: "5725094A96385855222547294B370A87",
      accountNumber: "297999",
      contract: "6BZ21",
      profitLoss: 255242.76562499945,
      childPositions: [
          {
              positionUpdateType: "PROFIT_LOSS_UPDATE",
              positionId: "52956491B14926A347E8797929A3D3AB",
              accountNumber: "297999",
              contract: "6BZ21",
              profitLoss: 61626.18124999934,
              positionKind: "OPEN",
              currencyId: "RUB"
          }
      ]
  }
}

AccountInformation

Sends each time, when AccountInformation fields are changin.

Response example

const AccountInformation = {
  oeProvider: "QOR",
  accountId: "297999",
  currencyId: "RUB",
  initialMargin: 1364679.591,
  maintenanceMargin: 1240617.81,
  initialMarginIncludingOrders: 1488152.704,
  maintenanceMarginIncludingOrders: 1352832.6475,
  startOfTheDayAccountBalance: 6320985.269535,
}

ConnectionStatusUpdateNotification

Sends, when connection with server troubles happens. List of all posible values listed in OEConnectionUpdateNotification enumeration.