Appearance
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-switchesList 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
401
auth.session_expired: session expired, sign in again403
auth.invalid_terminal: this terminal cannot be used here403
auth.otp_enrol_required: your group requires one-time codes: set them up to continue403
auth.password_change_required: you must change your password first403
forbidden: you do not have access to this action500
internal: something went wrongts
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-switchesSchedule 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
commentstringenabledbooleangroup_pathstringidintegerlast_runstringA minute on the server clock, written 2006-01-02T15:04 (server time, no zone).
next_runstringnil once a one-off has run or passed A minute on the server clock, written 2006-01-02T15:04 (server time, no zone).
profile_idintegernil = no profile: floating leverage off
repeatstringonce | daily | weekly
starts_atstringserver time of the first run A minute on the server clock, written 2006-01-02T15:04 (server time, no zone).
versionintegerReturns
Promise<LeverageSwitch>The answer's
data.Errors
400
invalid_input: invalid input401
auth.session_expired: session expired, sign in again403
auth.csrf_invalid: request refused: reload the page and try again403
auth.invalid_terminal: this terminal cannot be used here403
auth.otp_enrol_required: your group requires one-time codes: set them up to continue403
auth.password_change_required: you must change your password first403
forbidden: you do not have access to this action500
internal: something went wrongts
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 · pathrequiredLeverage switch id.
Request body
commentstringenabledbooleangroup_pathstringidintegerlast_runstringA minute on the server clock, written 2006-01-02T15:04 (server time, no zone).
next_runstringnil once a one-off has run or passed A minute on the server clock, written 2006-01-02T15:04 (server time, no zone).
profile_idintegernil = no profile: floating leverage off
repeatstringonce | daily | weekly
starts_atstringserver time of the first run A minute on the server clock, written 2006-01-02T15:04 (server time, no zone).
versionintegerReturns
Promise<LeverageSwitch>The answer's
data.Errors
400
invalid_input: invalid input401
auth.session_expired: session expired, sign in again403
auth.csrf_invalid: request refused: reload the page and try again403
auth.invalid_terminal: this terminal cannot be used here403
auth.otp_enrol_required: your group requires one-time codes: set them up to continue403
auth.password_change_required: you must change your password first403
forbidden: you do not have access to this action404
not_found: not found409
conflict: already exists500
internal: something went wrongts
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 · pathrequiredLeverage switch id.
Returns
Promise<null>The answer's
data.Errors
400
invalid_input: invalid input401
auth.session_expired: session expired, sign in again403
auth.csrf_invalid: request refused: reload the page and try again403
auth.invalid_terminal: this terminal cannot be used here403
auth.otp_enrol_required: your group requires one-time codes: set them up to continue403
auth.password_change_required: you must change your password first403
forbidden: you do not have access to this action404
not_found: not found500
internal: something went wrongts
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>