Bentrix Docs
HomePricingDashboard

Rust: forecast

Every method of client.forecast() in the Rust SDK.

chart_set_forecast#

Set how a chart draws forecasts · tool chart_set_forecast

scope: labplan: freesince 3.3.0

Sets how a chart draws a model's forecast: show, the ghost's opacity, uncertainty (fan, band, paths, off), the bands' opacity, the room on the right (forecast, shift_only, or N slots), how long a realized forecast stays (until_replaced, off, {horizons}, {bars}), a coarser interval spanned or by time, a finer one folded or by time, an element forecast on a time chart (auto, strip, by_expected_time, panel), a time forecast and another rule on a chart built by price (derived, strip, both), a profile (forecast_session, strip, off), true equivolume's widths (by_volume, median), the time past the newest bar (clock_time, session_time), the sampled paths drawn, and the models hidden on it (the legend's eye); models_per_market applies to every workbench. A field not named keeps its value. Answers the chart's forecast settings.

Declaration

client.forecast()
pub fn chart_set_forecast(&self, args: ForecastChartSetForecastArgs) -> Result<Value

Parameters

NameTypeWhat it is
chartimpl Into<String>requiredThe chart's uri.
arrival_marksbooloptionalA tick on the time axis at each forecast's arrival.
band_opacityf64optionalThe bands' opacity, 0.05 to 0.6.
coarserimpl Into<String>optionalA coarser interval: "spanned" or "by_time".
diffimpl Into<Value>optional**The diff view**{"a": model, "b": model} shades the gap between their closes step by step; "off" takes it away.
element_on_timeimpl Into<String>optionalAn element forecast (renko, kagi, …) on a time chart: "auto" (by expected time where every step says when it closes, else the strip), "strip", "by_expected_time" or "panel".
equivolume_widthimpl Into<String>optionalA step's width on true equivolume: "by_volume" (its own volume, else the window's median) or "median".
finerimpl Into<String>optionalA finer interval: "folded" or "by_time".
hiddenVec<String>optionalModels hidden on this chart, as the legend's eye hides them: the whole set.
journalimpl Into<String>optionalThe journal, for every workbench: laboratory_and_paper (the default), also_real, or off.
keep_after_realizedimpl Into<Value>optionalKeep after realized: "until_replaced", "off", {"horizons": n} or {"bars": n}.
models_per_marketi64optionalModels per market, for every workbench: 1 to 64.
on_profileimpl Into<String>optionalOn a profile: "forecast_session" (letters over the rows one session after the last), "strip" or "off".
opacityf64optionalThe ghost's opacity, 0.2 to 1.
other_ruleimpl Into<String>optionalAn element forecast of another type or rule on a chart built by price: "derived", "strip" or "both".
past_newestimpl Into<String>optionalPast the newest bar: "clock_time", or "session_time" (only the hours the market prints bars in).
read_at_anchorimpl Into<Value>optionalRead a forecast at its anchor, for every workbench: {"laboratory": bool, "paper_and_real": bool}; both off by default. A look-ahead: marked wherever it reads; on a live bench never the newest close.
readoutbooloptionalA step's figures beside the pointer and in the data window.
roomimpl Into<Value>optionalRoom on the right: "forecast" (as wide as the widest forecast), "shift_only", or a number of slots.
samples_drawni64optionalSampled paths drawn per step, 1 to 256.
showbooloptionalDraw forecasts on this chart.
time_on_elementsimpl Into<String>optionalA time forecast on a chart built by price: "derived" (through the chart's own rule), "strip" or "both".
traili64optionalThe trail: the forecasts each model put before the one standing, drawn faint - 0 (off) to 64.
uncertaintyimpl Into<String>optionalFan, band, paths or off.

Returns

Result<Value, Error> — the tool’s answer as a serde_json::Value.

What it answers

Answers the chart's forecast settings.

Example

client.forecast().chart_set_forecast(mcp::ForecastChartSetForecastArgs::new(chart.clone()))?

clear#

Remove forecasts from a workbench · tool forecast_clear

scope: labplan: plussince 3.3.0

Removes the forecasts of one model, one market, or all of them from the workbench, every arrival kept for them included, as the × on a forecast's legend row does. Answers how many (market, model) pairs were cleared.

Declaration

client.forecast()
pub fn clear(&self, args: ForecastClearArgs) -> Result<Value

Parameters

NameTypeWhat it is
benchimpl Into<String>requiredThe workbench's uri.
modelimpl Into<String>optionalOne model; omitted, every model.
symbolimpl Into<String>optionalOne market; omitted, every market.

Returns

Result<Value, Error> — the tool’s answer as a serde_json::Value.

What it answers

Answers how many (market, model) pairs were cleared.

Example

client.forecast().clear(mcp::ForecastClearArgs::new(bench.clone()))?

compare#

Set models' reports side by side · tool forecast_compare

scope: readplan: freesince 3.3.0

Forecast_report for several models on one market, a row each, over the same journal and the same bars. Unordered (by name) unless metric_order names a measure, then best first. A comparison is a laboratory's instrument: nothing here is published or ranked anywhere else.

Declaration

client.forecast()
pub fn compare(&self, args: ForecastCompareArgs) -> Result<Value

Parameters

NameTypeWhat it is
benchimpl Into<String>required
symbolimpl Into<String>required
lasti64optional
metric_orderimpl Into<String>optionalOrder the rows by this measure, best first (mae_close, rmse_close, mape_close, pinball_loss, crps ascending; direction_hit_rate descending). Omitted, by the model's name: no ranking is drawn unless asked.
modelsVec<String>optionalThe models; omitted, every model the journal holds on the market.

Returns

Result<Value, Error> — the tool’s answer as a serde_json::Value.

What it answers

What the tool's description says.

Example

client.forecast().compare(mcp::ForecastCompareArgs::new(bench.clone(), "SYN-DOCS"))?

diff#

Set two models' forecasts step by step · tool forecast_diff

scope: readplan: freesince 3.3.0

The two models' forecasts a reader at the workbench's clock sees on one market, step by step where their steps open at the same instant: each one's close and the difference (b minus a), and where their outermost bands overlap.

Declaration

client.forecast()
pub fn diff(&self, args: ForecastDiffArgs) -> Result<Value

Parameters

NameTypeWhat it is
benchimpl Into<String>required
symbolimpl Into<String>required
aimpl Into<String>required
bimpl Into<String>required

Returns

Result<Value, Error> — the tool’s answer as a serde_json::Value.

What it answers

What the tool's description says.

Example

client.forecast().diff(mcp::ForecastDiffArgs::new(bench.clone(), "SYN-DOCS", "…", "…"))?

ensemble_define#

Declare an ensemble of forecasts · tool forecast_ensemble_define

scope: labplan: freesince 3.4.0

Declares an ensemble on a workbench's market: its label, its members (models' labels), the rule its closes are combined by (mean, median, weighted with one weight a member) and the NAMED rule its bands are combined by - quantiles_averaged (each level's lo and hi averaged; the band claims no coverage of its own), members_pooled (the mixture of the members' samples, quantiles or band edges, its quantiles at each level; partly pooled where a member gave only a band), or none. Bentrix computes only what is declared: whenever a member's newest forecast arrives and every member stands at one anchor, the ensemble's forecast is put, authored ensemble:<id>, so its arrival is the latest of its members'; a member cleared takes it off with a sentence. Declaring an id again replaces it. Answers the ensemble.

