Bentrix Docs
HomePricingDashboard

R: workbenches

Every method of client$bench in the R SDK.

add_market#

Add a market to a workbench · tool bench_add_market

scope: labplan: plussince 1.0.0

Adds a market to a workbench's working set, as Market Watch's add does: downloaded when the recording does not hold it yet, the bench rebuilt from its record at the same cursor. Answers the workbench.

Declaration

client$bench
add_market(bench, symbol)

Parameters

NameTypeWhat it is
benchanyrequired
symbolanyrequiredThe market's symbol, as the laboratory's list writes it.

Returns

list — the tool’s answer as a list.

What it answers

Answers the workbench.

Example

client$bench$add_market(bench, "SYN-DOCS")

continue_from_stop#

Continue a workbench from where its record stops · tool bench_continue_from_stop

scope: labplan: plussince 3.1.0

On a laboratory workbench whose record of trades no longer replays on its data (today's venue refuses one of its acts), goes on from just before that act: the act and every one after it are set aside, kept in the workbench's file and never deleted, the clock stands at the moment the act was made, and the workbench is rebuilt from the acts before it. Refused where the workbench's record does not stop. Answers the workbench and the moment.

Declaration

client$bench
continue_from_stop(bench)

Parameters

NameTypeWhat it is
benchanyrequired

Returns

list — the tool’s answer as a list.

What it answers

Answers the workbench and the moment.

Example

client$bench$continue_from_stop(bench)

create#

Make a workbench · tool bench_create

scope: labplan: plussince 1.0.0

Makes a workbench beside the others of a laboratory or a real account: in a laboratory it takes its sibling's days, markets and time zone, as the rail's own + Workbench does; in a laboratory that holds none yet it makes an empty one at the sheet's defaults, its markets added from Market Watch. With commission (amount in the account's currency; per lot or million; basis round_turn or per_side) it is made as the New workbench sheet makes one with its own commission: empty, its markets from Market Watch. Does not select it. Answers the new workbench.

Declaration

client$bench
create(home, commission = NULL)

Parameters

NameTypeWhat it is
homeanyrequiredThe laboratory's or the real account's uri.
commissionanyoptional**Its own commission**in the account's currency — as the New workbench sheet's *Your own*. Given, the workbench is made as that sheet makes it: empty, at the sheet's account, its markets from Market Watch. Absent, it charges its laboratory's.

Returns

list — the tool’s answer as a list.

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": [],
  "cursor_ms": 1790812800000,
  "engine": "none",
  "hidden_markets": [],
  "live": false,
  "markets": [],
  "name": "Run 1",
  "playing": false,
  "tick_model": "real",
  "uri": "bentrix://lab/lab-1/bench/bench-2",
  "zone": "utc"
}

Example

client$bench$create(home)

create_alike#

Make a workbench on other spread and fills · tool bench_create_alike

scope: labplan: freesince 1.14.0

Makes a workbench alike a laboratory workbench - its days, markets, account and costs - on the spread and fills given, every setting of the sheet Workbench with other spread and fills: the spread (a session band's where a tick's UTC hour falls in one, else the fixed spread, else the recorded times the multiplier; then the floor; the bid stays, the ask moves) and the fills (a fixed, random or volatility-scaled slippage against every fill that takes the market, an extra in UTC hours, a latency, a seed). Figures in each market's own points, turned into its price units at the bench's own points. Every market whose spread changes prices it as configured, never ranked. The workbench pressed must have its engine. Answers the new workbench.

Declaration

client$bench
create_alike(bench, latency_ms = NULL, seed = NULL, slippage = NULL, slippage_tail = NULL, spread_fixed_points = NULL, spread_floor_points = NULL, spread_multiplier = NULL, spread_sessions = NULL)

Parameters

NameTypeWhat it is
benchanyrequiredThe laboratory workbench the new one is made alike.
latency_msanyoptionalA market order waits for the first tick this many milliseconds after the quote it was sent on.
seedanyoptionalThe seed every random draw is made from; 1 when absent.
slippageanyoptionalThe slippage of every fill that takes the market (a market order, a stop, a stop-loss).
slippage_tailanyoptionalExtra slippage in UTC hours.
spread_fixed_pointsanyoptionalA fixed spread for every market, in its own points.
spread_floor_pointsanyoptionalA spread no tick falls below, in each market's own points.
spread_multiplieranyoptionalEvery market's recorded spread times this (1 as recorded).
spread_sessionsanyoptionalSession bands, each a fixed spread for its UTC hours.

Returns

list — the tool’s answer as a list.

What it answers

Answers the new workbench.

Example

client$bench$create_alike(bench)

create_with_book#

Make a workbench whose account already holds positions · tool bench_create_with_book

scope: labplan: freesince 1.18.0

