Bentrix Docs
HomePricingDashboard

MCP tools: trading

Orders and positions on a workbench: validated and previewed without sending, then sent — at market or pending — modified, trailed, closed, reversed and closed all; deals exported; and the mode an agent's REAL orders go under (confirmed by the person, or one-click within its caps).

Reached from a connected client as client.trade in Python, client.trade in JavaScript, client.trade() in Rust — each tool below shows its call in every language.

export_deals#

Export a workbench's deals to a file

readplan: freesince 1.0.0reads only

Writes every deal of the workbench's venue, oldest first, as its History tab lists them, as CSV into the export folder under this agent's name; answers the file's path, uri, rows and bytes.

ArgumentTypeRequiredDefaultWhat it is
benchstringyes—

MCP

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "export_deals",
    "arguments": {
      "bench": "…"
    },
    "_meta": {
      "io.modelcontextprotocol/protocolVersion": "2026-07-28",
      "io.modelcontextprotocol/clientCapabilities": {}
    }
  }
}

Python

client.trade
def export_deals(self, bench: str) -> Dict[str, Any]

JavaScript

client.trade
exportDeals(args)

C#

client.Trade
public Task<JsonNode?> ExportDeals(string bench, CancellationToken ct = default)

Go

client.Trade
func (a *TradeAPI) ExportDeals(ctx context.Context, args TradeExportDealsArgs) (any, error)

Java

client.trade
public Object exportDeals(ExportDealsArgs args)

C++

client.trade
Json export_deals(const ExportDealsArgs &args)

Julia

client.trade
export_deals = (bench)

R

client$trade
`export_deals` = function(bench)

Rust

client.trade()
pub fn export_deals(&self, args: TradeExportDealsArgs) -> Result<Value, Error>

order_close#

Close a position or cancel an order

labplan: plussince 1.0.0destructive

Closes a position (all of it, or volume lots of it) or cancels a pending order on a laboratory or paper workbench, as the Toolbox's Close does; a close is never refused for being a close. Answers the book. On a real account it goes through the account's agents' mode: proposed in the trade panel for the person's Send (outcome awaiting_person), or under the person's One-click, with real:send, sent as their One-click sends (outcome sent); refused expired past its validity and refused_by_cap past the account's caps.

ArgumentTypeRequiredDefaultWhat it is
benchstringyes—
ticketintegeryes—
volumenumber——Lots to close; absent closes all of it (a pending order is cancelled).

MCP

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "order_close",
    "arguments": {
      "bench": "…",
      "ticket": 1
    },
    "_meta": {
      "io.modelcontextprotocol/protocolVersion": "2026-07-28",
      "io.modelcontextprotocol/clientCapabilities": {}
    }
  }
}

Python

client.trade
def order_close(self, bench: str, ticket: int, *, volume: Optional[float] = None) -> Dict[str, Any]

JavaScript

client.trade
orderClose(args)

C#

client.Trade
public Task<JsonNode?> OrderClose(string bench, long ticket, double? volume = null, CancellationToken ct = default)

Go

client.Trade
func (a *TradeAPI) OrderClose(ctx context.Context, args TradeOrderCloseArgs) (any, error)

Java

client.trade
public Object orderClose(OrderCloseArgs args)

C++

client.trade
Json order_close(const OrderCloseArgs &args)

Julia

client.trade
order_close = (bench, ticket; volume = nothing)

R

client$trade
`order_close` = function(bench, ticket, volume = NULL)

Rust

client.trade()
pub fn order_close(&self, args: TradeOrderCloseArgs) -> Result<Value, Error>

order_close_all#

Close every position

labplan: plussince 1.1.0destructive

Closes every open position on a workbench, or every one of one market, as the trade panel's Close all does; pending orders stay. Answers the book. On a real account it goes through the account's agents' mode: proposed in the trade panel for the person's Send (outcome awaiting_person), or under the person's One-click, with real:send, sent as their One-click sends (outcome sent).

ArgumentTypeRequiredDefaultWhat it is
benchstringyes—
symbolstring——One market's positions only; absent closes every position on the workbench.

MCP

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "order_close_all",
    "arguments": {
      "bench": "…"
    },
    "_meta": {
      "io.modelcontextprotocol/protocolVersion": "2026-07-28",
      "io.modelcontextprotocol/clientCapabilities": {}
    }
  }
}

Python

client.trade
def order_close_all(self, bench: str, *, symbol: Optional[str] = None) -> Dict[str, Any]