Declaration

client.forecast()
pub fn ensemble_define(&self, args: ForecastEnsembleDefineArgs) -> Result<Value

Parameters

NameTypeWhat it is
benchimpl Into<String>required
symbolimpl Into<String>required
idimpl Into<String>requiredThe ensemble's label, as a model's: [a-z0-9_]{1,32}, none of its members.
membersVec<String>requiredThe members' model labels, at least two.
ruleimpl Into<String>requiredMean, median or weighted.
bandsimpl Into<String>optionalQuantiles_averaged (each level's edges averaged; the band claims no p), members_pooled (the mixture's quantiles) or none. Omitted: quantiles_averaged.
weightsVec<f64>optionalFor weighted: one weight a member, in the members' order.

Returns

Result<Value, Error> — the tool’s answer as a serde_json::Value.

What it answers

Answers the ensemble.

Example

client.forecast().ensemble_define(mcp::ForecastEnsembleDefineArgs::new(bench.clone(), "SYN-DOCS", "…", "…", "…"))?

ensemble_list#

List a workbench's ensembles · tool forecast_ensemble_list

scope: readplan: freesince 3.4.0

Answers the ensembles declared on a workbench: each one's label, market, members, rules, the latest member arrival its forecast was made from, and what it last said where none stands.

Declaration