Makes a workbench alike a laboratory workbench - its days, markets, account, costs, spread and fills - whose account already holds the positions given when its run begins: a book taken over, carried from an earlier run, or written down from a real account. Each enters as it stands and no money moves: its opening commission is not in this balance, its accrued swap is carried on it and booked with its close, its ticket is kept and the workbench's own tickets start above the highest. Its close is an ordinary one. The book is the workbench's for good - a rewind and a relaunch begin with it. Refused by name: a ticket not above zero or given twice, a market the workbench does not hold, two positions of one market on a netting account, a volume or price not above zero. Answers the new workbench.

Declaration

client$bench
create_with_book(bench, positions)

Parameters

NameTypeWhat it is
benchanyrequiredThe laboratory workbench the new one is made alike.
positionsanyrequiredThe positions the account already holds, 1 to 1,000.

Returns

list — the tool’s answer as a list.

What it answers

Answers the new workbench.

Example

client$bench$create_with_book(bench, "…")

delete#

Delete a workbench · tool bench_delete

scope: labplan: plussince 1.0.0

Deletes a workbench and its own record; the laboratory's recording stays. Asked without confirm it answers what would go and deletes nothing; with confirm true it deletes.

Declaration

client$bench
delete(bench, confirm = NULL)

Parameters

NameTypeWhat it is
benchanyrequired
confirmanyoptionalWithout it the answer only says what would go; with it the workbench is deleted.

Returns

list — the tool’s answer as a list.

What it answers

What the tool's description says.

Example

client$bench$delete(bench)

fetch_rest#

Download the rest of a market · tool bench_fetch_rest

scope: labplan: plussince 1.0.0

Downloads what a market of the workbench is missing over its days, as Market Watch's own row does. Answers the workbench.

Declaration

client$bench
fetch_rest(bench, symbol)

Parameters

NameTypeWhat it is
benchanyrequired
symbolanyrequiredThe market's symbol, as the laboratory's list writes it.

Returns

list — the tool’s answer as a list.

What it answers

Answers the workbench.

Example

client$bench$fetch_rest(bench, "SYN-DOCS")

remove_market#

Take a market off a workbench · tool bench_remove_market

scope: labplan: plussince 1.0.0

Takes a market off a workbench's working set; a market already traded is only hidden, and one with an open position or order is refused, as Market Watch's own door refuses it. Answers the workbench.

Declaration

client$bench
remove_market(bench, symbol)

Parameters

NameTypeWhat it is
benchanyrequired
symbolanyrequiredThe market's symbol, as the laboratory's list writes it.

Returns

list — the tool’s answer as a list.

What it answers

Answers the workbench.

Example

client$bench$remove_market(bench, "SYN-DOCS")

rename#

Rename a workbench · tool bench_rename

scope: labplan: plussince 1.0.0

Gives a workbench the name the rail shows. Answers the workbench.

Declaration

client$bench
rename(bench, name)

Parameters

NameTypeWhat it is
benchanyrequired
nameanyrequired

Returns

list — the tool’s answer as a list.

What it answers

Answers the workbench.

Example

client$bench$rename(bench, "…")

retry_market#

Ask for a market again · tool bench_retry_market

scope: labplan: plussince 1.0.0

Asks again for a market whose last download failed. Answers the workbench.

Declaration

client$bench
retry_market(bench, symbol)

Parameters

NameTypeWhat it is
benchanyrequired
symbolanyrequiredThe market's symbol, as the laboratory's list writes it.

Returns

list — the tool’s answer as a list.

What it answers

Answers the workbench.

Example

client$bench$retry_market(bench, "SYN-DOCS")

set_days#

Set a workbench's days · tool bench_set_days

scope: labplan: plussince 1.0.0

Sets the days a laboratory workbench replays: free until its first fill, and only grown after it, as the Replay widget's days are. Answers the workbench.

Declaration

client$bench
set_days(bench, from_ms, to_ms)

Parameters

NameTypeWhat it is
benchanyrequired
from_msanyrequiredThe first day's start, UTC milliseconds.
to_msanyrequiredThe last day's end, UTC milliseconds.

Returns

list — the tool’s answer as a list.

What it answers

Answers the workbench.

Example

client$bench$set_days(bench, 1, 1)

set_tick_model#

Choose a workbench's tick model · tool bench_set_tick_model

scope: labplan: plussince 1.0.0

Chooses how a laboratory workbench's ticks are made: real ticks, every tick, 1 minute OHLC or open prices. Refused once the run has its first fill, as the modelling menu refuses it. Answers the workbench.

Declaration

client$bench
set_tick_model(bench, model)

Parameters

NameTypeWhat it is
benchanyrequired
modelanyrequired

Returns

list — the tool’s answer as a list.

What it answers

Answers the workbench.

Example

client$bench$set_tick_model(bench, "…")

show_market#

Show a hidden market again · tool bench_show_market

scope: labplan: plussince 1.0.0

Shows again a market the workbench had hidden. Answers the workbench.

Declaration

client$bench
show_market(bench, symbol)

Parameters

NameTypeWhat it is
benchanyrequired
symbolanyrequiredThe market's symbol, as the laboratory's list writes it.

Returns

list — the tool’s answer as a list.

What it answers

Answers the workbench.

Example

client$bench$show_market(bench, "SYN-DOCS")

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