Skip to content

Trading Property

Overview

Trading properties contain the values of properties that are defined on the side of the trading environment. The ITradingSettingsProvider interface provides access to the trading settings and properties. Trading 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:

  • an array of cross symbols,

  • the whether the market is open,

  • a base unit size,

  • a minimum allowed amount of an order,

  • the pip cost object of a specific offer,

  • a maximum quantity in lots for an order for specified instrument and account,

  • the financial date,

  • the start of a financial date.

Gets a Specific Property Value

To get the specific property value after login call the required 'get' method from ITradingSettingsProvider.

Getting the trading base currency value.

const startFinancialDay = session.getTradingSettingsProvider().getStartFinancialDay('EUR/USD');
const startFinancialDay = session.getTradingSettingsProvider().getStartFinancialDay('EUR/USD');
const startFinancialDay = session.getTradingSettingsProvider().getStartFinancialDay('EUR/USD');

Gets current market status

To get the current market status after login call the required 'get' method from ITradingSettingsProvider.isMarketOpen().

const isMarketOpenFlag = session.getTradingSettingsProvider().isMarketOpen();
const isMarketOpenFlag= session.getTradingSettingsProvider().isMarketOpen();
const isMarketOpenFlag = session.getTradingSettingsProvider().isMarketOpen();

Subscribe to the market status change event

The market status may close during the open session. To check this, subscribe to the event using the method ITradingSettingsProvider.subscribeMarketOpenChange.

const marketOpenChangeListener : IMarketOpenChangeListener = {
    onChange: function (newValue: boolean): void {
        console.log(`Market status was changed. Current value ${newValue}`)
    }
}
session.getTradingSettingsProvider().subscribeMarketOpenChange(marketOpenChangeListener)
marketOpenChangeListener = {
    onChange: function (newValue) {
        console.log("Market status was changed. Current value ".concat(newValue));
    }
};
session.getTradingSettingsProvider().subscribeMarketOpenChange(marketOpenChangeListener);
IMarketOpenChangeListener marketOpenChangeListener = new IMarketOpenChangeListener() {
    @Override
    public void onChange(boolean newValue) {
        System.out.println("Market status was changed. Current value " + newValue);
    }
};
session.getTradingSettingsProvider().subscribeMarketOpenChange(marketOpenChangeListener);

Unsubscribe to the market status change event

To unsubscribes to the market status change event using the method ITradingSettingsProvider.unsubscribeMarketOpenChange().

session.getTradingSettingsProvider().unsubscribeMarketOpenChange(marketOpenChangeListener);
session.getTradingSettingsProvider().unsubscribeMarketOpenChange(marketOpenChangeListener);
session.getTradingSettingsProvider().unsubscribeMarketOpenChange(marketOpenChangeListener);
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