Bentrix Docs
HomePricingDashboard

MCP tools: data

What a workbench's data reads as: bars by page, the elements of a chart built by price, the market's closures, and exports of bars, ticks and a learning dataset into files.

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

bars_get#

Read a workbench's bars

readplan: freesince 1.0.0reads only

Answers a workbench's bars of one market and interval, up to its cursor and never past it, the same candles its chart draws: the newest limit bars (at most 5000) before before_ms, oldest first. Earlier_before_ms asks for the page before.

ArgumentTypeRequiredDefaultWhat it is
before_msinteger——Only bars that opened before this instant (UTC milliseconds) — the page before a page.
benchstringyes—The workbench's uri, as get_state gives it.
limitinteger——How many, newest first counted, at most 5000.
symbolstringyes—One of the workbench's markets.
timeframestringyes—An interval's label: M1, H4, D1, a custom one such as M95.

MCP

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

Python

client.data
def bars_get(self, bench: str, symbol: str, timeframe: str, *, before_ms: Optional[int] = None, limit: Optional[int] = None) -> Dict[str, Any]

JavaScript

client.data
barsGet(args)

C#

client.Data
public Task<JsonNode?> BarsGet(string bench, string symbol, string timeframe, long? beforeMs = null, long? limit = null, CancellationToken ct = default)

Go

client.Data
func (a *DataAPI) BarsGet(ctx context.Context, args DataBarsGetArgs) (any, error)

Java

client.data
public Object barsGet(BarsGetArgs args)

C++

client.data
Json bars_get(const BarsGetArgs &args)

Julia

client.data
bars_get = (bench, symbol, timeframe; before_ms = nothing, limit = nothing)

R

client$data
`bars_get` = function(bench, symbol, timeframe, before_ms = NULL, limit = NULL)

Rust

client.data()
pub fn bars_get(&self, args: DataBarsGetArgs) -> Result<Value, Error>

bars_window#

Read several markets and frames at one instant

readplan: freesince 3.3.0reads only

Answers the closed bars of several of a workbench's markets in several frames (1-16: intervals, or a chart's elements as {chart}) cut at ONE instant: the cursor, or aligned_to an interval's last close, so every frame ends where that bar ended. A bar is a row when it closed at or before the cut; the newest limit rows per frame (200 when omitted, at most 5000; symbols x frames x limit at most 200000), oldest first, in columns time_ms, open, high, low, close, tick_volume, spread_points; nothing past the cursor. Include_forming hands an interval's forming bar beside its rows. A frame not ready refuses the call by name unless partial, which answers what is ready and lists not_ready. Zone cuts every interval frame in a time zone of the caller's choosing (a day at its midnight, H4 on its grid), folded from the workbench's finer candles, the screen untouched; time_ms stays the workbench's own stamps. The input a forecasting model reads.

ArgumentTypeRequiredDefaultWhat it is
aligned_tostring——Where every frame is cut: "cursor" (the default), or an interval's label — that interval's last close.
benchstringyes—The workbench's uri, as get_state gives it.
framesarray of string or objectyes—The frames, 1 to 16: intervals' labels, or {"chart": uri} for a chart's elements.
include_formingboolean——True hands each interval's bar still forming beside its rows, marked forming; it is never a row.
limitinteger——Closed bars per frame per market, newest kept: 200 when omitted, at most 5000. Symbols × frames × limit is at most 200000.
partialboolean——True answers what is ready and lists the rest in not_ready; omitted or false, a frame not ready refuses the call.
symbolstring——One market, in place of symbols.
symbolsarray of string——The markets, 1 to 64, each one of the workbench's.
zonestring——The time zone every interval frame is cut in, aligned_to read in too: a code from zones_list, an IANA name, system, or display (the workbench's charts' zone). Omitted, the workbench's own cut, as its venue reads it.

MCP

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

Python

client.data
def bars_window(self, bench: str, frames: List[Any], *, aligned_to: Optional[str] = None, include_forming: Optional[bool] = None, limit: Optional[int] = None, partial: Optional[bool] = None, symbol: Optional[str] = None, symbols: Optional[List[str]] = None, zone: Optional[str] = None) -> Dict[str, Any]

