Skip to main content
Version: latest

User accounts

Overview

The Account Manager is designed to display the trading data of a particular user account. You can implement the logic to allow users to create and log into their broker accounts.

info

Creating broker accounts, handling authentication and authorization processes should be implemented on your backend side. Your backend server should also process users' trades and provide the library with users' data through the Broker API. The library only displays users' trading data and notifies your Broker API implementation about user actions.

On startup, the library calls accountsMetainfo to get the information about accounts of a particular user. This method should return an array that contains an ID and name for each account.

In general, the user login process looks as follows:

  1. A user logs into their broker account. Note that the library does not provide any login dialogs, you should implement them on your side.
  2. Your backend server prepares the user's data and provides a response to your Broker API implementation with updated information.
  3. Your Broker API implementation calls the currentAccountUpdate method to notify the library about changes in account details.
  4. The library calls the accountsMetainfo and currentAccount methods.

Multiple accounts

Users can have multiple accounts and switch between them using the drop-down menu in the Account Manager.

Drop-down menu for selecting multiple accounts

This menu appears automatically when accountsMetainfo returns an array of objects. When users switch accounts, the library calls the setCurrentAccount method, providing your backend server with the ID of the requested account. See the CodePen example below.