Handle to the engine's account-group registry, currency configuration, and block controls.

Obtained from Engine.accounts(). It shares the engine's single account control state, so changes made through it are visible to every other handle and to running policies.

Methods

  • Returns void

  • Blocks account out of band with the operator-supplied reason.

    account accepts an AccountId or a numeric/string identifier.

    Errors

    Throws AccountIdError on an invalid identifier.

    Parameters

    • account:
          | string
          | number
          | bigint
          | AccountId
    • reason: string

    Returns void

  • Blocks every account in group with the operator-supplied reason.

    group accepts an AccountGroupId or a numeric/string identifier.

    Errors

    Throws AccountBlockError (err.kind === "ReservedGroup") when group is the reserved default group, or ParamError on an invalid identifier.

    Parameters

    • group:
          | string
          | number
          | bigint
          | AccountGroupId
    • reason: string

    Returns void

  • Clears the currency configured for account.

    This changes configuration only; it does not recompute holdings, average entry prices, or realized P&L.

    account accepts an AccountId or a numeric/string identifier.

    Errors

    Throws AccountIdError on an invalid account identifier.

    Parameters

    • account:
          | string
          | number
          | bigint
          | AccountId

    Returns void

  • Clears the fallback currency configured for group.

    AccountGroupId.DEFAULT() selects the global fallback tier. This changes configuration only; it does not recompute holdings, average entry prices, or realized P&L.

    group accepts an AccountGroupId or a numeric/string identifier.

    Errors

    Throws ParamError on an invalid group identifier.

    Parameters

    • group:
          | string
          | number
          | bigint
          | AccountGroupId

    Returns void

  • Returns void

  • Returns the group of account, or undefined when it is unregistered.

    account accepts an AccountId or a numeric/string identifier.

    Errors

    Throws AccountIdError on an invalid identifier.

    Parameters

    • account:
          | string
          | number
          | bigint
          | AccountId

    Returns undefined | AccountGroupId

  • Atomically registers every account in accounts into group.

    accounts is an iterable of AccountId or numeric/string identifiers; group accepts an AccountGroupId or a numeric/string identifier.

    Errors

    Throws AccountGroupRegistrationError on a conflict, or ParamError/AccountIdError on a bad input.

    Parameters

    • accounts: Iterable<
          | string
          | number
          | bigint
          | AccountId, any, any>
    • group:
          | string
          | number
          | bigint
          | AccountGroupId

    Returns void

  • Replaces the stored reason for an already-blocked account.

    account accepts an AccountId or a numeric/string identifier.

    Errors

    Throws AccountBlockError (err.kind === "AccountNotBlocked") when account is not currently blocked, or AccountIdError on an invalid identifier.

    Parameters

    • account:
          | string
          | number
          | bigint
          | AccountId
    • reason: string

    Returns void

  • Replaces the stored reason for an already-blocked group.

    group accepts an AccountGroupId or a numeric/string identifier.

    Errors

    Throws AccountBlockError when group is the reserved default group (err.kind === "ReservedGroup") or is not currently blocked (err.kind === "GroupNotBlocked"), or ParamError on an invalid identifier.

    Parameters

    • group:
          | string
          | number
          | bigint
          | AccountGroupId
    • reason: string

    Returns void

  • Sets the currency used by account-aware policies for account.

    This changes configuration only; it does not recompute holdings, average entry prices, or realized P&L.

    account accepts an AccountId or a numeric/string identifier. asset must be a valid asset identifier.

    Errors

    Throws AccountIdError on an invalid account identifier or AssetError on an invalid asset identifier.

    Parameters

    • account:
          | string
          | number
          | bigint
          | AccountId
    • asset: string

    Returns void

  • Sets the fallback currency used by account-aware policies for group.

    AccountGroupId.DEFAULT() selects the global fallback tier. This changes configuration only; it does not recompute holdings, average entry prices, or realized P&L.

    group accepts an AccountGroupId or a numeric/string identifier. asset must be a valid asset identifier.

    Errors

    Throws ParamError on an invalid group identifier or AssetError on an invalid asset identifier.

    Parameters

    • group:
          | string
          | number
          | bigint
          | AccountGroupId
    • asset: string

    Returns void

  • Unblocks account, clearing any block on it.

    account accepts an AccountId or a numeric/string identifier.

    Errors

    Throws AccountIdError on an invalid identifier.

    Parameters

    • account:
          | string
          | number
          | bigint
          | AccountId

    Returns void

  • Unblocks every account in group.

    group accepts an AccountGroupId or a numeric/string identifier.

    Errors

    Throws AccountBlockError (err.kind === "ReservedGroup") when group is the reserved default group, or ParamError on an invalid identifier.

    Parameters

    • group:
          | string
          | number
          | bigint
          | AccountGroupId

    Returns void

  • Atomically removes every account in accounts from group.

    accounts is an iterable of AccountId or numeric/string identifiers; group accepts an AccountGroupId or a numeric/string identifier.

    Errors

    Throws AccountGroupRegistrationError on a conflict, or ParamError/AccountIdError on a bad input.

    Parameters

    • accounts: Iterable<
          | string
          | number
          | bigint
          | AccountId, any, any>
    • group:
          | string
          | number
          | bigint
          | AccountGroupId

    Returns void