client.forecast()
pub fn ensemble_list(&self, args: ForecastEnsembleListArgs) -> Result<Value

Parameters

NameTypeWhat it is
benchimpl Into<String>required

Returns

Result<Value, Error> — the tool’s answer as a serde_json::Value.

What it answers

Answers the ensembles declared on a workbench: each one's label, market, members, rules, the latest member arrival its forecast was made from, and what it last said where none stands.

Example

client.forecast().ensemble_list(mcp::ForecastEnsembleListArgs::new(bench.clone()))?

ensemble_remove#

Remove an ensemble · tool forecast_ensemble_remove

scope: labplan: freesince 3.4.0

Removes an ensemble from a workbench's market, and its forecast with it. Answers whether one was there.

Declaration

client.forecast()
pub fn ensemble_remove(&self, args: ForecastEnsembleRemoveArgs) -> Result<Value

Parameters

NameTypeWhat it is
benchimpl Into<String>required
symbolimpl Into<String>required
idimpl Into<String>required

Returns

Result<Value, Error> — the tool’s answer as a serde_json::Value.

What it answers

Answers whether one was there.

Example

client.forecast().ensemble_remove(mcp::ForecastEnsembleRemoveArgs::new(bench.clone(), "SYN-DOCS", "…"))?

eval_batch#

Run a batch of evaluation runs with ONNX models · tool forecast_eval_batch

scope: labplan: plussince 3.4.0

Runs one evaluation run per cell over the workbench's own history, each with an ONNX model from the models folder asked INSIDE the loop by Bentrix's built-in engine: at each close the window its manifest describes is cut there, the model run, its output put as that close's forecast, stamped close + latency, and scored as forecast_eval_close scores. The workbench's clock does not move. Answers each cell's report, or why it did not run, in the cells' order.

Declaration

client.forecast()
pub fn eval_batch(&self, args: ForecastEvalBatchArgs) -> Result<Value

Parameters

NameTypeWhat it is
benchimpl Into<String>required
cellsimpl Into<Value>requiredOne evaluation run each.

Returns

Result<Value, Error> — the tool’s answer as a serde_json::Value.

What it answers

Answers each cell's report, or why it did not run, in the cells' order.

Example

client.forecast().eval_batch(mcp::ForecastEvalBatchArgs::new(bench.clone(), "…"))?

eval_close#

End an evaluation run and report it · tool forecast_eval_close

scope: labplan: plussince 3.3.0

