SDKs
JavaScript/Typescript
User Methods
Accounts
Passwords

Account Credentials

The account credentials are used by the user (or account holder) in order to operate directly on the relevant trading platform (MetaTrader, TradeLocker, etc...).

It is important to note that these credentials are not used to authenticate to the TradrAPI platform, but rather to the trading platform in which the account resides.

⚠️

Account credentials are only available for hybrid or limited accounts!

These credentials are not required if the account holder is operating though TradrAPI. Accounts may hold up to 3 sets of credentials:

  • Master The master password of the account.
  • ReadOnly (investor) A readonly access password
  • Phone A password for phone access

The availability of these credentials ultimately depends on the trading platform in which the account resides.

⚠️

Credential type Master is available for all exchanges, ReadOnly is only available in MetaTrader

⚠️

In cTrader, only the account's FIX password can be reset via API. The account's cTrader password must be reset manually by the account holder.

Auto Generated Passwords

TradrAPI will automatically generate the required passwords for the account holder if they are not provided during the account creation process. These credentials will be generated using the rules listed below.

Fetching Credentials

Account credentials may be retrieved by fetching the account object and accessing the credentials property. For more information please refer to the Account documentation.

Updating Account Passwords

Account credentials may be updated by calling the updatePassword method on the account object and passing the new password as a parameter.

Note that the passwords for credential types can be updated in a single call, however this is not required and a single password may be updated if needed.

const done: boolean = await tradrApi.accounts.updatePassword({
  accountId: 1010000123,
  password: '_@eW23fq12',
  readonlyPassword: 'Hydh3kM&',
  phonePassword: '_Hdyh*jdjn3d',
});

Password Requirements

The password requirements for each credential type are as follows:

  • Minimum of 8 characters.
  • Must contain a number.
  • Must contain an uppercase letter.
  • Must contain a character in (!@#$%^~*_.).

A valid regular expression for this password requirement is:

^(?=(.*[a-z])+)(?=(.*[A-Z])+)(?=(.*[0-9])+)(?=(.*[!@#$%^~*_.])+).{8,}$