Bentrix Docs
HomePricingDashboard

Go: the workspace and its windows

Every method of client.Workspace in the Go SDK.

AppQuit#

Ask the person to close Bentrix · tool app_quit

scope: adminplan: freesince 1.0.0long work: answers a job

Asks the person, on a card in Bentrix's window naming this agent, to close Bentrix; Allow closes it as its Exit does, the workspace written first. Answers a job.

Declaration

client.Workspace
func (a *WorkspaceAPI) AppQuit(ctx context.Context) (*Job, error)

It takes no arguments.

Returns

(*Job, error) — job.Wait(ctx, time.Second/2) answers the result: this is long work, or work the person allows first, so the call answers at once with a job and its result comes when it ends, as maps and slices (any).

What it answers

Answers a job.

Example

client.Workspace.AppQuit(ctx)

AreaSwitch#

Show the laboratory or the real area · tool area_switch

scope: labplan: plussince 1.0.0

Switches the window between its two areas, the laboratory and real; each remembers its own last workbench. Answers the area and the workbench now shown.

Declaration

client.Workspace
func (a *WorkspaceAPI) AreaSwitch(ctx context.Context, args WorkspaceAreaSwitchArgs) (any, error)

Parameters

NameTypeWhat it is
Areastringrequired

Returns

(any, error) — the tool’s answer as maps and slices (any).

What it answers

Answers the area and the workbench now shown.

Example

client.Workspace.AreaSwitch(ctx, mcp.WorkspaceAreaSwitchArgs{Area: "…"})

CaptureGet#

Read a window's picture · tool capture_get

scope: readplan: freesince 3.2.0

Where a capture stands: waiting, failed with the reason, or taken — the picture as a base64 PNG, its size in pixels, the window's pixels per point, and every thing that window drew in that frame (tag, text, rectangle in points; times pixels_per_point is its place in the picture). The last eight are kept.

Declaration

client.Workspace
func (a *WorkspaceAPI) CaptureGet(ctx context.Context, args WorkspaceCaptureGetArgs) (any, error)

Parameters

