Skip to content

MngAddGateway

Creates a gateway and starts it asynchronously when enabled is true. Requires SESSION_ADMIN.

HTTP: POST /gateway

{
  "command":"MngAddGateway",
  "name":"Mock LP",
  "description":"Gateway transport test",
  "type":"MOCK",
  "binary":"mock/mock_gateway",
  "enabled":true,
  "bind_host":"127.0.0.1",
  "port":0,
  "provider_config":{
    "host":"127.0.0.1",
    "port":8090,
    "login":12323,
    "password":"Adcsew3#3",
    "symbols":[
      {
        "source":"EURUSD",
        "target":"EURUSD",
        "min_lot":0.01,
        "max_lot":100.0,
        "lot_step":0.01
      }
    ]
  },
  "startup_timeout_ms":10000,
  "heartbeat_interval_ms":1000,
  "heartbeat_timeout_ms":5000,
  "restart_enabled":true,
  "restart_initial_delay_ms":500,
  "restart_max_delay_ms":10000
}

The response contains the created gateway object with its assigned id and timestamps. name, type, binary, and the provider_config object are required. The server does not impose an LP-specific schema on provider_config; its contract belongs to the selected adapter. port is optional and defaults to 0, which selects a free loopback port whenever the process starts. A non-zero fixed port must be unique. bind_host defaults to 127.0.0.1.

type and binary must identify an entry returned by MngGetAvailableGateways. Binary and type are intentionally not unique across configurations: create separate configurations with unique names to connect the same adapter to multiple LP accounts. Auto-port instances receive independent runtime ports.

An HTTP success means that the configuration was accepted. Use MngGetGatewayRuntime to confirm that the asynchronous startup reached READY.

Quote and execution mappings are added separately after gateway creation with MngAddGatewaySymbolMapping; they are not part of provider_config.

For the MOCK adapter, host and password must be non-empty strings and login must be a positive integer. Provider port is optional and may be omitted, null, or 0; a positive value must not exceed 65535. Optional simulate_failure: true makes the mock report MOCK_CONNECT_FAILED.

symbols is required by the MOCK adapter and must contain at least one specification. source is the server symbol and must be unique within the gateway instance; target is the provider symbol. Both names must be non-empty. Limits must satisfy min_lot > 0, max_lot >= min_lot, and lot_step > 0. The adapter returns the validated list with its READY state; that confirmed list is available through the runtime methods. These adapter specifications are independent from server-side bidirectional symbol mapping records.