Bentrix Docs
HomePricingDashboard

Go: alerts

Every method of client.Alert in the Go SDK.

Arm#

Arm an alert again · tool alert_arm

scope: labplan: plussince 1.0.0

Arms an alert again from nothing — a paused one resumed, a fired or expired one re-armed — as its row's Resume and Re-arm do. Answers the alert.

Declaration

client.Alert
func (a *AlertAPI) Arm(ctx context.Context, args AlertArmArgs) (any, error)

Parameters

NameTypeWhat it is
AlertstringrequiredThe alert's uri.

Returns

(any, error) — the tool’s answer as maps and slices (any).

What it answers

Answers the alert.

Example

client.Alert.Arm(ctx, mcp.AlertArmArgs{Alert: alert})

Create#

Make an alert · tool alert_create

scope: labplan: plussince 1.0.0

Makes an alert on a workbench's market, as the alert editor's Create does — on a laboratory bench it runs on that bench's clock — and refuses one the editor would not make, in its terms. Answers the alert as filed, with its uri.

Declaration

client.Alert
func (a *AlertAPI) Create(ctx context.Context, args AlertCreateArgs) (any, error)

Parameters

NameTypeWhat it is
BenchstringrequiredThe workbench's uri: a laboratory bench's alert runs on its clock; a real bench's on its feed.
Symbolstringrequired
SpecanyrequiredThe alert as it is filed: conditions (each a source, an operator, a value or a pair, an interval), trigger, expires_ms, message, channels, driver.

Returns

(any, error) — the tool’s answer as maps and slices (any).

What it answers

Recorded from a running Bentrix 0.1.382 on a laboratory of generated markets (long lists cut to their first rows):

{
  "alert": {
    "bench": [
      1,
      2
    ],
    "created_ms": 1793397599999,
    "id": 8,
    "market": "SYN-DOCS",
    "run": {
      "seats": [],
      "state": "armed"
    },
    "spec": {
      "channels": [
        "toast"
      ],
      "conditions": [
        {
          "interval": "H1",
          "source": {
            "price": "bid"
          },
          "test": {
            "compare": {
              "op": "crossing_up",
              "operand": {
                "value": 1.2
              }
            }
          }
        }
      ],
      "message": {
        "text": "SYN-DOCS crossed 1.2"
      },
      "trigger": "once_only"
    }
  },
  "uri": "bentrix://alert/alert-8"
}

Example

client.Alert.Create(ctx, mcp.AlertCreateArgs{Bench: bench, Symbol: "SYN-DOCS", Spec: "…"})

Edit#

Edit an alert · tool alert_edit

scope: labplan: plussince 1.0.0

Gives an alert a new specification, as the editor's Save does; an edit arms it again from nothing. Answers the alert.

Declaration

client.Alert
func (a *AlertAPI) Edit(ctx context.Context, args AlertEditArgs) (any, error)

Parameters

NameTypeWhat it is
AlertstringrequiredThe alert's uri.
SpecanyrequiredThe whole specification it is to have, as alert_create takes it.

Returns

(any, error) — the tool’s answer as maps and slices (any).

What it answers

Answers the alert.

Example

client.Alert.Edit(ctx, mcp.AlertEditArgs{Alert: alert, Spec: "…"})

Pause#

Pause an alert · tool alert_pause

scope: labplan: plussince 1.0.0

Pauses an alert, as its row's Pause does. Answers the alert.

Declaration

client.Alert
func (a *AlertAPI) Pause(ctx context.Context, args AlertPauseArgs) (any, error)

Parameters

NameTypeWhat it is
AlertstringrequiredThe alert's uri.

Returns

(any, error) — the tool’s answer as maps and slices (any).

What it answers

Answers the alert.

Example

client.Alert.Pause(ctx, mcp.AlertPauseArgs{Alert: alert})

Remove#

Remove an alert · tool alert_remove

scope: labplan: plussince 1.0.0

Removes an alert, as its row's x does. Answers the alerts left.

Declaration

client.Alert
func (a *AlertAPI) Remove(ctx context.Context, args AlertRemoveArgs) (any, error)

Parameters

NameTypeWhat it is
AlertstringrequiredThe alert's uri.

Returns

(any, error) — the tool’s answer as maps and slices (any).

What it answers

Answers the alerts left.

Example

client.Alert.Remove(ctx, mcp.AlertRemoveArgs{Alert: alert})

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