Class TradingAccountsInfoMessage

java.lang.Object
velox.api.layer1.messages.TradingAccountsInfoMessage

public final class TradingAccountsInfoMessage extends Object
Message containing an account info for one of the accounts of the instrument. Each instrument can have multiple accounts, so this message can be sent multiple times for the same instrument.

This message should be sent by the provider (if any trading accounts are available) for each instrument alias the provider has subscription for, using Layer1ApiAdminListener.onUserMessage(Object).

If the provider knows the accounts list prior to any instrument subscription, it should send this message immediately after invoking Layer1ApiAdminListener.onLoginSuccessful() (without specifying any alias).
After any subscription to any instrument, the provider should send this message right after invoking Layer1ApiInstrumentAdapter.onInstrumentAdded(String, InstrumentInfo) (specifying the alias of the subscribed instrument and the account info this message relates to).

If the provider declares multi-account support with Layer1ApiProviderSupportedFeatures.multiAccountTrading - the provider should always send any multi-account aware data with a non-null accountId.
(e.g. order update info, execution info, status, balance info, etc.). The same is true about receiving order send/update message in the provider - it is guaranteed by the Bookmap that the accountId will always be non-null for send/update order messages. Even if the strategy is sending the order with null accountId, the Bookmap will set the accountId using the currently selected account of the TCP (trading control panel). The multi-account provider should treat any order send/update message with null accountId as an error and should not send it further.

If provider receives TradingOnlySubscribe message, it should send TradingAccountsInfoMessage in response for the instrument if it supports multi-account trading.
TradingOnlySubscribe could be requested for cross-trading, so the provider needs to report all accounts available for the instrument.
If the provider does not support Trading Only Subscription, all reported provider accounts will be available for each instrument when cross-trading is enabled.

This message can be received by the strategy in Layer1ApiAdminListener.onUserMessage(Object).
To handle this message you can use AccountListManager to track any account information.
You can also handle this message by yourself, if you don't want to use AccountListManager.

See Also:
  • Field Details

    • alias

      public final String alias

      Alias of the instrument the account relates to.

      Alias should be null (with isAdd=true) to notify about account information for the provider before any instrument is subscribed, if such information is available before the subscription to any instrument (i.e. just connected to the provider).

      If a message was previously sent with alias = null and isAdd = true before any instrument subscription, a message with alias = null and isAdd = false should be sent when disconnecting from the provider to indicate the removal of account information.

      Sending a message with alias = null and isAdd = false will remove the account information for the provider (for all aliases). This message can be sent to remove account information even if no prior message with alias = null and isAdd = true was sent during the connection.

      On provider disconnect, the provider should remove all account information for all aliases. This can be achieved by sending messages with alias = null and isAdd = false to remove accounts for all aliases, as described above.

      When unsubscribing from a single instrument, the provider should remove the account information only for that specific instrument by specifying the specific alias of the instrument in this message.

    • accountInfo

      public final AccountInfo accountInfo
      Account info for the account of the instrument.
    • isAdd

      public final boolean isAdd
      If true, account information for the instrument has just been added, if false - account is no longer available.
  • Constructor Details

    • TradingAccountsInfoMessage

      public TradingAccountsInfoMessage(String alias, AccountInfo accountInfo, boolean isAdd)
      Parameters:
      alias - alias of the instrument the account relates to. Can be null to notify about account information before any instrument is subscribed.
      accountInfo - account info for the account of the instrument
      isAdd - if true, account information for the instrument has just been added, if false - account is no longer available
  • Method Details