Skip to content

staff.leverageProfiles ​

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

list ​

GET/admin/v1/leverage-profiles

List leverage profiles

Every leverage profile (floating leverage rules), ordered by name (case-insensitive). Profiles are platform-wide; groups lists only the groups using a profile that are in the caller's group scope.

More details

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

Returns
Promise<Profile[]>
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.leverageProfiles.list()
bash
curl -X GET "$NOVIQA_API_URL/admin/v1/leverage-profiles" \
  -H "Authorization: Bearer $NOVIQA_TOKEN"
json
{
  "success": true,
  "code": "ok",
  "message": "done",
  "data": [
    {
      "enabled": true,
      "groups": [
        "string"
      ],
      "id": 1,
      "name": "Ann Smith",
      "rules": [
        {}
      ],
      "version": 1
    }
  ],
  "request_id": "5b7f2c1e"
}
ts
staff.leverageProfiles.list(options?: RequestOptions): Promise<leverage.Profile[]>

create ​

POST/admin/v1/leverage-profiles

Create a leverage profile

Adds a profile. Required: name (1-64 characters, no leading or trailing spaces, unique, else conflict). rules may be empty (at most 1024); enabled defaults to true (false: groups keep it picked but execution uses their plain leverage instead, so a profile can be turned off without deleting it or unpicking it from groups). A rule needs name (1-64 characters, no leading or trailing spaces), mask (symbol names or paths, comma-separated, * for any run of characters, ! to exclude, e.g. "Forex*, !Forex\USDTRY"; 1-128 masks, at least one without !, at most 4096 characters), range_basis (volume, volume_per_symbol, value or value_per_symbol) and 1-100 tiers. currency is only for value bases (empty = deposit currency); description at most 255 characters. Tiers rise by range_to; the last one, and only it, is open-ended (range_to 0); range_from is ignored and set from the tier before (the first starts at 0); initial and maintenance are 0-999999 with at most 6 decimals. The first rule whose mask covers a symbol applies. id and version are set by the server. A group uses the profile once its leverage_profile_id names it. Answers the stored profile. Writes a config line to the journal and bumps the configuration version, so execution applies the new rules within moments to every group using the profile.

More details

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

Request body
enabledboolean
false: groups keep it picked but execution uses their plain leverage instead
idinteger
namestring
rulesLeverageRule_input[]
checked in order; the first rule matching a symbol applies
versioninteger
Returns
Promise<Profile>
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
409conflict: already exists
500internal: something went wrong
ts
import { staff } from "@/lib/noviqa"

const data = await staff.leverageProfiles.create({
  name: "Standard floating",
  rules: [
    {
      currency: "",
      description: "Tighter margin above 10 lots",
      mask: "Forex\\Majors\\*",
      name: "Majors",
      range_basis: "volume",
      tiers: [
        {
          initial: "1",
          maintenance: "1",
          range_to: "10"
        },
        {
          initial: "2",
          maintenance: "2",
          range_to: "0"
        }
      ]
    }
  ]
})
bash
curl -X POST "$NOVIQA_API_URL/admin/v1/leverage-profiles" \
  -H "Authorization: Bearer $NOVIQA_TOKEN" \
  -H "Content-Type: application/json" \
  --data-raw '{
  "name": "Standard floating",
  "rules": [
    {
      "currency": "",
      "description": "Tighter margin above 10 lots",
      "mask": "Forex\\Majors\\*",
      "name": "Majors",
      "range_basis": "volume",
      "tiers": [
        {
          "initial": "1",
          "maintenance": "1",
          "range_to": "10"
        },
        {
          "initial": "2",
          "maintenance": "2",
          "range_to": "0"
        }
      ]
    }
  ]
}'
json
{
  "success": true,
  "code": "ok",
  "message": "done",
  "data": {
    "enabled": true,
    "groups": [
      "string"
    ],
    "id": 1,
    "name": "Ann Smith",
    "rules": [
      {
        "currency": "USD",
        "description": "string",
        "mask": "string",
        "name": "Ann Smith",
        "range_basis": "string",
        "tiers": [
          {}
        ]
      }
    ],
    "version": 1
  },
  "request_id": "5b7f2c1e"
}
ts
staff.leverageProfiles.create(body: models.LeverageProfile, options?: RequestOptions): Promise<leverage.Profile>

retrieve ​

GET/admin/v1/leverage-profiles/{id}

Get a leverage profile