JavaScript

client.data
barsWindow(args)

C#

client.Data
public Task<JsonNode?> BarsWindow(string bench, object frames, string? alignedTo = null, bool? includeForming = null, long? limit = null, bool? partial = null, string? symbol = null, IReadOnlyList<string>? symbols = null, string? zone = null, CancellationToken ct = default)

Go

client.Data
func (a *DataAPI) BarsWindow(ctx context.Context, args DataBarsWindowArgs) (any, error)

Java

client.data
public Object barsWindow(BarsWindowArgs args)

C++

client.data
Json bars_window(const BarsWindowArgs &args)

Julia

client.data
bars_window = (bench, frames; aligned_to = nothing, include_forming = nothing, limit = nothing, partial = nothing, symbol = nothing, symbols = nothing, zone = nothing)

R

client$data
`bars_window` = function(bench, frames, aligned_to = NULL, include_forming = NULL, limit = NULL, partial = NULL, symbol = NULL, symbols = NULL, zone = NULL)

Rust

client.data()
pub fn bars_window(&self, args: DataBarsWindowArgs) -> Result<Value, Error>

calendar_closures#

A banking centre's holiday closures over a span

readplan: freesince 1.20.0reads onlyidempotent

The weekdays a centre's banks are shut between two days, as the clock's holidays computes them from each centre's rule: each closure's date, name, whether it stands in for a weekend holiday (substitute) and whether it is a day no rule gives - moved or declared by a government, from a table (declared). For each year: said (false before the centre's history, where nothing is answered rather than an empty year), and verified (checked against the authority's own list; every other year a projection by rule, blind to a day declared and not in the table). The US and the UK reach back to 2003 (Juneteenth from 2022), T2 to 2002, Japan to 2022, Sydney to 2023.

ArgumentTypeRequiredDefaultWhat it is
centre"japan" or stringyes—
fromstringyes—The first day, YYYY-MM-DD.
tostringyes—The last day, YYYY-MM-DD; at most 60 years after from.

MCP

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "calendar_closures",
    "arguments": {
      "centre": "japan",
      "from": "…",
      "to": "…"
    },
    "_meta": {
      "io.modelcontextprotocol/protocolVersion": "2026-07-28",
      "io.modelcontextprotocol/clientCapabilities": {}
    }
  }
}

Python

client.data
def calendar_closures(self, centre: Literal["japan", "us", "uk", "sydney", "t2"], from_: str, to: str) -> Dict[str, Any]

JavaScript

client.data
calendarClosures(args)

C#

client.Data
public Task<JsonNode?> CalendarClosures(string centre, string from, string to, CancellationToken ct = default)

Go

client.Data
func (a *DataAPI) CalendarClosures(ctx context.Context, args DataCalendarClosuresArgs) (any, error)

Java

client.data
public Object calendarClosures(CalendarClosuresArgs args)

C++

client.data
Json calendar_closures(const CalendarClosuresArgs &args)

Julia

client.data
calendar_closures = (centre, from, to)

R

client$data
`calendar_closures` = function(centre, from, to)

Rust

client.data()
pub fn calendar_closures(&self, args: DataCalendarClosuresArgs) -> Result<Value, Error>

chart_elements_get#

Read a chart's elements

readplan: freesince 1.4.0reads only

Reads the elements a chart built by price or activity (Renko, Range bars, Line break, Point & Figure, Kagi, Volume bars) drew last, up to its cursor, each read as a bar: its candle's open and its ordinal among that candle's elements — the address study_series_put names it by — its open, high, low and close, the volume of the candles it holds, and whether it is still forming. Refused on a chart drawn in time bars, which bars_get reads.

ArgumentTypeRequiredDefaultWhat it is
chartstringyes—The chart's uri.
limitinteger——The newest elements kept (at most 5000; 500 when omitted).

MCP

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

Python

client.data
def chart_elements_get(self, chart: str, *, limit: Optional[int] = None) -> Dict[str, Any]

JavaScript

client.data
chartElementsGet(args)

