class O2GMargin
Brief
The class provides access to the margin policy and minimal margin requirements of the three-level margin policy.
Details
To get an instance of the class, use the
O2GTradingSettingsProvider
.getMargins
method.
Margin Policy and Margin Requirements
The margin policy of an account is defined in the user trading agreement. There are two types of the margin policy:
one-level margin policy;
three-level margin policy.
Different accounts may have different types of the margin policy.
To find out your margin policy, use the is3LevelMargin method of this class.
The minimal margin requirements of an account define the amount of funds required to open or maintain a one-lot position of an instrument. The size of one lot can be obtained by calling the O2GTradingSettingsProvider.getBaseUnitSize method.
The margin requirements of the three-level margin policy can be obtained by using the following methods of the O2GMargin
class:
Level |
Purpose |
|
Liquidation (margin call) |
Prevent a liquidation of a one-lot position |
|
Maintenance |
Maintain a one-lot position |
|
Entry |
Open a one-lot position |
The minimal margin requirements of the one-level margin policy can be obtained by calling the
O2GTradingSettingsProvider.getMMR method.
If you use the preceding methods for the one-level margin policy, the returned value is identical for all the methods.
Example
Get margin policy and margin requirements [hide]
// Get margin requirements 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("\tMarginLMR = " + margin.getLMR() + "\n\tMarginLMMR = " + margin.getMMR() + "\n\tMarginEMR = " + margin.getEMR() + "\n\tMargin3Level " + margin.is3LevelMargin()); }
The namespace is com.fxcore2
.
Public Methods | |
Gets entry margin requirements. |
|
Gets liquidation margin requirements. |
|
Gets maintenance margin requirements. |
|
Gets a flag indicating that the margin policy is of the three-level type. |