Bentrix Docs
HomePricingDashboard

Java: forecast

Every method of client.forecast in the Java SDK.

chartSetForecast#

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
public Object chartSetForecast(ChartSetForecastArgs args)

Parameters

NameTypeWhat it is
chartStringrequiredThe chart's uri.
arrivalMarksbooleanoptionalA tick on the time axis at each forecast's arrival.
bandOpacitydoubleoptionalThe bands' opacity, 0.05 to 0.6.
coarserStringoptionalA coarser interval: "spanned" or "by_time".
diffObjectoptional**The diff view**{"a": model, "b": model} shades the gap between their closes step by step; "off" takes it away.
elementOnTimeStringoptionalAn 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".
equivolumeWidthStringoptionalA step's width on true equivolume: "by_volume" (its own volume, else the window's median) or "median".
finerStringoptionalA finer interval: "folded" or "by_time".
hiddenList<String>optionalModels hidden on this chart, as the legend's eye hides them: the whole set.
journalStringoptionalThe journal, for every workbench: laboratory_and_paper (the default), also_real, or off.
keepAfterRealizedObjectoptionalKeep after realized: "until_replaced", "off", {"horizons": n} or {"bars": n}.
modelsPerMarketlongoptionalModels per market, for every workbench: 1 to 64.
onProfileStringoptionalOn a profile: "forecast_session" (letters over the rows one session after the last), "strip" or "off".
opacitydoubleoptionalThe ghost's opacity, 0.2 to 1.
otherRuleStringoptionalAn element forecast of another type or rule on a chart built by price: "derived", "strip" or "both".
pastNewestStringoptionalPast the newest bar: "clock_time", or "session_time" (only the hours the market prints bars in).
readAtAnchorObjectoptionalRead 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.
readoutbooleanoptionalA step's figures beside the pointer and in the data window.
roomObjectoptionalRoom on the right: "forecast" (as wide as the widest forecast), "shift_only", or a number of slots.
samplesDrawnlongoptionalSampled paths drawn per step, 1 to 256.
showbooleanoptionalDraw forecasts on this chart.
timeOnElementsStringoptionalA time forecast on a chart built by price: "derived" (through the chart's own rule), "strip" or "both".
traillongoptionalThe trail: the forecasts each model put before the one standing, drawn faint - 0 (off) to 64.
uncertaintyStringoptionalFan, band, paths or off.

Returns

Object — the tool’s answer as maps and lists.

What it answers

Answers the chart's forecast settings.

Example

client.forecast.chartSetForecast(new Bentrix.ForecastApi.ChartSetForecastArgs(chart))

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
public Object clear(ClearArgs args)

Parameters

NameTypeWhat it is
benchStringrequiredThe workbench's uri.
modelStringoptionalOne model; omitted, every model.
symbolStringoptionalOne market; omitted, every market.

Returns

Object — the tool’s answer as maps and lists.

What it answers

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

Example

client.forecast.clear(new Bentrix.ForecastApi.ClearArgs(bench))

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
public Object compare(CompareArgs args)

Parameters

NameTypeWhat it is
benchStringrequired
symbolStringrequired
lastlongoptional
metricOrderStringoptionalOrder 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.
modelsList<String>optionalThe models; omitted, every model the journal holds on the market.

Returns

Object — the tool’s answer as maps and lists.

What it answers

What the tool's description says.

Example

client.forecast.compare(new Bentrix.ForecastApi.CompareArgs(bench, "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
public Object diff(DiffArgs args)

Parameters

NameTypeWhat it is
benchStringrequired
symbolStringrequired
aStringrequired
bStringrequired

Returns

Object — the tool’s answer as maps and lists.

What it answers

What the tool's description says.

Example

client.forecast.diff(new Bentrix.ForecastApi.DiffArgs(bench, "SYN-DOCS", "…", "…"))

ensembleDefine#

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
public Object ensembleDefine(EnsembleDefineArgs args)

Parameters

NameTypeWhat it is
benchStringrequired
symbolStringrequired
idStringrequiredThe ensemble's label, as a model's: [a-z0-9_]{1,32}, none of its members.
membersList<String>requiredThe members' model labels, at least two.
ruleStringrequiredMean, median or weighted.
bandsStringoptionalQuantiles_averaged (each level's edges averaged; the band claims no p), members_pooled (the mixture's quantiles) or none. Omitted: quantiles_averaged.
weightsList<Double>optionalFor weighted: one weight a member, in the members' order.

Returns

Object — the tool’s answer as maps and lists.

What it answers

Answers the ensemble.

Example

client.forecast.ensembleDefine(new Bentrix.ForecastApi.EnsembleDefineArgs(bench, "SYN-DOCS", "…", "…", "…"))

ensembleList#

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
public Object ensembleList(EnsembleListArgs args)

Parameters

NameTypeWhat it is
benchStringrequired

Returns

Object — the tool’s answer as maps and lists.

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.ensembleList(new Bentrix.ForecastApi.EnsembleListArgs(bench))

ensembleRemove#

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
public Object ensembleRemove(EnsembleRemoveArgs args)

Parameters

NameTypeWhat it is
benchStringrequired
symbolStringrequired
idStringrequired

Returns

Object — the tool’s answer as maps and lists.

What it answers

Answers whether one was there.

Example

client.forecast.ensembleRemove(new Bentrix.ForecastApi.EnsembleRemoveArgs(bench, "SYN-DOCS", "…"))

evalBatch#

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
public Object evalBatch(EvalBatchArgs args)

Parameters

NameTypeWhat it is
benchStringrequired
cellsObjectrequiredOne evaluation run each.

Returns

Object — the tool’s answer as maps and lists.

What it answers

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

Example

client.forecast.evalBatch(new Bentrix.ForecastApi.EvalBatchArgs(bench, "…"))

evalClose#

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
public Object evalClose(EvalCloseArgs args)

Parameters

NameTypeWhat it is
evallongrequired

Returns

Object — the tool’s answer as maps and lists.

What it answers

What the tool's description says.

Example

client.forecast.evalClose(new Bentrix.ForecastApi.EvalCloseArgs(1L))

evalMake#

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
public Object evalMake(EvalMakeArgs args)

Parameters

NameTypeWhat it is
benchStringrequiredThe workbench whose history the run walks; its clock does not move.
symbolsList<String>requiredThe markets of each window, the first the forecast's.
framesList<String>requiredThe frames of each window: intervals' labels.
forecastTfStringrequiredThe interval whose closes the run walks, and the forecast's.
fromMslongrequired
modelStringrequiredThe model label the run's forecasts carry.
latencyObjectoptionalThe 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.
limitlongoptionalClosed bars per frame in each window (200 when omitted).
retrainStringoptionalWhen a retrain is due: "session" (each new day), "week", or a count of closes.
runModelStringoptional**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.
stridelongoptionalOne close in N.
toMslongoptionalAt most the workbench's clock; omitted, the clock.

Returns

Object — the tool’s answer as maps and lists.

What it answers

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

Example

client.forecast.evalMake(new Bentrix.ForecastApi.EvalMakeArgs(bench, "…", "…", "…", 1L, "…"))

evalNext#

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
public Object evalNext(EvalNextArgs args)

Parameters

NameTypeWhat it is
evallongrequired
forecastObjectoptionalThe 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

Object — the tool’s answer as maps and lists.

What it answers

What the tool's description says.

Example

client.forecast.evalNext(new Bentrix.ForecastApi.EvalNextArgs(1L))

evalState#

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
public Object evalState(EvalStateArgs args)

Parameters

NameTypeWhat it is
askStringoptionalOr an ask it answered (bentrix://ask/N), over days the workbench's laboratory did not hold.
evallongoptionalA run forecast_eval_make started.

Returns

Object — the tool’s answer as maps and lists.

What it answers

What the tool's description says.

Example

client.forecast.evalState(new Bentrix.ForecastApi.EvalStateArgs())

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
public Object get(GetArgs args)

Parameters

NameTypeWhat it is
benchStringrequiredThe workbench's uri.
atMslongoptionalThe instant to read at, UTC ms: what a reader at that instant saw. Omitted, the workbench's clock.
modelStringoptionalOne model; omitted, every model.
stepsbooleanoptionalTrue hands each forecast's steps too.
symbolStringoptionalOne market; omitted, every market.

Returns

Object — the tool’s answer as maps and lists.

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(new Bentrix.ForecastApi.GetArgs(bench))

presetApply#

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
public Object presetApply(PresetApplyArgs args)

Parameters

NameTypeWhat it is
nameStringrequiredThe preset: bentrix, quiet, or a name it was saved under.
chartStringrequiredThe chart it is applied to; omitted with all true, every chart of the workbench the chart is on.
allbooleanoptional

Returns

Object — the tool’s answer as maps and lists.

What it answers

Answers the charts it was applied to.

Example

client.forecast.presetApply(new Bentrix.ForecastApi.PresetApplyArgs("…", chart))

presetDelete#

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
public Object presetDelete(PresetDeleteArgs args)

Parameters

NameTypeWhat it is
nameStringrequired

Returns

Object — the tool’s answer as maps and lists.

What it answers

Answers every preset's name left.

Example

client.forecast.presetDelete(new Bentrix.ForecastApi.PresetDeleteArgs("…"))

presetSave#

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
public Object presetSave(PresetSaveArgs args)

Parameters

NameTypeWhat it is
chartStringrequiredThe chart whose look is saved.
nameStringrequiredThe preset's name, [a-z0-9_]{1,32}, not a built-in's (bentrix, quiet).

Returns

Object — the tool’s answer as maps and lists.

What it answers

Answers every preset's name.

Example

client.forecast.presetSave(new Bentrix.ForecastApi.PresetSaveArgs(chart, "…"))

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
public Object put(PutArgs args)

Parameters

NameTypeWhat it is
benchStringrequiredThe workbench's uri.
forecastObjectrequiredThe forecast, as forecast_spec describes it.
stepsTotallongoptional**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

Object — the tool’s answer as maps and lists.

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(new Bentrix.ForecastApi.PutArgs(bench, "…"))

putChunk#

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
public Object putChunk(PutChunkArgs args)

Parameters

NameTypeWhat it is
benchStringrequiredThe workbench's uri.
symbolStringrequired
modelStringrequired
epochlongrequiredThe epoch the forecast was opened with.
fromSteplongrequiredThe index (0-based) of this chunk's first step: the count of steps already sent.
stepsObjectrequiredThe steps, as forecast_spec's steps.

Returns

Object — the tool’s answer as maps and lists.

What it answers

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

Example

client.forecast.putChunk(new Bentrix.ForecastApi.PutChunkArgs(bench, "SYN-DOCS", "…", 1L, 1L, "…"))

putMany#

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
public Object putMany(PutManyArgs args)

Parameters

NameTypeWhat it is
benchStringrequiredThe workbench's uri.
forecastsObjectrequiredThe forecasts, each a forecast_spec: several markets, several models, at most 256.
allOrNothingbooleanoptionalTrue lands none when one is refused; false (the default) lands every one that can be, and names the rest.

Returns

Object — the tool’s answer as maps and lists.

What it answers

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

Example

client.forecast.putMany(new Bentrix.ForecastApi.PutManyArgs(bench, "…"))

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
public Object report(ReportArgs args)

Parameters

NameTypeWhat it is
benchStringrequired
symbolStringrequired
modelStringrequired
lastlongoptionalOnly the newest N forecasts.
sinceMslongoptionalOnly forecasts that arrived at or after this instant, UTC ms.
sourceStringoptionalLive or eval; omitted, both.

Returns

Object — the tool’s answer as maps and lists.

What it answers

What the tool's description says.

Example

client.forecast.report(new Bentrix.ForecastApi.ReportArgs(bench, "SYN-DOCS", "…"))

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