C#

client.Data
public Task<JsonNode?> ChartElementsGet(string chart, long? limit = null, CancellationToken ct = default)

Go

client.Data
func (a *DataAPI) ChartElementsGet(ctx context.Context, args DataChartElementsGetArgs) (any, error)

Java

client.data
public Object chartElementsGet(ChartElementsGetArgs args)

C++

client.data
Json chart_elements_get(const ChartElementsGetArgs &args)

Julia

client.data
chart_elements_get = (chart; limit = nothing)

R

client$data
`chart_elements_get` = function(chart, limit = NULL)

Rust

client.data()
pub fn chart_elements_get(&self, args: DataChartElementsGetArgs) -> Result<Value, Error>

export_bars#

Export a workbench's bars to a file

readplan: freesince 1.0.0reads only

Writes a workbench's bars of one market and interval, up to its cursor and never past it, as CSV into the export folder set on Settings > Agents, under this agent's name; answers the file's path, uri, rows and bytes, never the rows. For a span too long to read in pages.

ArgumentTypeRequiredDefaultWhat it is
benchstringyes—The workbench's uri, as get_state gives it.
from_msinteger——Only bars that opened at or after this instant (UTC ms); omitted, every bar held.
symbolstringyes—
timeframestringyes—An interval's label: M1, H4, D1, M95.

MCP

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

Python

client.data
def export_bars(self, bench: str, symbol: str, timeframe: str, *, from_ms: Optional[int] = None) -> Dict[str, Any]

JavaScript

client.data
exportBars(args)

C#

client.Data
public Task<JsonNode?> ExportBars(string bench, string symbol, string timeframe, long? fromMs = null, CancellationToken ct = default)

Go

client.Data
func (a *DataAPI) ExportBars(ctx context.Context, args DataExportBarsArgs) (any, error)

Java

client.data
public Object exportBars(ExportBarsArgs args)

C++

client.data
Json export_bars(const ExportBarsArgs &args)

Julia

client.data
export_bars = (bench, symbol, timeframe; from_ms = nothing)

R

client$data
`export_bars` = function(bench, symbol, timeframe, from_ms = NULL)

Rust

client.data()
pub fn export_bars(&self, args: DataExportBarsArgs) -> Result<Value, Error>

export_ticks#

Export a day of a workbench's ticks to a file

readplan: freesince 1.0.0reads only

Writes one market's ticks of one day that have happened at the workbench's cursor, never one past it, as CSV into the export folder under this agent's name; answers the file's path, uri, rows and bytes. Only a day the replay holds in memory is written.

ArgumentTypeRequiredDefaultWhat it is
benchstringyes—
daystring——The day, YYYY-MM-DD; omitted, the day at the workbench's cursor.
symbolstringyes—

MCP

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

Python

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

JavaScript

client.data
exportTicks(args)

C#

client.Data
public Task<JsonNode?> ExportTicks(string bench, string symbol, string? day = null, CancellationToken ct = default)

Go

client.Data
func (a *DataAPI) ExportTicks(ctx context.Context, args DataExportTicksArgs) (any, error)

Java

client.data
public Object exportTicks(ExportTicksArgs args)

C++

client.data
Json export_ticks(const ExportTicksArgs &args)

Julia

client.data
export_ticks = (bench, symbol; day = nothing)

R

client$data
`export_ticks` = function(bench, symbol, day = NULL)

Rust

client.data()
pub fn export_ticks(&self, args: DataExportTicksArgs) -> Result<Value, Error>

extract_dataset#

Extract a labelled dataset

readplan: freesince 1.14.0reads only

