Bentrix Docs
HomePricingDashboard

C#: workbenches

Every method of client.Bench in the C# SDK.

AddMarket#

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
public Task<JsonNode?> AddMarket(string bench, string symbol, CancellationToken ct = default)

Parameters

NameTypeWhat it is
benchstringrequired
symbolstringrequiredThe market's symbol, as the laboratory's list writes it.

Returns

Task<JsonNode?> — the tool’s answer as a JsonNode.

What it answers

Answers the workbench.

Example

await client.Bench.AddMarket(bench, "SYN-DOCS")

ContinueFromStop#

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
public Task<JsonNode?> ContinueFromStop(string bench, CancellationToken ct = default)

Parameters

NameTypeWhat it is
benchstringrequired

Returns

Task<JsonNode?> — the tool’s answer as a JsonNode.

What it answers

Answers the workbench and the moment.

Example

await client.Bench.ContinueFromStop(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
public Task<JsonNode?> Create(string home, object? commission = null, CancellationToken ct = default)

Parameters

NameTypeWhat it is
homestringrequiredThe laboratory's or the real account's uri.
commissionobject?optional**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

Task<JsonNode?> — the tool’s answer as a JsonNode.

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

await client.Bench.Create(home)

CreateAlike#

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
public Task<JsonNode?> CreateAlike(string bench, long? latencyMs = null, long? seed = null, object? slippage = null, object? slippageTail = null, double? spreadFixedPoints = null, double? spreadFloorPoints = null, double? spreadMultiplier = null, object? spreadSessions = null, CancellationToken ct = default)

Parameters

NameTypeWhat it is
benchstringrequiredThe laboratory workbench the new one is made alike.
latencyMslong?optionalA market order waits for the first tick this many milliseconds after the quote it was sent on.
seedlong?optionalThe seed every random draw is made from; 1 when absent.
slippageobject?optionalThe slippage of every fill that takes the market (a market order, a stop, a stop-loss).
slippageTailobject?optionalExtra slippage in UTC hours.
spreadFixedPointsdouble?optionalA fixed spread for every market, in its own points.
spreadFloorPointsdouble?optionalA spread no tick falls below, in each market's own points.
spreadMultiplierdouble?optionalEvery market's recorded spread times this (1 as recorded).
spreadSessionsobject?optionalSession bands, each a fixed spread for its UTC hours.

Returns

Task<JsonNode?> — the tool’s answer as a JsonNode.

What it answers

Answers the new workbench.

Example

await client.Bench.CreateAlike(bench)

CreateWithBook#

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
public Task<JsonNode?> CreateWithBook(string bench, object positions, CancellationToken ct = default)

Parameters

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

Returns

Task<JsonNode?> — the tool’s answer as a JsonNode.

What it answers

Answers the new workbench.

Example

await client.Bench.CreateWithBook(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
public Task<JsonNode?> Delete(string bench, bool? confirm = null, CancellationToken ct = default)

Parameters

NameTypeWhat it is
benchstringrequired
confirmbool?optionalWithout it the answer only says what would go; with it the workbench is deleted.

Returns

Task<JsonNode?> — the tool’s answer as a JsonNode.

What it answers

What the tool's description says.

Example

await client.Bench.Delete(bench)

FetchRest#

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
public Task<JsonNode?> FetchRest(string bench, string symbol, CancellationToken ct = default)

Parameters

NameTypeWhat it is
benchstringrequired
symbolstringrequiredThe market's symbol, as the laboratory's list writes it.

Returns

Task<JsonNode?> — the tool’s answer as a JsonNode.

What it answers

Answers the workbench.

Example

await client.Bench.FetchRest(bench, "SYN-DOCS")

RemoveMarket#

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
public Task<JsonNode?> RemoveMarket(string bench, string symbol, CancellationToken ct = default)

Parameters

NameTypeWhat it is
benchstringrequired
symbolstringrequiredThe market's symbol, as the laboratory's list writes it.

Returns

Task<JsonNode?> — the tool’s answer as a JsonNode.

What it answers

Answers the workbench.

Example

await client.Bench.RemoveMarket(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
public Task<JsonNode?> Rename(string bench, string name, CancellationToken ct = default)

Parameters

NameTypeWhat it is
benchstringrequired
namestringrequired

Returns

Task<JsonNode?> — the tool’s answer as a JsonNode.

What it answers

Answers the workbench.

Example

await client.Bench.Rename(bench, "…")

RetryMarket#

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
public Task<JsonNode?> RetryMarket(string bench, string symbol, CancellationToken ct = default)

Parameters

NameTypeWhat it is
benchstringrequired
symbolstringrequiredThe market's symbol, as the laboratory's list writes it.

Returns

Task<JsonNode?> — the tool’s answer as a JsonNode.

What it answers

Answers the workbench.

Example

await client.Bench.RetryMarket(bench, "SYN-DOCS")

SetDays#

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
public Task<JsonNode?> SetDays(string bench, long fromMs, long toMs, CancellationToken ct = default)

Parameters

NameTypeWhat it is
benchstringrequired
fromMslongrequiredThe first day's start, UTC milliseconds.
toMslongrequiredThe last day's end, UTC milliseconds.

Returns

Task<JsonNode?> — the tool’s answer as a JsonNode.

What it answers

Answers the workbench.

Example

await client.Bench.SetDays(bench, 1, 1)

SetTickModel#

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
public Task<JsonNode?> SetTickModel(string bench, string model, CancellationToken ct = default)

Parameters

NameTypeWhat it is
benchstringrequired
modelstringrequired

Returns

Task<JsonNode?> — the tool’s answer as a JsonNode.

What it answers

Answers the workbench.

Example

await client.Bench.SetTickModel(bench, "…")

ShowMarket#

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
public Task<JsonNode?> ShowMarket(string bench, string symbol, CancellationToken ct = default)

Parameters

NameTypeWhat it is
benchstringrequired
symbolstringrequiredThe market's symbol, as the laboratory's list writes it.

Returns

Task<JsonNode?> — the tool’s answer as a JsonNode.

What it answers

Answers the workbench.

Example

await client.Bench.ShowMarket(bench, "SYN-DOCS")

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