Skip to content

staff.leverageSwitches ​

4 methods on staff.leverageSwitches. Each returns the answer's data and throws NoviqaError on a failed answer.

retrieve ​

GET/admin/v1/leverage-switches

List leverage switches

The scheduled leverage profile switches of the groups in the caller's group scope, ordered by group path, start time and id, plus the server time now (server_time, the clock every switch time is written in).

More details

Rights: the staff member needs at least one of: config.leverage, config.groups.

Returns
Promise<Switches>
The answer's data.
Errors
401auth.session_expired: session expired, sign in again
403auth.invalid_terminal: this terminal cannot be used here
403auth.otp_enrol_required: your group requires one-time codes: set them up to continue
403auth.password_change_required: you must change your password first
403forbidden: you do not have access to this action
500internal: something went wrong
ts
import { staff } from "@/lib/noviqa"

const data = await staff.leverageSwitches.retrieve()
bash
curl -X GET "$NOVIQA_API_URL/admin/v1/leverage-switches" \
  -H "Authorization: Bearer $NOVIQA_TOKEN"
json
{
  "success": true,
  "code": "ok",
  "message": "done",
  "data": {
    "server_time": "1.00",
    "switches": [
      {
        "comment": "Deposit via bank",
        "enabled": true,
        "group_path": "string",
        "id": 1,
        "last_run": "1.00",
        "next_run": "1.00",
        "profile_id": 1,
        "repeat": "string",
        "starts_at": "1.00",
        "version": 1
      }
    ]
  },
  "request_id": "5b7f2c1e"
}
ts
staff.leverageSwitches.retrieve(options?: RequestOptions): Promise<leverage.Switches>

create ​

POST/admin/v1/leverage-switches

Schedule a leverage switch

Schedules setting a group's leverage profile at a server time, once or on repeat (e.g. a stricter profile every Friday evening, the usual one back on Monday). Required: group_path (an existing group in the caller's scope, else invalid_input or forbidden) and starts_at (server time, "2006-01-02T15:04"). profile_id null turns floating leverage off; an unknown id answers invalid_input. repeat once (default), daily or weekly; enabled defaults to true; comment at most 128 characters. A one-off switch must start after the server time now; a repeating one runs first at its next occurrence from now on, never a past one. next_run and last_run are set by the server (execution runs the switch). Writes a config line to the journal. Answers the stored switch.

More details

Rights: the staff member needs every one of: config.leverage.

Request body
commentstring
enabledboolean
group_pathstring
idinteger
last_runstring
A minute on the server clock, written 2006-01-02T15:04 (server time, no zone).
next_runstring
nil once a one-off has run or passed A minute on the server clock, written 2006-01-02T15:04 (server time, no zone).
profile_idinteger
nil = no profile: floating leverage off
repeatstring
once | daily | weekly
starts_atstring
server time of the first run A minute on the server clock, written 2006-01-02T15:04 (server time, no zone).
versioninteger
Returns
Promise<LeverageSwitch>
The answer's data.
Errors
400invalid_input: invalid input
401auth.session_expired: session expired, sign in again
403auth.csrf_invalid: request refused: reload the page and try again
403auth.invalid_terminal: this terminal cannot be used here
403auth.otp_enrol_required: your group requires one-time codes: set them up to continue
403auth.password_change_required: you must change your password first
403forbidden: you do not have access to this action
500internal: something went wrong
ts
import { staff } from "@/lib/noviqa"

const data = await staff.leverageSwitches.create({
  comment: "Weekend margin",
  enabled: true,
  group_path: "real\\standard",
  profile_id: 3,
  repeat: "weekly",
  starts_at: "2026-10-02T21:00"
})
bash
curl -X POST "$NOVIQA_API_URL/admin/v1/leverage-switches" \
  -H "Authorization: Bearer $NOVIQA_TOKEN" \
  -H "Content-Type: application/json" \
  --data-raw '{
  "comment": "Weekend margin",
  "enabled": true,
  "group_path": "real\\standard",
  "profile_id": 3,
  "repeat": "weekly",
  "starts_at": "2026-10-02T21:00"
}'
json
{
  "success": true,
  "code": "ok",
  "message": "done",
  "data": {
    "comment": "Deposit via bank",
    "enabled": true,
    "group_path": "string",
    "id": 1,
    "last_run": "1.00",
    "next_run": "1.00",
    "profile_id": 1,
    "repeat": "string",
    "starts_at": "1.00",
    "version": 1
  },
  "request_id": "5b7f2c1e"
}
ts
staff.leverageSwitches.create(body: models.LeverageSwitch, options?: RequestOptions): Promise<models.LeverageSwitch>