One profile with its rules and tiers; groups lists the groups using it that are in the caller's group scope. Keep version: every change must send it back.

More details

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

Parameters
idinteger · pathrequired
Leverage profile id.
Returns
Promise<Profile>
The answer's data.
Errors
400invalid_input: invalid input
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
404not_found: not found
500internal: something went wrong
ts
import { staff } from "@/lib/noviqa"

const data = await staff.leverageProfiles.retrieve(1)
bash
curl -X GET "$NOVIQA_API_URL/admin/v1/leverage-profiles/1" \
  -H "Authorization: Bearer $NOVIQA_TOKEN"
json
{
  "success": true,
  "code": "ok",
  "message": "done",
  "data": {
    "enabled": true,
    "groups": [
      "string"
    ],
    "id": 1,
    "name": "Ann Smith",
    "rules": [
      {
        "currency": "USD",
        "description": "string",
        "mask": "string",
        "name": "Ann Smith",
        "range_basis": "string",
        "tiers": [
          {}
        ]
      }
    ],
    "version": 1
  },
  "request_id": "5b7f2c1e"
}
ts
staff.leverageProfiles.retrieve(id: number, options?: RequestOptions): Promise<leverage.Profile>

update ​

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

Change a leverage profile

Changes the fields sent (name, enabled, rules). version is required and must equal the stored version, else conflict; id cannot be sent. rules, when sent, replaces every rule and tier. A rule needs name (1-64 characters, no leading or trailing spaces), mask (symbol names or paths, comma-separated, * for any run of characters, ! to exclude, e.g. "Forex*, !Forex\USDTRY"; 1-128 masks, at least one without !, at most 4096 characters), range_basis (volume, volume_per_symbol, value or value_per_symbol) and 1-100 tiers. currency is only for value bases (empty = deposit currency); description at most 255 characters. Tiers rise by range_to; the last one, and only it, is open-ended (range_to 0); range_from is ignored and set from the tier before (the first starts at 0); initial and maintenance are 0-999999 with at most 6 decimals. The first rule whose mask covers a symbol applies. A change that alters nothing answers the profile as it is. Answers the saved profile. Writes a config line to the journal and bumps the configuration version, so execution applies the new rules within moments to every group using the profile.

More details

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

Parameters
idinteger · pathrequired
Leverage profile id.
Request body
enabledboolean
false: groups keep it picked but execution uses their plain leverage instead
idinteger
namestring
rulesLeverageRule_input[]
checked in order; the first rule matching a symbol applies
versioninteger
Returns
Promise<Profile>
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.leverageProfiles.update(1, {
  name: "Standard floating (weekend)",
  version: 5
})
bash
curl -X PATCH "$NOVIQA_API_URL/admin/v1/leverage-profiles/1" \
  -H "Authorization: Bearer $NOVIQA_TOKEN" \
  -H "Content-Type: application/json" \
  --data-raw '{
  "name": "Standard floating (weekend)",
  "version": 5
}'
json
{
  "success": true,
  "code": "ok",
  "message": "done",
  "data": {
    "enabled": true,
    "groups": [
      "string"
    ],
    "id": 1,
    "name": "Ann Smith",
    "rules": [
      {
        "currency": "USD",
        "description": "string",
        "mask": "string",
        "name": "Ann Smith",
        "range_basis": "string",
        "tiers": [
          {}
        ]
      }
    ],
    "version": 1
  },
  "request_id": "5b7f2c1e"
}
ts
staff.leverageProfiles.update(id: number, body: models.LeverageProfile, options?: RequestOptions): Promise<leverage.Profile>

delete ​

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

Delete a leverage profile

Removes a profile with its rules. Refused with conflict while a group uses it or a scheduled leverage switch names it: pick another profile for those groups, or change or delete the switch, first. Writes a config line to the journal and bumps the configuration version, so execution applies the new rules within moments to every group using the profile.

More details

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

Parameters
idinteger · pathrequired
Leverage profile 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
409conflict: already exists
500internal: something went wrong
ts
import { staff } from "@/lib/noviqa"

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

rules ​

POST/admin/v1/leverage-profiles/{id}/rules

Add a leverage rule

