developers:websocket:accounts

This is an old revision of the document!


Account Feed

The Account Feed provides real-time updates on account status, positions, and order activity. Before receiving updates, accounts must first be subscribed.

The list of available accounts is included in the LoginResult message. To begin receiving updates, clients must send an AccountSubscribe message. Multiple accounts can be subscribed in a batch.

Example AccountSubscribe message for three accounts:

AccountSubscribe {

 Subscribe = AccountSubscribeType.Subscribe,
 SubscribeAllAccounts = false,
 AccountId = [
    "2a4b6c8d-9e10-11ea-bb37-0242ac130002",
    "3d5e7f9g-9e10-11ea-bb37-0242ac130003",
    "4f6h8j0k-9e10-11ea-bb37-0242ac130004"
 ]

}

Once subscribed, the server will begin streaming real-time updates for the selected accounts.

The server sends account-related updates as separate messages. These include:

  • AccountDetails – Provides static information about the account.
  • AccountUpdate – Sends real-time updates for account values.
  • AccountPosition – Reports current open positions.
  • AccountSnapshot – A batch message containing the latest state of the account.
  • OrderUpdateMulti – Sends batch updates for multiple orders.

Example message handling structure:

private void HandleAccountMessage(ServerMessage serverMessage) { switch (serverMessage.PayloadCase) { case ServerMessage.PayloadOneofCase.AccountSubscribeResponse: _logger.LogInformation(“Received account subscribe response. Success: {Success}”, serverMessage.AccountSubscribeResponse.Success); break;

cpp Copy Edit

  case ServerMessage.PayloadOneofCase.AccountDetails:
  case ServerMessage.PayloadOneofCase.AccountUpdate:
  case ServerMessage.PayloadOneofCase.AccountPosition:
  case ServerMessage.PayloadOneofCase.AccountSnapshot:
  case ServerMessage.PayloadOneofCase.OrderUpdateMulti:
      HandleAccountUpdate(serverMessage);
      break;
  case ServerMessage.PayloadOneofCase.MarketDetails:
      _logger.LogInformation("Received market details: {MarketId}", serverMessage.MarketDetails.MarketId);
      break;
  default:
      _logger.LogWarning("Unhandled Account Message: {PayloadCase}", serverMessage.PayloadCase);
      break;

} }

markdown Copy Edit

The AccountSnapshot message is a batch message that contains the latest state of an account. Instead of sending individual updates for each position or order, the snapshot provides a consolidated view of:

  • Account balances
  • Open positions
  • Working orders

Clients should process AccountSnapshot messages carefully as they represent the most recent known state of

  • developers/websocket/accounts.1741993202.txt.gz
  • Last modified: 2025/03/14 23:00
  • by chad