@openpit/engine
    Preparing search index...

    Class AccountPnlOutcome

    Policy-tagged account-level realized-PnL outcome.

    SpotFunds denominates both the delta and absolute value in the account currency.

    SpotFunds engages the account line only for a realizing fill or a nonzero fee. Opening, same-direction, and zero-quantity fills without a nonzero fee, plus zero fees alone, emit no account outcome and require no account currency or FX for this line. A nonzero fee engages both the position and account rows regardless of fill quantity.

    SpotFunds emits a halted outcome only for the report that transitions the account accumulator to halted. Later reports omit the unchanged halt until its account PnL is explicitly force-set. Re-arming a position does not re-arm account PnL, and re-arming account PnL does not re-arm any position.

    Exactly one of pnl and haltReason is present.

    Index
    • Constructs a policy-tagged account-level PnL outcome.

      policyGroupId accepts an integer in 0..=65535. accountId accepts an AccountId object or a number | bigint | string. Pass either a computed pnl or a haltReason created by a PnlHaltReason factory.

      Errors

      Throws TypeError unless exactly one of pnl and haltReason is present, TypeError/RangeError when policyGroupId is invalid, or AccountIdError when the account is invalid.

      Parameters

      Returns AccountPnlOutcome

    accountId: AccountId

    The account that owns the realized-PnL ledger.

    haltReason: PnlHaltReason | undefined

    The reason why PnL could not be calculated, or undefined when it is available.

    isHalted: boolean

    Whether this account accumulator halted during the operation.

    ok: boolean

    Whether this outcome contains authoritative PnL.

    pnl: PnlOutcomeAmount | undefined

    The computed PnL, or undefined when a halt reason is present.

    policyGroupId: number

    The policy-group tag of the policy that produced this outcome.

    • Returns void

    • Returns void