NameTypeWhat it is
Captureint64requiredThe number screen_capture answered.
WithoutPicture*booloptionalLeave the picture out and answer only its size and the record (to measure, or to save a call's weight).

Returns

(any, error) — the tool’s answer as maps and slices (any).

What it answers

What the tool's description says.

Example

client.Workspace.CaptureGet(ctx, mcp.WorkspaceCaptureGetArgs{Capture: 1})

ClockSet#

Set the clock · tool clock_set

scope: labplan: plussince 1.0.0

Turns the clock's killzones on or off, as its own switch does. Answers the switch.

Declaration

client.Workspace
func (a *WorkspaceAPI) ClockSet(ctx context.Context, args WorkspaceClockSetArgs) (any, error)

Parameters

NameTypeWhat it is
KillzonesboolrequiredWhether the clock draws the killzones.

Returns

(any, error) — the tool’s answer as maps and slices (any).

What it answers

Answers the switch.

Example

client.Workspace.ClockSet(ctx, mcp.WorkspaceClockSetArgs{Killzones: true})

ClockWatch#

Watch a candle on the clock · tool clock_watch

scope: labplan: plussince 1.0.0

Adds an interval's candle countdown to the clock's watchlist, or takes it off, as the clock's own list does. Answers the watchlist.

Declaration

client.Workspace
func (a *WorkspaceAPI) ClockWatch(ctx context.Context, args WorkspaceClockWatchArgs) (any, error)

Parameters

NameTypeWhat it is
TimeframestringrequiredThe interval whose candle countdown the clock shows, as the menu writes it.
Onboolrequired

Returns

(any, error) — the tool’s answer as maps and slices (any).

What it answers

Answers the watchlist.

Example

client.Workspace.ClockWatch(ctx, mcp.WorkspaceClockWatchArgs{Timeframe: "H1", On: true})

DockSet#

Set a dock column · tool dock_set

scope: labplan: freesince 1.0.0

Folds or unfolds a column of the dock, sets its extent within its floor and ceiling, or collapses or opens one of its sections, as the column's fold, its edge and a section's caret do. Answers the dock.

Declaration

client.Workspace
func (a *WorkspaceAPI) DockSet(ctx context.Context, args WorkspaceDockSetArgs) (any, error)

Parameters

NameTypeWhat it is
EdgestringrequiredRight, left, top or bottom.
Collapsed*booloptional
Extent*float64optionalThe column's width (an edge column) or height (a top or bottom one), in points; held within the column's own floor and ceiling.
Folded*booloptionalThe column folded to its strip, or unfolded.
Section*int64optionalA section of the column, from 0, and whether it is collapsed to its header.

Returns

(any, error) — the tool’s answer as maps and slices (any).

What it answers

Answers the dock.

Example

client.Workspace.DockSet(ctx, mcp.WorkspaceDockSetArgs{Edge: "…"})

FavouriteSet#

Star a favourite · tool favourite_set

scope: labplan: plussince 1.0.0

Stars or unstars an interval, an indicator, a chart type, a drawing tool, a cursor or a template, as the stars in their menus do; the bar shows the starred ones. Answers the favourites.

Declaration

client.Workspace
func (a *WorkspaceAPI) FavouriteSet(ctx context.Context, args WorkspaceFavouriteSetArgs) (any, error)

Parameters

NameTypeWhat it is
FavouritestringrequiredThe favourite as it is saved: interval.H4, indicator.rsi, charttype.renko, tool.trend_line, cursor.crosshair — or template.<name>.
Starredboolrequired

Returns

(any, error) — the tool’s answer as maps and slices (any).

What it answers

Answers the favourites.

Example

client.Workspace.FavouriteSet(ctx, mcp.WorkspaceFavouriteSetArgs{Favourite: "…", Starred: true})

GetState#

Read the application's state · tool get_state

scope: readplan: freesince 1.0.0

Answers the application as the person sees it: the shown area, the selected workbench, every laboratory and real account with its workbenches - each at its own cursor, with its days, tick model, time zone, markets and whether it plays - and, at depth charts, each workbench's chart windows. Every node carries its uri.

Declaration

client.Workspace
func (a *WorkspaceAPI) GetState(ctx context.Context, args WorkspaceGetStateArgs) (any, error)

Parameters

NameTypeWhat it is
Depth*stringoptional

Returns

(any, error) — the tool’s answer as maps and slices (any).

What it answers

Recorded from a running Bentrix 0.1.382 on a laboratory of generated markets (long lists cut to their first rows):

{
  "accounts": [],
  "area": "laboratory",
  "laboratories": [
    {
      "benches": [
        {
          "bounds": {
            "from_ms": 1790812800000,
            "to_ms": 1793491200000
          },
          "charts": [
            {
              "market": "SYN-DOCS",
              "timeframe": "M1",
              "uri": "bentrix://lab/lab-1/bench/bench-2/chart/chart-3"
            },
            {
              "market": "SYN-DOCS2",
              "timeframe": "M1",
              "uri": "bentrix://lab/lab-1/bench/bench-2/chart/chart-4"
            }
          ],
          "cursor_ms": 1790812800000,
          "engine": "ready",
          "hidden_markets": [],
          "live": false,
          "markets": [
            "SYN-DOCS",
            "SYN-DOCS2"
          ],
          "name": "Run 1",
          "playing": false,
          "tick_model": "real",
          "uri": "bentrix://lab/lab-1/bench/bench-2",
          "zone": "utc"
        }
      ],
      "currency": "USD",
      "kind": "generated",
      "name": "Generated markets",
      "uri": "bentrix://lab/lab-1"
    }
  ],
  "selected": "bentrix://lab/lab-1/bench/bench-2"
}

Example

client.Workspace.GetState(ctx, mcp.WorkspaceGetStateArgs{})

LayoutGet#

Read the layout · tool layout_get

scope: readplan: freesince 1.0.0

Answers a workbench's chart windows - each one's uri, its rectangle as fractions of the chart area [x0, y0, x1, y1], its place in the stack and its state - and the dock's columns.

Declaration

client.Workspace
func (a *WorkspaceAPI) LayoutGet(ctx context.Context, args WorkspaceLayoutGetArgs) (any, error)

Parameters

NameTypeWhat it is
Bench*stringoptionalA workbench's uri; omitted, the one selected.

Returns

(any, error) — the tool’s answer as maps and slices (any).

What it answers

Recorded from a running Bentrix 0.1.382 on a laboratory of generated markets (long lists cut to their first rows):

{
  "bench": "bentrix://lab/lab-1/bench/bench-2",
  "dock": {
    "columns": [
      {
        "edge": "right",
        "extent": null,
        "folded": false,
        "sections": [
          {
            "active": "marketwatch",
            "collapsed": false,
            "tabs": [
              "marketwatch"
            ]
          }
        ]
      },
      {
        "edge": "left",
        "extent": null,
        "folded": false,
        "sections": []
      },
      {
        "edge": "top",
        "extent": null,
        "folded": false,
        "sections": []
      },
      "… 1 more"
    ]
  },
  "windows": [
    {
      "chart": "bentrix://lab/lab-1/bench/bench-2/chart/chart-4",
      "rect": [
        0.0662650614976883,
        0.10256410390138626,
        0.666265070438385,
        0.7025641202926636
      ],
      "state": "normal",
      "z": 0
    },
    {
      "chart": "bentrix://lab/lab-1/bench/bench-2/chart/chart-5",
      "rect": [
        0.0,
        0.0,
        0.6000000238418579,
        0.6000000238418579
      ],
      "state": "normal",
      "z": 1
    },
    {
      "chart": "bentrix://lab/lab-1/bench/bench-2/chart/chart-7",
      "rect": [
        0.0662650614976883,
        0.10256410390138626,
        0.666265070438385,
        0.7025641202926636
      ],
      "state": "maximized",
      "z": 2
    }
  ]
}

Example

client.Workspace.LayoutGet(ctx, mcp.WorkspaceLayoutGetArgs{})

LayoutSet#

Place a workbench's chart windows · tool layout_set

scope: labplan: freesince 1.0.0

Places a workbench's chart windows at the rectangles given as fractions of the chart area, as dragging their edges does; a window placed is no longer minimized or maximized. Answers the layout.

Declaration

client.Workspace
func (a *WorkspaceAPI) LayoutSet(ctx context.Context, args WorkspaceLayoutSetArgs) (any, error)

Parameters

NameTypeWhat it is
Benchstringrequired
Windowsanyrequired

Returns

(any, error) — the tool’s answer as maps and slices (any).

What it answers

Answers the layout.

Example

client.Workspace.LayoutSet(ctx, mcp.WorkspaceLayoutSetArgs{Bench: bench, Windows: "…"})

PanelDetach#

Take a panel into its own window · tool panel_detach

scope: labplan: freesince 1.0.0

Takes a docked panel into a window of its own, as its section header's Detach does: marketwatch, trade, clock, toolbox, charttype, indsettings, help, replay, datawindow, symbolinfo or alerts. Answers the dock.

Declaration

client.Workspace
func (a *WorkspaceAPI) PanelDetach(ctx context.Context, args WorkspacePanelDetachArgs) (any, error)

Parameters

NameTypeWhat it is
PanelstringrequiredMarketwatch, trade, clock, toolbox, charttype, indsettings, help, replay, datawindow, symbolinfo or alerts.

Returns

(any, error) — the tool’s answer as maps and slices (any).

What it answers

Answers the dock.

Example

client.Workspace.PanelDetach(ctx, mcp.WorkspacePanelDetachArgs{Panel: "…"})

PanelHide#

Hide a panel · tool panel_hide

scope: labplan: plussince 1.0.0

Hides Market Watch, the Alerts or Strategies panel, the selected workbench's Toolbox or the data window, as their toggles do. Answers whether it is shown.

Declaration

client.Workspace
func (a *WorkspaceAPI) PanelHide(ctx context.Context, args WorkspacePanelHideArgs) (any, error)

Parameters

NameTypeWhat it is
Panelstringrequired

Returns

(any, error) — the tool’s answer as maps and slices (any).

What it answers

Answers whether it is shown.

Example

client.Workspace.PanelHide(ctx, mcp.WorkspacePanelHideArgs{Panel: "…"})

PanelShow#

Show a panel · tool panel_show

scope: labplan: plussince 1.0.0

Shows Market Watch, the Alerts or Strategies panel, the selected workbench's Toolbox or the data window, as their toggles do. Answers whether it is shown.

Declaration

client.Workspace
func (a *WorkspaceAPI) PanelShow(ctx context.Context, args WorkspacePanelShowArgs) (any, error)

Parameters

NameTypeWhat it is
Panelstringrequired

Returns

(any, error) — the tool’s answer as maps and slices (any).

What it answers

Recorded from a running Bentrix 0.1.382 on a laboratory of generated markets (long lists cut to their first rows):

{
  "shown": true
}

Example

client.Workspace.PanelShow(ctx, mcp.WorkspacePanelShowArgs{Panel: "market_watch"})

ScreenCapture#

Take a picture of a window · tool screen_capture

scope: readplan: freesince 3.2.0

Asks the main window, or the window that draws a thing whose tag starts with holding, for a picture of its next frame. Nothing moves the pointer and no window is brought forward. Answers the capture's number; capture_get reads the picture. Refused while a real account's workbench is shown, unless the person gave this agent real.

Declaration

client.Workspace
func (a *WorkspaceAPI) ScreenCapture(ctx context.Context, args WorkspaceScreenCaptureArgs) (any, error)

Parameters

NameTypeWhat it is
Holding*stringoptionalThe window whose picture is taken: the one that draws a thing whose tag starts with this (indsettings. for an indicator's settings card, trade. for the trade panel), as the screen page names its rows. The main window when omitted.

Returns

(any, error) — the tool’s answer as maps and slices (any).

What it answers

Answers the capture's number; capture_get reads the picture.

Example

client.Workspace.ScreenCapture(ctx, mcp.WorkspaceScreenCaptureArgs{})

SelectBench#

Show a workbench · tool select_bench

scope: labplan: plussince 1.0.0

Selects a workbench, which moves the person's own selection: the window then shows it. A workbench left behind while playing keeps playing or pauses, as leave says. Answers the workbench now shown.

Declaration

client.Workspace
func (a *WorkspaceAPI) SelectBench(ctx context.Context, args WorkspaceSelectBenchArgs) (any, error)

Parameters

NameTypeWhat it is
BenchstringrequiredThe workbench's uri, as get_state gives it.
Leave*stringoptionalWhat becomes of the workbench left behind, if it was playing.

Returns

(any, error) — the tool’s answer as maps and slices (any).

What it answers

Recorded from a running Bentrix 0.1.382 on a laboratory of generated markets (long lists cut to their first rows):

{
  "bounds": {
    "from_ms": 1790812800000,
    "to_ms": 1793491200000
  },
  "charts": [
    {
      "market": "SYN-DOCS",
      "timeframe": "M1",
      "uri": "bentrix://lab/lab-1/bench/bench-2/chart/chart-3"
    },
    {
      "market": "SYN-DOCS2",
      "timeframe": "M1",
      "uri": "bentrix://lab/lab-1/bench/bench-2/chart/chart-4"
    }
  ],
  "cursor_ms": 1790812800000,
  "engine": "none",
  "hidden_markets": [],
  "live": false,
  "markets": [
    "SYN-DOCS",
    "SYN-DOCS2"
  ],
  "name": "Run 1",
  "playing": false,
  "tick_model": "real",
  "uri": "bentrix://lab/lab-1/bench/bench-2",
  "zone": "utc"
}

Example

client.Workspace.SelectBench(ctx, mcp.WorkspaceSelectBenchArgs{Bench: bench})

UpdateInstallNow#

Ask the person to install the staged release · tool update_install_now

scope: adminplan: freesince 1.0.0long work: answers a job

When a release is downloaded and staged, asks the person on a card in Bentrix's window to restart now and install it, as the ready line's Restart now does. Answers a job; refused when nothing is staged.

Declaration

client.Workspace
func (a *WorkspaceAPI) UpdateInstallNow(ctx context.Context) (*Job, error)

It takes no arguments.

Returns

(*Job, error) — job.Wait(ctx, time.Second/2) answers the result: this is long work, or work the person allows first, so the call answers at once with a job and its result comes when it ends, as maps and slices (any).

What it answers

Answers a job; refused when nothing is staged.

Example

client.Workspace.UpdateInstallNow(ctx)

WindowPin#

Pin a window on top · tool window_pin

scope: labplan: freesince 1.0.0

Puts a window's pin in or out, as the pin on its bar does: a window with its pin in stands over Bentrix's other windows. Window is a panel's name or a chart's uri. Answers whether it is pinned.

Declaration

client.Workspace
func (a *WorkspaceAPI) WindowPin(ctx context.Context, args WorkspaceWindowPinArgs) (any, error)

Parameters

NameTypeWhat it is
WindowstringrequiredA panel's window (marketwatch, trade, clock, toolbox, charttype, indsettings, help, replay, datawindow, symbolinfo, alerts, downloads, strategies) or a chart's uri.
PinnedboolrequiredThe pin in (the window stands over Bentrix's others) or out.

Returns

(any, error) — the tool’s answer as maps and slices (any).

What it answers

Answers whether it is pinned.

Example

client.Workspace.WindowPin(ctx, mcp.WorkspaceWindowPinArgs{Window: "…", Pinned: true})

Export#

Export charts, templates and alerts · tool workspace_export

scope: readplan: freesince 1.14.0

Answers the document the File menu's Export writes: the workbench's charts, each with its market, interval and whole setup (type, studies, drawings), every saved indicator template, and every alert's market and specification - one JSON object (format bentrix-export) a person keeps as a file and workspace_import reads back.

Declaration

client.Workspace
func (a *WorkspaceAPI) Export(ctx context.Context, args WorkspaceExportArgs) (any, error)

Parameters

NameTypeWhat it is
BenchstringrequiredThe workbench whose charts are exported, as a bentrix://bench/... Uri.

Returns

(any, error) — the tool’s answer as maps and slices (any).

What it answers

Answers the document the File menu's Export writes: the workbench's charts, each with its market, interval and whole setup (type, studies, drawings), every saved indicator template, and every alert's market and specification - one JSON object (format bentrix-export) a person keeps as a file and workspace_import reads back.

Example

client.Workspace.Export(ctx, mcp.WorkspaceExportArgs{Bench: bench})

Import#

Import charts, templates and alerts · tool workspace_import

scope: labplan: freesince 1.14.0

Reads a bentrix-export document onto a workbench as the File menu's Import does: each template saved (under name (imported) when the name is taken, never over one), each chart of a market the workbench holds opened as a new window with its setup, each alert of such a market made anew on it. Answers a line each, done or not and why - a market the workbench does not hold, a part that did not read. A document of a later form is refused.

Declaration

client.Workspace
func (a *WorkspaceAPI) Import(ctx context.Context, args WorkspaceImportArgs) (any, error)

Parameters

NameTypeWhat it is
BenchstringrequiredThe workbench the charts open on and the alerts are made on, as a bentrix://bench/... Uri.
DocumentanyrequiredA document workspace_export answered, or a file the File menu's Export wrote.

Returns

(any, error) — the tool’s answer as maps and slices (any).

What it answers

Answers a line each, done or not and why - a market the workbench does not hold, a part that did not read.

Example

client.Workspace.Import(ctx, mcp.WorkspaceImportArgs{Bench: bench, Document: "…"})

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