Writes a workbench's closed candles of one market up to its cursor - never past it, never the one still forming - with triple-barrier labels (the Python SDK's bentrix.data.triple_barrier) as CSV into the export folder under this agent's name: a position entered at the next candle's open (a long at its ask, a short at its bid), a target and a stop in points, a horizon in candles; label 1 the target met first, -1 the stop, 0 neither, and ambiguous where one candle touched both (the stop's). Answers the file's path, uri, rows and bytes.

ArgumentTypeRequiredDefaultWhat it is
benchstringyes—
from_msinteger——Only the candles from this open time on.
horizonintegeryes—The candles a position lives.
side"long" | "short"——Long (the default) or short.
stop_pointsnumberyes—The stop, in points from the entry.
symbolstringyes—
target_pointsnumberyes—The target, in points from the entry.
timeframestringyes—The interval (M1 to W1).

MCP

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "extract_dataset",
    "arguments": {
      "bench": "…",
      "horizon": 1,
      "stop_points": 1.0,
      "symbol": "…",
      "target_points": 1.0,
      "timeframe": "…"
    },
    "_meta": {
      "io.modelcontextprotocol/protocolVersion": "2026-07-28",
      "io.modelcontextprotocol/clientCapabilities": {}
    }
  }
}

Python

client.data
def extract_dataset(self, bench: str, symbol: str, timeframe: str, target_points: float, stop_points: float, horizon: int, *, from_ms: Optional[int] = None, side: Optional[Literal["long", "short"]] = None) -> Dict[str, Any]

JavaScript

client.data
extractDataset(args)

C#

client.Data
public Task<JsonNode?> ExtractDataset(string bench, string symbol, string timeframe, double targetPoints, double stopPoints, long horizon, long? fromMs = null, string? side = null, CancellationToken ct = default)

Go

client.Data
func (a *DataAPI) ExtractDataset(ctx context.Context, args DataExtractDatasetArgs) (any, error)

Java

client.data
public Object extractDataset(ExtractDatasetArgs args)

C++

client.data
Json extract_dataset(const ExtractDatasetArgs &args)

Julia

client.data
extract_dataset = (bench, symbol, timeframe, target_points, stop_points, horizon; from_ms = nothing, side = nothing)

R

client$data
`extract_dataset` = function(bench, symbol, timeframe, target_points, stop_points, horizon, from_ms = NULL, side = NULL)

Rust

client.data()
pub fn extract_dataset(&self, args: DataExtractDatasetArgs) -> Result<Value, Error>

extract_windows#

Write training windows

readplan: freesince 3.3.0reads only

Writes a window_spec's window at every close of the interval between from_ms and to_ms (the workbench's clock at most) as one CSV in the export folder under this agent's name, in long form - window, close_ms, role (input, or target for the bars of the interval after the close), symbol, frame, then the bar's time_ms, open, high, low, close, tick_volume, spread_points. Every input frame ends where its close is: a bar that closed later, or one still forming, is in no window; a target bar that has not closed by the clock is not written. Stride keeps one window in N. No row bound: the answer says the rows and bytes written.

ArgumentTypeRequiredDefaultWhat it is
benchstringyes—The workbench's uri.
from_msinteger——The first close written, UTC ms; omitted, the first the history allows a whole window at.
specanyyes—The window, as window_spec describes it.
strideinteger——One window every stride closes; 1 when omitted.
to_msinteger——The last close written, UTC ms, never past the workbench's clock; omitted, the clock.

MCP

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

Python

client.data
def extract_windows(self, bench: str, spec: Any, *, from_ms: Optional[int] = None, stride: Optional[int] = None, to_ms: Optional[int] = None) -> Dict[str, Any]

JavaScript

client.data
extractWindows(args)

C#

client.Data
public Task<JsonNode?> ExtractWindows(string bench, object spec, long? fromMs = null, long? stride = null, long? toMs = null, CancellationToken ct = default)

Go

client.Data
func (a *DataAPI) ExtractWindows(ctx context.Context, args DataExtractWindowsArgs) (any, error)

Java

client.data
public Object extractWindows(ExtractWindowsArgs args)

C++

client.data
Json extract_windows(const ExtractWindowsArgs &args)

Julia

client.data
extract_windows = (bench, spec; from_ms = nothing, stride = nothing, to_ms = nothing)

R

client$data
`extract_windows` = function(bench, spec, from_ms = NULL, stride = NULL, to_ms = NULL)

Rust

client.data()
pub fn extract_windows(&self, args: DataExtractWindowsArgs) -> Result<Value, Error>

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