JavaScript

client.trade
orderCloseAll(args)

C#

client.Trade
public Task<JsonNode?> OrderCloseAll(string bench, string? symbol = null, CancellationToken ct = default)

Go

client.Trade
func (a *TradeAPI) OrderCloseAll(ctx context.Context, args TradeOrderCloseAllArgs) (any, error)

Java

client.trade
public Object orderCloseAll(OrderCloseAllArgs args)

C++

client.trade
Json order_close_all(const OrderCloseAllArgs &args)

Julia

client.trade
order_close_all = (bench; symbol = nothing)

R

client$trade
`order_close_all` = function(bench, symbol = NULL)

Rust

client.trade()
pub fn order_close_all(&self, args: TradeOrderCloseAllArgs) -> Result<Value, Error>

order_market#

Send a market order

labplan: plussince 1.0.0destructive

Sends a market order on a laboratory or paper workbench through the trade panel's own door; it fills on the workbench's next tick. Refused in the venue's own words where a press would be (a closed market, the stops level, the trade mode). Answers the book and the venue's last answer. On a real account it goes through the account's agents' mode: proposed in the trade panel for the person's Send (outcome awaiting_person), or under the person's One-click, with real:send, sent as their One-click sends (outcome sent); refused expired past its validity and refused_by_cap past the account's caps.

ArgumentTypeRequiredDefaultWhat it is
benchstringyes—
side"buy" | "sell"yes—
slnumber——The stop, a price; absent for none.
symbolstringyes—
tpnumber——The target, a price; absent for none.
volumenumberyes—

MCP

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "order_market",
    "arguments": {
      "bench": "…",
      "side": "buy",
      "symbol": "…",
      "volume": 1.0
    },
    "_meta": {
      "io.modelcontextprotocol/protocolVersion": "2026-07-28",
      "io.modelcontextprotocol/clientCapabilities": {}
    }
  }
}

Python

client.trade
def order_market(self, bench: str, symbol: str, side: Literal["buy", "sell"], volume: float, *, sl: Optional[float] = None, tp: Optional[float] = None) -> Dict[str, Any]

JavaScript

client.trade
orderMarket(args)

C#

client.Trade
public Task<JsonNode?> OrderMarket(string bench, string symbol, string side, double volume, double? sl = null, double? tp = null, CancellationToken ct = default)

Go

client.Trade
func (a *TradeAPI) OrderMarket(ctx context.Context, args TradeOrderMarketArgs) (any, error)

Java

client.trade
public Object orderMarket(OrderMarketArgs args)

C++

client.trade
Json order_market(const OrderMarketArgs &args)

Julia

client.trade
order_market = (bench, symbol, side, volume; sl = nothing, tp = nothing)

R

client$trade
`order_market` = function(bench, symbol, side, volume, sl = NULL, tp = NULL)

Rust

client.trade()
pub fn order_market(&self, args: TradeOrderMarketArgs) -> Result<Value, Error>

order_modify#

Move a stop, a target or a pending price

labplan: plussince 1.0.0

Sets a position's or a pending order's stop and target (and a pending order's trigger) on a laboratory or paper workbench, as a drag on its chart line does; the venue answers at once. Answers the book. On a real account it goes through the account's agents' mode: proposed in the trade panel for the person's Send (outcome awaiting_person), or under the person's One-click, with real:send, sent as their One-click sends (outcome sent); refused expired past its validity and refused_by_cap past the account's caps.

ArgumentTypeRequiredDefaultWhat it is
benchstringyes—
pricenumber——A pending order's new trigger; absent leaves it where it is.
slnumberyes—The new stop, a price; 0 removes it.
ticketintegeryes—A position's or a pending order's ticket.
tpnumberyes—The new target, a price; 0 removes it.

MCP

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "order_modify",
    "arguments": {
      "bench": "…",
      "sl": 1.0,
      "ticket": 1,
      "tp": 1.0
    },
    "_meta": {
      "io.modelcontextprotocol/protocolVersion": "2026-07-28",
      "io.modelcontextprotocol/clientCapabilities": {}
    }
  }
}

Python

client.trade
def order_modify(self, bench: str, ticket: int, sl: float, tp: float, *, price: Optional[float] = None) -> Dict[str, Any]

JavaScript

client.trade
orderModify(args)

C#

client.Trade
public Task<JsonNode?> OrderModify(string bench, long ticket, double sl, double tp, double? price = null, CancellationToken ct = default)

