class O2GTradingSettingsProvider

Brief

The class provides access to a set of rules that an order must satisfy.

Details

The set of rules depends on an instrument and on an account used for trading.
To get an instance of the O2GTradingSettingsProvider class, use the O2GLoginRules.getTradingSettingsProvider method. For example,

O2GTradingSettingsProvider provider = loginRules.getTradingSettingsProvider();

Example

Get minimumum quantity, maximum quantity and base unit size [hide]

    // Get Trading settings
    public static void getTradingSettings(O2GSession session) {
        O2GAccountRow account = null;
        O2GLoginRules loginRules = session.getLoginRules();
        O2GTradingSettingsProvider provider = loginRules.getTradingSettingsProvider();
        O2GResponseReaderFactory factory = session.getResponseReaderFactory();
        if (factory == null) {
            return;
        }
        O2GResponse accountsResponse = loginRules.getTableRefreshResponse(O2GTableType.ACCOUNTS);
        O2GAccountsTableResponseReader accountsReader = factory.createAccountsTableReader(accountsResponse);
        for (int i = 0; i < accountsReader.size(); i++) {
            account = accountsReader.getRow(i);
            if (account.getAccountKind().equals("32")) {
               System.out.println("AccountID = " + account.getAccountID());
               break;
            }
        }
        System.out.println("MaxQuantity  =" + provider.getMaxQuantity (mInstrument,account));
        System.out.println("MinQuantity  =" + provider.getMinQuantity (mInstrument,account));
        System.out.println("BazeUnitSize =" + provider.getBaseUnitSize(mInstrument,account));
    }

The namespace is com.fxcore2.

Public Methods

getBaseUnitSize

Gets the size of one lot.

getCondDistEntryLimit

Gets the minimal allowed distance between the price of an entry limit order and the current market price or between the prices of ELS primary and secondary orders.

getCondDistEntryStop

Gets the minimal allowed distance between the price of an entry stop order and the current market price or between the prices of ELS primary and seconary orders.

getCondDistLimitForTrade

Gets the minimal allowed distance between the price of a limit order and the market price, at which a position can be closed at the momen,t or between the prices of a market/entry order and an associated limit order.

getCondDistStopForTrade

Gets the minimal allowed distance between the price of a stop order and the market price, at which a position can be closed at the moment, or between the prices of a market/entry order and an associated limit order.

getMargins

Gets an instance of the class that provides access to the margin policy and minimal margin requirements for the three-level margin policy.

getMarketStatus

Checks whether the trading in the instrument is opened or not.

getMaxQuantity

Gets the maximum allowed amount of an order.

getMaxTrailingStep

Gets the maximum allowed size of the market movement, after which an order must move following the market.

getMinQuantity

Gets the minimum allowed amount of an order.

getMinTrailingStep

Gets the minimum allowed size of the market movement, after which an order must move following the market.

getMMR

Gets the minimum margin requirements.

back