Inserts rule into the profile at position (1-based; 0, left out or past the end = last). version is the profile's version you last read (required, else invalid_input; stale = conflict). A rule needs name (1-64 characters, no leading or trailing spaces), mask (symbol names or paths, comma-separated, * for any run of characters, ! to exclude, e.g. "Forex*, !Forex\USDTRY"; 1-128 masks, at least one without !, at most 4096 characters), range_basis (volume, volume_per_symbol, value or value_per_symbol) and 1-100 tiers. currency is only for value bases (empty = deposit currency); description at most 255 characters. Tiers rise by range_to; the last one, and only it, is open-ended (range_to 0); range_from is ignored and set from the tier before (the first starts at 0); initial and maintenance are 0-999999 with at most 6 decimals. The first rule whose mask covers a symbol applies. Answers the whole saved profile. Writes a config line to the journal and bumps the configuration version, so execution applies the new rules within moments to every group using the profile.

More details

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

Parameters
idinteger · pathrequired
Leverage profile id.
Request body
positioninteger
adding only: 1-based place, 0 = last
ruleLeverageRule
LeverageRule splits the volume or value of the symbols its mask matches into tiers.
versioninteger
Returns
Promise<Profile>
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.leverageProfiles.rules(1, {
  position: 1,
  rule: {
    currency: "USD",
    mask: "XAUUSD",
    name: "Gold",
    range_basis: "value",
    tiers: [
      {
        initial: "1",
        maintenance: "1",
        range_to: "1000000"
      },
      {
        initial: "1.5",
        maintenance: "1.5",
        range_to: "0"
      }
    ]
  },
  version: 5
})
bash
curl -X POST "$NOVIQA_API_URL/admin/v1/leverage-profiles/1/rules" \
  -H "Authorization: Bearer $NOVIQA_TOKEN" \
  -H "Content-Type: application/json" \
  --data-raw '{
  "position": 1,
  "rule": {
    "currency": "USD",
    "mask": "XAUUSD",
    "name": "Gold",
    "range_basis": "value",
    "tiers": [
      {
        "initial": "1",
        "maintenance": "1",
        "range_to": "1000000"
      },
      {
        "initial": "1.5",
        "maintenance": "1.5",
        "range_to": "0"
      }
    ]
  },
  "version": 5
}'
json
{
  "success": true,
  "code": "ok",
  "message": "done",
  "data": {
    "enabled": true,
    "groups": [
      "string"
    ],
    "id": 1,
    "name": "Ann Smith",
    "rules": [
      {
        "currency": "USD",
        "description": "string",
        "mask": "string",
        "name": "Ann Smith",
        "range_basis": "string",
        "tiers": [
          {}
        ]
      }
    ],
    "version": 1
  },
  "request_id": "5b7f2c1e"
}
ts
staff.leverageProfiles.rules(id: number, body: http.ruleBody, options?: RequestOptions): Promise<leverage.Profile>

updateRulesOrder ​

PUT/admin/v1/leverage-profiles/{id}/rules/order

Reorder leverage rules

Puts the rules in a new order: order lists every current rule number (1-based) exactly once, in the new order, else invalid_input. The first rule covering a symbol applies, so order matters. version is the profile's version you last read (required; stale = conflict). Answers the whole saved profile. Writes a config line to the journal and bumps the configuration version, so execution applies the new rules within moments to every group using the profile.

More details

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

Parameters
idinteger · pathrequired
Leverage profile id.
Request body
orderinteger[]
versioninteger
Returns
Promise<Profile>
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.leverageProfiles.updateRulesOrder(1, {
  order: [
    2,
    1,
    3
  ],
  version: 6
})
bash
curl -X PUT "$NOVIQA_API_URL/admin/v1/leverage-profiles/1/rules/order" \
  -H "Authorization: Bearer $NOVIQA_TOKEN" \
  -H "Content-Type: application/json" \
  --data-raw '{
  "order": [
    2,
    1,
    3
  ],
  "version": 6
}'
json
{
  "success": true,
  "code": "ok",
  "message": "done",
  "data": {
    "enabled": true,
    "groups": [
      "string"
    ],
    "id": 1,
    "name": "Ann Smith",
    "rules": [
      {
        "currency": "USD",
        "description": "string",
        "mask": "string",
        "name": "Ann Smith",
        "range_basis": "string",
        "tiers": [
          {}
        ]
      }
    ],
    "version": 1
  },
  "request_id": "5b7f2c1e"
}
ts
staff.leverageProfiles.updateRulesOrder(id: number, body: http.ruleOrderBody, options?: RequestOptions): Promise<leverage.Profile>

updateRules ​

PUT/admin/v1/leverage-profiles/{id}/rules/{n}

Replace a leverage rule