Go

client.Trade
func (a *TradeAPI) OrderModify(ctx context.Context, args TradeOrderModifyArgs) (any, error)

Java

client.trade
public Object orderModify(OrderModifyArgs args)

C++

client.trade
Json order_modify(const OrderModifyArgs &args)

Julia

client.trade
order_modify = (bench, ticket, sl, tp; price = nothing)

R

client$trade
`order_modify` = function(bench, ticket, sl, tp, price = NULL)

Rust

client.trade()
pub fn order_modify(&self, args: TradeOrderModifyArgs) -> Result<Value, Error>

order_pending#

Place a pending order

labplan: plussince 1.0.0

Places a limit, stop or stop-limit order on a laboratory or paper workbench through the trade panel's own door; the venue answers at once - it rests, or it is refused in its own words (the side rule, the stops level). Answers the book. On a real account it goes through the account's agents' mode: proposed in the trade panel for the person's Send (outcome awaiting_person), or under the person's One-click, with real:send, sent as their One-click sends (outcome sent); refused expired past its validity and refused_by_cap past the account's caps.

ArgumentTypeRequiredDefaultWhat it is
benchstringyes—
kind"buy_limit" | "sell_limit" | "buy_stop" | "sell_stop" | "buy_stop_limit" | "sell_stop_limit"yes—
pricenumberyes—The trigger price.
slnumber——
stop_limitnumber——A stop-limit's limit price; absent for every other kind.
symbolstringyes—
tpnumber——
volumenumberyes—

MCP

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "order_pending",
    "arguments": {
      "bench": "…",
      "kind": "buy_limit",
      "price": 1.0,
      "symbol": "…",
      "volume": 1.0
    },
    "_meta": {
      "io.modelcontextprotocol/protocolVersion": "2026-07-28",
      "io.modelcontextprotocol/clientCapabilities": {}
    }
  }
}

Python

client.trade
def order_pending(self, bench: str, symbol: str, kind: Literal["buy_limit", "sell_limit", "buy_stop", "sell_stop", "buy_stop_limit", "sell_stop_limit"], price: float, volume: float, *, sl: Optional[float] = None, stop_limit: Optional[float] = None, tp: Optional[float] = None) -> Dict[str, Any]

JavaScript

client.trade
orderPending(args)

C#

client.Trade
public Task<JsonNode?> OrderPending(string bench, string symbol, string kind, double price, double volume, double? sl = null, double? stopLimit = null, double? tp = null, CancellationToken ct = default)

Go

client.Trade
func (a *TradeAPI) OrderPending(ctx context.Context, args TradeOrderPendingArgs) (any, error)

Java

client.trade
public Object orderPending(OrderPendingArgs args)

C++

client.trade
Json order_pending(const OrderPendingArgs &args)

Julia

client.trade
order_pending = (bench, symbol, kind, price, volume; sl = nothing, stop_limit = nothing, tp = nothing)

R

client$trade
`order_pending` = function(bench, symbol, kind, price, volume, sl = NULL, stop_limit = NULL, tp = NULL)

Rust

client.trade()
pub fn order_pending(&self, args: TradeOrderPendingArgs) -> Result<Value, Error>

order_preview#

Preview an order

readplan: freesince 1.0.0reads only

Answers what a market order would cost on a laboratory or paper workbench now, from its venue: the fill price, the margin, the commissions, the spread on this size, the nightly swaps and what one point is worth on one lot. Sends nothing.

ArgumentTypeRequiredDefaultWhat it is
benchstringyes—
side"buy" | "sell"yes—
symbolstringyes—
volumenumberyes—

MCP

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "order_preview",
    "arguments": {
      "bench": "…",
      "side": "buy",
      "symbol": "…",
      "volume": 1.0
    },
    "_meta": {
      "io.modelcontextprotocol/protocolVersion": "2026-07-28",
      "io.modelcontextprotocol/clientCapabilities": {}
    }
  }
}

Python

client.trade
def order_preview(self, bench: str, symbol: str, side: Literal["buy", "sell"], volume: float) -> Dict[str, Any]

JavaScript

client.trade
orderPreview(args)

C#

client.Trade
public Task<JsonNode?> OrderPreview(string bench, string symbol, string side, double volume, CancellationToken ct = default)

Go

client.Trade
func (a *TradeAPI) OrderPreview(ctx context.Context, args TradeOrderPreviewArgs) (any, error)

Java