Ends an evaluation run: its report (forecast_report's measures over the run's forecasts against the workbench's history, each step only if it had not closed at its stamped arrival, the latency said) and its journal written as one JSON-lines file in the export folder under this agent's name. The bench's own journal is not touched.

Declaration

client.forecast()
pub fn eval_close(&self, args: ForecastEvalCloseArgs) -> Result<Value

Parameters

NameTypeWhat it is
evali64required

Returns

Result<Value, Error> — the tool’s answer as a serde_json::Value.

What it answers

What the tool's description says.

Example

client.forecast().eval_close(mcp::ForecastEvalCloseArgs::new(1))?

eval_make#

Start an evaluation run over history · tool forecast_eval_make

scope: labplan: plussince 3.3.0

Starts an evaluation run over the workbench's own history between from_ms and to_ms (its clock at most; the clock does not move): the closes of forecast_tf on the first market, one in stride. Forecast_eval_next hands the window cut at each close and scores the forecast handed back for the close before; forecast_eval_close answers the report. Each forecast's arrival is stamped close + latency (none, measured - this model's mean live latency on the bench's journal, 0 and said when it has none - or N ms), and a step it could already see is late and unscored, exactly as live. Over a span the workbench's laboratory does not hold nothing is made or fetched: the answer is an ask - which laboratory, the span, the days and markets downloaded, what MetaTrader will be asked - and a watch uri, and the person answers on one sheet in Bentrix's window (Make it and run, or No); forecast_eval_state and the event bentrix://forecasts/eval say what came of it. Answers the eval's id, the closes and what it runs on.

Declaration

client.forecast()
pub fn eval_make(&self, args: ForecastEvalMakeArgs) -> Result<Value

Parameters

NameTypeWhat it is
benchimpl Into<String>requiredThe workbench whose history the run walks; its clock does not move.
symbolsVec<String>requiredThe markets of each window, the first the forecast's.
framesVec<String>requiredThe frames of each window: intervals' labels.
forecast_tfimpl Into<String>requiredThe interval whose closes the run walks, and the forecast's.
from_msi64required
modelimpl Into<String>requiredThe model label the run's forecasts carry.
latencyimpl Into<Value>optionalThe latency each forecast is stamped with: "none", "measured" (this model's mean live latency on the bench's journal, the default), or a number of ms.
limiti64optionalClosed bars per frame in each window (200 when omitted).
retrainimpl Into<String>optionalWhen a retrain is due: "session" (each new day), "week", or a count of closes.
run_modelimpl Into<String>optional**A model of the models folder Bentrix runs at each close itself**the run is driven by Bentrix to its end, the model handed each window and its answer scored, its label the model's own; omitted, the caller drives the run with forecast_eval_next.
stridei64optionalOne close in N.
to_msi64optionalAt most the workbench's clock; omitted, the clock.

Returns

Result<Value, Error> — the tool’s answer as a serde_json::Value.

What it answers

Answers the eval's id, the closes and what it runs on.

Example

client.forecast().eval_make(mcp::ForecastEvalMakeArgs::new(bench.clone(), "…", "…", "…", 1, "…"))?

eval_next#

The next window of an evaluation run · tool forecast_eval_next

scope: labplan: plussince 3.3.0

Scores the forecast handed for the last window - checked as forecast_put checks it, its arrival stamped at that window's close plus the run's latency - and hands the window cut at the next close: close_ms, the window (bars_window's answer at that instant, nothing later), done once the closes are walked, scored (the forecasts recorded so far), and retrain_due where the run's retrain rule falls.

Declaration

client.forecast()
pub fn eval_next(&self, args: ForecastEvalNextArgs) -> Result<Value

Parameters

NameTypeWhat it is
evali64required
forecastimpl Into<Value>optionalThe forecast for the window handed last, as forecast_spec (its model and market the run's; its anchor the last closed bar of that window's close). Omitted for the first window, or to pass a close.

Returns

Result<Value, Error> — the tool’s answer as a serde_json::Value.

What it answers

What the tool's description says.

Example

client.forecast().eval_next(mcp::ForecastEvalNextArgs::new(1))?

eval_state#

Where an evaluation run or its ask stands · tool forecast_eval_state

scope: readplan: freesince 3.3.0

A run's closes walked and left, its forecasts recorded, its latency rule and retrain rule; or where an ask forecast_eval_make answered stands: asked (the sheet stands in Bentrix's window), confirmed (Make it and run pressed), made_laboratory (the workbench over the span is made and its days are downloading), started (with the eval to drive), declined (by the person - never a failure), or failed (with why). The person's press on the sheet is the one answer; no tool answers it. The event bentrix://forecasts/eval carries each move of an ask.

Declaration

client.forecast()
pub fn eval_state(&self, args: ForecastEvalStateArgs) -> Result<Value

Parameters

NameTypeWhat it is
askimpl Into<String>optionalOr an ask it answered (bentrix://ask/N), over days the workbench's laboratory did not hold.
evali64optionalA run forecast_eval_make started.

Returns

Result<Value, Error> — the tool’s answer as a serde_json::Value.

What it answers

What the tool's description says.

Example

client.forecast().eval_state(mcp::ForecastEvalStateArgs::new())?

get#

Read the forecasts on a workbench · tool forecast_get

scope: readplan: freesince 3.3.0

Answers the forecasts a reader at at_ms (the workbench's clock when omitted) sees on the workbench, by arrival - never one that arrived after that instant - each with its model, market, epoch, form, anchor, put_ms, steps' count, state (current, partly realized, realized), how many steps have closed, who put it and its colours; steps true hands the steps. Arrivals lists every arrival the workbench keeps per model.

Declaration

client.forecast()
pub fn get(&self, args: ForecastGetArgs) -> Result<Value

Parameters

NameTypeWhat it is
benchimpl Into<String>requiredThe workbench's uri.
at_msi64optionalThe instant to read at, UTC ms: what a reader at that instant saw. Omitted, the workbench's clock.
modelimpl Into<String>optionalOne model; omitted, every model.
stepsbooloptionalTrue hands each forecast's steps too.
symbolimpl Into<String>optionalOne market; omitted, every market.

Returns

Result<Value, Error> — the tool’s answer as a serde_json::Value.

What it answers

Answers the forecasts a reader at at_ms (the workbench's clock when omitted) sees on the workbench, by arrival - never one that arrived after that instant - each with its model, market, epoch, form, anchor, put_ms, steps' count, state (current, partly realized, realized), how many steps have closed, who put it and its colours; steps true hands the steps.

Example

client.forecast().get(mcp::ForecastGetArgs::new(bench.clone()))?

preset_apply#

Apply a forecast preset · tool forecast_preset_apply

scope: labplan: freesince 3.4.0

Applies a preset's look to a chart, or with all true to every chart of that chart's workbench, as the card's Preset row does; each chart keeps its Show and the models its legend hid. Answers the charts it was applied to.

Declaration

client.forecast()
pub fn preset_apply(&self, args: ForecastPresetApplyArgs) -> Result<Value

Parameters

NameTypeWhat it is
nameimpl Into<String>requiredThe preset: bentrix, quiet, or a name it was saved under.
chartimpl Into<String>requiredThe chart it is applied to; omitted with all true, every chart of the workbench the chart is on.
allbooloptional

Returns

Result<Value, Error> — the tool’s answer as a serde_json::Value.

What it answers

Answers the charts it was applied to.

Example

client.forecast().preset_apply(mcp::ForecastPresetApplyArgs::new("…", chart.clone()))?

preset_delete#

Delete a saved forecast preset · tool forecast_preset_delete

scope: labplan: freesince 3.4.0

Deletes a preset the person saved; Bentrix's own (bentrix, quiet) cannot be. Answers every preset's name left.

Declaration

client.forecast()
pub fn preset_delete(&self, args: ForecastPresetDeleteArgs) -> Result<Value

Parameters

NameTypeWhat it is
nameimpl Into<String>required

Returns

Result<Value, Error> — the tool’s answer as a serde_json::Value.

What it answers

Answers every preset's name left.

Example

client.forecast().preset_delete(mcp::ForecastPresetDeleteArgs::new("…"))?

preset_save#

Save a chart's forecast look as a preset · tool forecast_preset_save

scope: labplan: freesince 3.4.0

Saves a chart's forecast look - every row of its Forecast tab but Show and the models its legend hid - under a name, kept on this machine; the card's Preset row offers it beside Bentrix's own presets (bentrix, quiet). Saving a name again replaces it. Answers every preset's name.

Declaration

client.forecast()
pub fn preset_save(&self, args: ForecastPresetSaveArgs) -> Result<Value

Parameters

NameTypeWhat it is
chartimpl Into<String>requiredThe chart whose look is saved.
nameimpl Into<String>requiredThe preset's name, [a-z0-9_]{1,32}, not a built-in's (bentrix, quiet).

Returns

Result<Value, Error> — the tool’s answer as a serde_json::Value.

What it answers

Answers every preset's name.

Example

client.forecast().preset_save(mcp::ForecastPresetSaveArgs::new(chart.clone(), "…"))?

put#

Put a model's forecast on a workbench · tool forecast_put

scope: labplan: plussince 3.3.0

Hands over a forecast_spec: drawn on every chart of its market on the workbench from the instant it arrives, which Bentrix stamps as put_ms on the workbench's own clock (a laboratory's replay instant, a live bench's market clock) - no reader sees it before. Refused by name where it cannot be true (a high under its body, a band upside down, falling quantiles, an anchor that is not a closed bar of the form's interval, an element form naming an interval) with what is offered instead; a lower epoch than the model's standing forecast is refused; past Models per market the answer names the setting. Answers the arrival, the state, where the steps end, the replaced epoch, and each chart of the market with where the forecast stands on it.

Declaration

client.forecast()
pub fn put(&self, args: ForecastPutArgs) -> Result<Value

Parameters

NameTypeWhat it is
benchimpl Into<String>requiredThe workbench's uri.
forecastimpl Into<Value>requiredThe forecast, as forecast_spec describes it.
steps_totali64optional**A long forecast in chunks**the steps the whole forecast will hold. Its steps here are the first chunk; the rest come by forecast_put_chunk, and it arrives - for every reader - when the last one lands.

Returns

Result<Value, Error> — the tool’s answer as a serde_json::Value.

What it answers

Answers the arrival, the state, where the steps end, the replaced epoch, and each chart of the market with where the forecast stands on it.

Example

client.forecast().put(mcp::ForecastPutArgs::new(bench.clone(), "…"))?

put_chunk#

Send the next chunk of a long forecast · tool forecast_put_chunk

scope: labplan: plussince 3.3.0

Appends steps to a forecast opened with forecast_put and steps_total, from_step being the count already sent. Until the last chunk lands the forecast exists for no reader (the legend says receiving N of M); at the last one the whole forecast is checked as forecast_put checks it and arrives then, stamped put_ms. A chunk out of order, of another epoch or past the total is refused by name. Answers have and of, and at the last chunk forecast_put's answer.

Declaration

client.forecast()
pub fn put_chunk(&self, args: ForecastPutChunkArgs) -> Result<Value

Parameters

NameTypeWhat it is
benchimpl Into<String>requiredThe workbench's uri.
symbolimpl Into<String>required
modelimpl Into<String>required
epochi64requiredThe epoch the forecast was opened with.
from_stepi64requiredThe index (0-based) of this chunk's first step: the count of steps already sent.
stepsimpl Into<Value>requiredThe steps, as forecast_spec's steps.

Returns

Result<Value, Error> — the tool’s answer as a serde_json::Value.

What it answers

Answers have and of, and at the last chunk forecast_put's answer.

Example

client.forecast().put_chunk(mcp::ForecastPutChunkArgs::new(bench.clone(), "SYN-DOCS", "…", 1, 1, "…"))?

put_many#

Put several forecasts at once · tool forecast_put_many

scope: labplan: plussince 3.3.0

Hands over up to 256 forecast_specs to one workbench in one call, every one arriving at the same instant of its clock: several markets and several models. Each refused one is named by its index with why; all_or_nothing lands none when one is refused. Answers put (each landed forecast as forecast_put answers it) and refused [{index, why}].

Declaration

client.forecast()
pub fn put_many(&self, args: ForecastPutManyArgs) -> Result<Value

Parameters

NameTypeWhat it is
benchimpl Into<String>requiredThe workbench's uri.
forecastsimpl Into<Value>requiredThe forecasts, each a forecast_spec: several markets, several models, at most 256.
all_or_nothingbooloptionalTrue lands none when one is refused; false (the default) lands every one that can be, and names the rest.

Returns

Result<Value, Error> — the tool’s answer as a serde_json::Value.

What it answers

Answers put (each landed forecast as forecast_put answers it) and refused [{index, why}].

Example

client.forecast().put_many(mcp::ForecastPutManyArgs::new(bench.clone(), "…"))?

report#

Report how a model's forecasts did · tool forecast_report

scope: readplan: freesince 3.3.0

Scores a model's journalled forecasts on one market against the bars the workbench's history holds, up to its clock - each step only if it had not closed when its forecast arrived: per step and overall, the count, the close's mean absolute error, its percentage, the root mean square error, the mean signed error, the direction hit rate (the close's move from the anchor's own close), each band's coverage against its nominal p, the quantiles' pinball loss, the samples' CRPS, and the mean latency (put_ms after the anchor's close). Steps still to close are pending; steps a late arrival could already see are late and unscored.

Declaration

client.forecast()
pub fn report(&self, args: ForecastReportArgs) -> Result<Value

Parameters

NameTypeWhat it is
benchimpl Into<String>required
symbolimpl Into<String>required
modelimpl Into<String>required
lasti64optionalOnly the newest N forecasts.
since_msi64optionalOnly forecasts that arrived at or after this instant, UTC ms.
sourceimpl Into<String>optionalLive or eval; omitted, both.

Returns

Result<Value, Error> — the tool’s answer as a serde_json::Value.

What it answers

What the tool's description says.

Example

client.forecast().report(mcp::ForecastReportArgs::new(bench.clone(), "SYN-DOCS", "…"))?

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