Add group
AddGroup¶
Description: Creates a new trading group with common settings, security-group overrides, and symbol-level margin overrides.
Request Parameters¶
| Name | Type | Required | Description |
|---|---|---|---|
| group | string | Yes | Unique group name |
| company | string | Yes | Company name |
| currency | string | Yes | Group base currency |
| enable | int | Yes | Enable flag |
| margin_call | int | Yes | Margin call level |
| margin_mode | int | Yes | Margin mode |
| margin_type | int | Yes | Margin type |
| margin_stopout | int | Yes | Margin stop-out level |
| default_leverage | int | Yes | Default leverage |
| default_deposit | double | Yes | Default deposit |
| secgroups | array | Yes | Security-group overrides |
| secmargins | array | Yes | Symbol margin overrides |
| credit | double | No | Credit value |
| use_swap | int | No | Swap enabled flag |
| hedge_prohibited | int | No | Hedge prohibited flag |
| stopout_skip_hedged | int | No | Skip stop-out for hedged positions |
| close_reopen | int | No | Close/reopen flag |
| interestrate | int | No | Interest rate |
| hedge_largeleg | int | No | Hedge large leg mode |
| archive_pending_period | int | No | Archive period for pending orders |
| maxpositions | int | No | Max positions |
secgroups Items¶
secgroups must be an array of objects. Each item must contain:
| Field | Type | Required |
|---|---|---|
| sec_index | int | Yes |
Supported optional fields:
- show
- trade
- execution
- comm_base
- comm_agent
- comm_type
- comm_lots
- comm_agent_type
- comm_tax
- lot_min
- lot_max
- lot_step
- spread_diff
- confirmation
- ie_deviation
- ie_quick_mode
- trade_rights
- autocloseout_mode
- freemargin_mode
secmargins Items¶
secmargins must be an array of objects. Each item must contain:
| Field | Type | Required |
|---|---|---|
| symbol | string | Yes |
Supported optional fields:
- swap_long
- swap_short
- margin_divider
- spread_enable
- spread
- spread_balance
Request Example¶
{
"group": "standard",
"company": "MyBroker",
"currency": "USD",
"enable": 1,
"margin_call": 50,
"margin_mode": 0,
"margin_type": 0,
"margin_stopout": 30,
"default_leverage": 100,
"default_deposit": 500.0,
"secgroups": [
{
"sec_index": 1,
"show": 1,
"trade": 1,
"execution": 0,
"lot_min": 100,
"lot_max": 100000,
"lot_step": 100
}
],
"secmargins": [
{
"symbol": "EURUSD",
"swap_long": -3.5,
"swap_short": 2.1,
"margin_divider": 1.0
}
]
}
Response Parameters¶
| Name | Type | Description |
|---|---|---|
| data | string | Returns "OK" on success |
Response Example¶
{
"data": "OK"
}
Validation Errors¶
If validation fails, the method returns HTTP 400-style error payload:
{
"error": "INVALID_DATA",
"message": "secgroups must be an array"
}
If business validation fails in the backend, the method returns FormatErrorCode(ret) and FormatError(ret) from Core::AddGroup(...).