client.trade
public Object orderPreview(OrderPreviewArgs args)

C++

client.trade
Json order_preview(const OrderPreviewArgs &args)

Julia

client.trade
order_preview = (bench, symbol, side, volume)

R

client$trade
`order_preview` = function(bench, symbol, side, volume)

Rust

client.trade()
pub fn order_preview(&self, args: TradeOrderPreviewArgs) -> Result<Value, Error>

order_reverse#

Reverse a position

labplan: plussince 1.1.0destructive

Turns a position the other way at the same size, as the trade panel's Reverse does: on a hedging account it is closed and a market order of its size opened the other way; on a netting account one market order of twice its size. Answers the book. On a real account it goes through the account's agents' mode: proposed in the trade panel for the person's Send (outcome awaiting_person), or under the person's One-click, with real:send, sent as their One-click sends (outcome sent); refused expired past its validity and refused_by_cap past the account's caps.

ArgumentTypeRequiredDefaultWhat it is
benchstringyes—
ticketintegeryes—The position to turn the other way.

MCP

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "order_reverse",
    "arguments": {
      "bench": "…",
      "ticket": 1
    },
    "_meta": {
      "io.modelcontextprotocol/protocolVersion": "2026-07-28",
      "io.modelcontextprotocol/clientCapabilities": {}
    }
  }
}

Python

client.trade
def order_reverse(self, bench: str, ticket: int) -> Dict[str, Any]

JavaScript

client.trade
orderReverse(args)

C#

client.Trade
public Task<JsonNode?> OrderReverse(string bench, long ticket, CancellationToken ct = default)

Go

client.Trade
func (a *TradeAPI) OrderReverse(ctx context.Context, args TradeOrderReverseArgs) (any, error)

Java

client.trade
public Object orderReverse(OrderReverseArgs args)

C++

client.trade
Json order_reverse(const OrderReverseArgs &args)

Julia

client.trade
order_reverse = (bench, ticket)

R

client$trade
`order_reverse` = function(bench, ticket)

Rust

client.trade()
pub fn order_reverse(&self, args: TradeOrderReverseArgs) -> Result<Value, Error>

order_trail#

Trail a position's stop

labplan: plussince 1.0.0

Arms a trailing stop on a position, the trade panel's own: the stop follows the price at this distance in points, moved by Bentrix while it runs and stopping when Bentrix is shut. Answers the book and the trails armed. On a real account it goes through the account's agents' mode: proposed in the trade panel for the person's Send (outcome awaiting_person), or under the person's One-click, with real:send, armed (outcome sent).

ArgumentTypeRequiredDefaultWhat it is
benchstringyes—
pointsnumberyes—The trail's distance from the price, in the market's points.
ticketintegeryes—

MCP

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "order_trail",
    "arguments": {
      "bench": "…",
      "points": 1.0,
      "ticket": 1
    },
    "_meta": {
      "io.modelcontextprotocol/protocolVersion": "2026-07-28",
      "io.modelcontextprotocol/clientCapabilities": {}
    }
  }
}

Python

client.trade
def order_trail(self, bench: str, ticket: int, points: float) -> Dict[str, Any]

JavaScript

client.trade
orderTrail(args)

C#

client.Trade
public Task<JsonNode?> OrderTrail(string bench, long ticket, double points, CancellationToken ct = default)

Go

client.Trade
func (a *TradeAPI) OrderTrail(ctx context.Context, args TradeOrderTrailArgs) (any, error)

Java

client.trade
public Object orderTrail(OrderTrailArgs args)

C++

client.trade
Json order_trail(const OrderTrailArgs &args)

Julia

client.trade
order_trail = (bench, ticket, points)

R

client$trade
`order_trail` = function(bench, ticket, points)

Rust

client.trade()
pub fn order_trail(&self, args: TradeOrderTrailArgs) -> Result<Value, Error>

order_untrail#

Stop trailing a position's stop

labplan: plussince 1.0.0idempotent

Disarms a position's trailing stop; the stop stays where the trail last put it. Sends nothing, so on a real account it needs only real. Answers the book and the trails armed.

ArgumentTypeRequiredDefaultWhat it is
benchstringyes—
ticketintegeryes—

MCP

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "order_untrail",
    "arguments": {
      "bench": "…",
      "ticket": 1
    },
    "_meta": {
      "io.modelcontextprotocol/protocolVersion": "2026-07-28",
      "io.modelcontextprotocol/clientCapabilities": {}
    }
  }
}

