System property
Overview
System properties contain the values of properties that are defined on the side of the trading environment and relate to the system settings. System properties can change during an open session. You can subscribe to them to receive the change. The ISystemSettingsProvider interface provides access to the system settings and properties. System properties are available immediately after successful login into the trading environment. In this article, you will learn how to access this data.
You can use this class to get:
-
the size of one lot,
-
the currency symbol of the base currency of the system,
-
the base currency precision of the system,
-
the property of the system by name,
-
the report URL,
-
account URL,
-
push bind URL,
-
push 2 URL,
-
apply now URL,
-
trailing type,
-
user kind,
-
find out whether the password is expired.
Gets a specific property value
To get the a specific property value after login call the required 'get' method from ISystemSettingsProvider.
Getting the system base currency value.
const baseCurrency = session.getSystemSettingsProvider().getBaseCurrency();
const baseCurrency = session.getSystemSettingsProvider().getBaseCurrency();
const baseCurrency = session.getSystemSettingsProvider().getBaseCurrency();
Subscribe to the system property change event
The purpose of the ISystemSettingsProvider.subscribeSystemPropertyChange function is to subscribe to the system property change event. This function allows you to register an instance of the callback class that will handle system property change events. By subscribing to this event, you can receive notifications whenever a system property changes. The ISystemPropertyChangeListener interface is used to define the callback class for handling these events.
To subscribes to the system property change event use this code:
systemPropertyChangeListener = {
onChange: function (propertyName) {
console.log(propertyName + " was changed.");
}
};
session.getSystemSettingsProvider().subscribeSystemPropertyChange(systemPropertyChangeListener);
systemPropertyChangeListener = {
onChange: function (propertyName) {
console.log(propertyName + " was changed.");
}
};
session.getSystemSettingsProvider().subscribeSystemPropertyChange(systemPropertyChangeListener);
ISystemPropertyChangeListener systemPropertyChangeListener = new ISystemPropertyChangeListener() {
@Override
public void onChange(String propertyName) {
System.out.println(propertyName + " was changed.");
}
};
session.getSystemSettingsProvider().subscribeSystemPropertyChange(systemPropertyChangeListener);
Unubscribe from the system property change event
The purpose of the ISystemSettingsProvider.unsubscribeSystemPropertyChange() function is to allow the user to unsubscribe from the system property change event. This function is part of the ISystemPropertyChangeListener interface, which provides access to system settings and properties.
To unsubscribes to the system property change event use this code:
session.getSystemSettingsProvider().unsubscribeSystemPropertyChange(systemPropertyChangeListener);
session.getSystemSettingsProvider().unsubscribeSystemPropertyChange(systemPropertyChangeListener);
session.getSystemSettingsProvider().unsubscribeSystemPropertyChange(systemPropertyChangeListener);
| Table of Contents | |
|---|---|
| Advanced API Command used to get offers shapshots |
|
| Advanced API Command used to get connection status |
|
| Advanced These articles describes best practices when working with the API |
|
| Advanced API Command used to make changes to system properties |
|
| Advanced API Command used to make changes to trading properties |