Overwrites rule number n with rule (every field of it; position is ignored). version is the profile's version you last read (required; stale = conflict). A number past the last rule answers not_found. A rule needs name (1-64 characters, no leading or trailing spaces), mask (symbol names or paths, comma-separated, * for any run of characters, ! to exclude, e.g. "Forex*, !Forex\USDTRY"; 1-128 masks, at least one without !, at most 4096 characters), range_basis (volume, volume_per_symbol, value or value_per_symbol) and 1-100 tiers. currency is only for value bases (empty = deposit currency); description at most 255 characters. Tiers rise by range_to; the last one, and only it, is open-ended (range_to 0); range_from is ignored and set from the tier before (the first starts at 0); initial and maintenance are 0-999999 with at most 6 decimals. The first rule whose mask covers a symbol applies. Answers the whole saved profile. Writes a config line to the journal and bumps the configuration version, so execution applies the new rules within moments to every group using the profile.

More details

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

Parameters
idinteger · pathrequired
Leverage profile id.
ninteger · pathrequired
Rule number in the profile, 1-based.
Request body
positioninteger
adding only: 1-based place, 0 = last
ruleLeverageRule
LeverageRule splits the volume or value of the symbols its mask matches into tiers.
versioninteger
Returns
Promise<Profile>
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.leverageProfiles.updateRules(1, 1, {
  rule: {
    mask: "Forex\\Majors\\*",
    name: "Majors",
    range_basis: "volume",
    tiers: [
      {
        initial: "1",
        maintenance: "1",
        range_to: "20"
      },
      {
        initial: "2",
        maintenance: "2",
        range_to: "0"
      }
    ]
  },
  version: 6
})
bash
curl -X PUT "$NOVIQA_API_URL/admin/v1/leverage-profiles/1/rules/1" \
  -H "Authorization: Bearer $NOVIQA_TOKEN" \
  -H "Content-Type: application/json" \
  --data-raw '{
  "rule": {
    "mask": "Forex\\Majors\\*",
    "name": "Majors",
    "range_basis": "volume",
    "tiers": [
      {
        "initial": "1",
        "maintenance": "1",
        "range_to": "20"
      },
      {
        "initial": "2",
        "maintenance": "2",
        "range_to": "0"
      }
    ]
  },
  "version": 6
}'
json
{
  "success": true,
  "code": "ok",
  "message": "done",
  "data": {
    "enabled": true,
    "groups": [
      "string"
    ],
    "id": 1,
    "name": "Ann Smith",
    "rules": [
      {
        "currency": "USD",
        "description": "string",
        "mask": "string",
        "name": "Ann Smith",
        "range_basis": "string",
        "tiers": [
          {}
        ]
      }
    ],
    "version": 1
  },
  "request_id": "5b7f2c1e"
}
ts
staff.leverageProfiles.updateRules(id: number, n: number, body: http.ruleBody, options?: RequestOptions): Promise<leverage.Profile>

deleteRules ​

DELETE/admin/v1/leverage-profiles/{id}/rules/{n}

Delete a leverage rule

Removes rule number n; the rules after it move up one number. A number past the last rule answers not_found. Answers the whole saved profile. Writes a config line to the journal and bumps the configuration version, so execution applies the new rules within moments to every group using the profile.

More details

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

Parameters
idinteger · pathrequired
Leverage profile id.
ninteger · pathrequired
Rule number in the profile, 1-based.
versioninteger · queryrequired
The profile's version you last read; a stale one answers conflict.
Returns
Promise<Profile>
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.leverageProfiles.deleteRules(1, 1, {
  version: 1
})
bash
curl -X DELETE "$NOVIQA_API_URL/admin/v1/leverage-profiles/1/rules/1?version=1" \
  -H "Authorization: Bearer $NOVIQA_TOKEN"
json
{
  "success": true,
  "code": "ok",
  "message": "done",
  "data": {
    "enabled": true,
    "groups": [
      "string"
    ],
    "id": 1,
    "name": "Ann Smith",
    "rules": [
      {
        "currency": "USD",
        "description": "string",
        "mask": "string",
        "name": "Ann Smith",
        "range_basis": "string",
        "tiers": [
          {}
        ]
      }
    ],
    "version": 1
  },
  "request_id": "5b7f2c1e"
}
ts
staff.leverageProfiles.deleteRules(id: number, n: number, query: { version }, options?: RequestOptions): Promise<leverage.Profile>