Python

client.trade
def order_untrail(self, bench: str, ticket: int) -> Dict[str, Any]

JavaScript

client.trade
orderUntrail(args)

C#

client.Trade
public Task<JsonNode?> OrderUntrail(string bench, long ticket, CancellationToken ct = default)

Go

client.Trade
func (a *TradeAPI) OrderUntrail(ctx context.Context, args TradeOrderUntrailArgs) (any, error)

Java

client.trade
public Object orderUntrail(OrderUntrailArgs args)

C++

client.trade
Json order_untrail(const OrderUntrailArgs &args)

Julia

client.trade
order_untrail = (bench, ticket)

R

client$trade
`order_untrail` = function(bench, ticket)

Rust

client.trade()
pub fn order_untrail(&self, args: TradeOrderUntrailArgs) -> Result<Value, Error>

order_validate#

Ask what an order would meet, sending nothing

labplan: plussince 1.22.0reads only

Answers what an order of this volume would meet on a workbench, and sends and proposes nothing: on a real account its agents' mode (confirm or one_click), whether it would be sent, proposed in the panel's sheet for the person's Send, or refused and why (its validity, the volume cap, the orders and lots of the rolling hour), the caps and what of them is used, whether a proposal already waits, the daily loss cap; on a laboratory or paper workbench that Bentrix's venue answers it at send.

ArgumentTypeRequiredDefaultWhat it is
benchstringyes—
marketboolean—trueA market order (validity of a market order); false for a pending order, a modify or a close.
opensnumber——The lots it would open: the volume for a new order (the default), 0 for a close or a modify.
volumenumberyes—The lots the order would carry.

MCP

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "order_validate",
    "arguments": {
      "bench": "…",
      "volume": 1.0
    },
    "_meta": {
      "io.modelcontextprotocol/protocolVersion": "2026-07-28",
      "io.modelcontextprotocol/clientCapabilities": {}
    }
  }
}

Python

client.trade
def order_validate(self, bench: str, volume: float, *, market: Optional[bool] = None, opens: Optional[float] = None) -> Dict[str, Any]

JavaScript

client.trade
orderValidate(args)

C#

client.Trade
public Task<JsonNode?> OrderValidate(string bench, double volume, bool? market = null, double? opens = null, CancellationToken ct = default)

Go

client.Trade
func (a *TradeAPI) OrderValidate(ctx context.Context, args TradeOrderValidateArgs) (any, error)

Java

client.trade
public Object orderValidate(OrderValidateArgs args)

C++

client.trade
Json order_validate(const OrderValidateArgs &args)

Julia

client.trade
order_validate = (bench, volume; market = nothing, opens = nothing)

R

client$trade
`order_validate` = function(bench, volume, market = NULL, opens = NULL)

Rust

client.trade()
pub fn order_validate(&self, args: TradeOrderValidateArgs) -> Result<Value, Error>

trade_agent_mode#

Read a real account's Automations mode

readplan: freesince 1.0.0reads only

Answers, read only, a real account's Automations mode for this sitting - confirm or one_click - its caps (lots an order, orders and lots opened an hour), what of them this hour has used, a proposal standing, and whether this agent holds real and real:send. Never sets anything: the mode and the caps are the person's.

ArgumentTypeRequiredDefaultWhat it is
accountstringyes—The account's uri, as get_state gives it.

MCP

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "trade_agent_mode",
    "arguments": {
      "account": "…"
    },
    "_meta": {
      "io.modelcontextprotocol/protocolVersion": "2026-07-28",
      "io.modelcontextprotocol/clientCapabilities": {}
    }
  }
}

Python

client.trade
def agent_mode(self, account: str) -> Dict[str, Any]

JavaScript

client.trade
agentMode(args)

C#

client.Trade
public Task<JsonNode?> AgentMode(string account, CancellationToken ct = default)

Go

client.Trade
func (a *TradeAPI) AgentMode(ctx context.Context, args TradeAgentModeArgs) (any, error)

Java

client.trade
public Object agentMode(AgentModeArgs args)

C++

client.trade
Json agent_mode(const AgentModeArgs &args)

Julia

client.trade
agent_mode = (account)

R

client$trade
`agent_mode` = function(account)

Rust

client.trade()
pub fn agent_mode(&self, args: TradeAgentModeArgs) -> Result<Value, Error>

Bentrix 0.1.382Every number, name and default on these pages is read from the application itself.What is comingWhat changed