update ​

PATCH/admin/v1/leverage-switches/{id}

Change a leverage switch

Changes the fields sent (profile_id, starts_at, repeat, enabled, comment). version is required and must equal the stored version, else conflict (the version also moves when the switch runs). id, group_path, next_run and last_run cannot be sent. Changing the start or repeat, or enabling it, schedules it again from the server time now (a one-off must then start in the future); disabling clears next_run. A switch of a group outside the caller's scope answers not_found. A change that alters nothing answers the switch as it is. Writes a config line to the journal. Answers the saved switch.

More details

Rights: the staff member needs every one of: config.leverage.

Parameters
idinteger · pathrequired
Leverage switch id.
Request body
commentstring
enabledboolean
group_pathstring
idinteger
last_runstring
A minute on the server clock, written 2006-01-02T15:04 (server time, no zone).
next_runstring
nil once a one-off has run or passed A minute on the server clock, written 2006-01-02T15:04 (server time, no zone).
profile_idinteger
nil = no profile: floating leverage off
repeatstring
once | daily | weekly
starts_atstring
server time of the first run A minute on the server clock, written 2006-01-02T15:04 (server time, no zone).
versioninteger
Returns
Promise<LeverageSwitch>
The answer's data.
Errors
400invalid_input: invalid input
401auth.session_expired: session expired, sign in again
403auth.csrf_invalid: request refused: reload the page and try again
403auth.invalid_terminal: this terminal cannot be used here
403auth.otp_enrol_required: your group requires one-time codes: set them up to continue
403auth.password_change_required: you must change your password first
403forbidden: you do not have access to this action
404not_found: not found
409conflict: already exists
500internal: something went wrong
ts
import { staff } from "@/lib/noviqa"

const data = await staff.leverageSwitches.update(1, {
  enabled: false,
  starts_at: "2026-10-02T22:00",
  version: 2
})
bash
curl -X PATCH "$NOVIQA_API_URL/admin/v1/leverage-switches/1" \
  -H "Authorization: Bearer $NOVIQA_TOKEN" \
  -H "Content-Type: application/json" \
  --data-raw '{
  "enabled": false,
  "starts_at": "2026-10-02T22:00",
  "version": 2
}'
json
{
  "success": true,
  "code": "ok",
  "message": "done",
  "data": {
    "comment": "Deposit via bank",
    "enabled": true,
    "group_path": "string",
    "id": 1,
    "last_run": "1.00",
    "next_run": "1.00",
    "profile_id": 1,
    "repeat": "string",
    "starts_at": "1.00",
    "version": 1
  },
  "request_id": "5b7f2c1e"
}
ts
staff.leverageSwitches.update(id: number, body: models.LeverageSwitch, options?: RequestOptions): Promise<models.LeverageSwitch>

delete ​

DELETE/admin/v1/leverage-switches/{id}

Delete a leverage switch

Removes a scheduled switch; the group keeps whatever profile it has now. A switch of a group outside the caller's scope answers not_found. Writes a config line to the journal.

More details

Rights: the staff member needs every one of: config.leverage.

Parameters
idinteger · pathrequired
Leverage switch id.
Returns
Promise<null>
The answer's data.
Errors
400invalid_input: invalid input
401auth.session_expired: session expired, sign in again
403auth.csrf_invalid: request refused: reload the page and try again
403auth.invalid_terminal: this terminal cannot be used here
403auth.otp_enrol_required: your group requires one-time codes: set them up to continue
403auth.password_change_required: you must change your password first
403forbidden: you do not have access to this action
404not_found: not found
500internal: something went wrong
ts
import { staff } from "@/lib/noviqa"

const data = await staff.leverageSwitches.delete(1)
bash
curl -X DELETE "$NOVIQA_API_URL/admin/v1/leverage-switches/1" \
  -H "Authorization: Bearer $NOVIQA_TOKEN"
json
{
  "success": true,
  "code": "ok",
  "message": "done",
  "data": null,
  "request_id": "5b7f2c1e"
}
ts
staff.leverageSwitches.delete(id: number, options?: RequestOptions): Promise<null>