{
  "tool_id": "art-857-average-price-allocation",
  "note": "golden_hash pinned (see vectors). V1-V10 are the row contract vectors (expected minor-unit values derived by hand and asserted before pinning); R-* vectors cover the input contract. Synthetic accounts only. human_sign_off: PENDING.",
  "vectors": [
    {
      "name": "V1-buy-usd-three-fills-two-accounts",
      "policy_parameters": {
        "currency": "USD",
        "side": "buy",
        "fills": [
          {
            "price_per_share": "10.00",
            "quantity_shares": 100
          },
          {
            "price_per_share": "10.50",
            "quantity_shares": 200
          },
          {
            "price_per_share": "9.80",
            "quantity_shares": 100
          }
        ],
        "allocations": [
          {
            "account": "ACCT-A",
            "shares": 200
          },
          {
            "account": "ACCT-B",
            "shares": 200
          }
        ]
      },
      "output_payload": {
        "currency": "USD",
        "minor_unit_exponent": 2,
        "side": "buy",
        "amount_label": "cost",
        "amount_basis": "unrounded_average",
        "average_price_dp": null,
        "residual_handling": "assign_largest",
        "total_shares": 400,
        "total_minor": 408000,
        "average_price": "10.20000000",
        "rounded_average_price": null,
        "allocations": [
          {
            "account": "ACCT-A",
            "shares": 200,
            "amount_minor_pre_residual": 204000,
            "amount_minor": 204000
          },
          {
            "account": "ACCT-B",
            "shares": 200,
            "amount_minor_pre_residual": 204000,
            "amount_minor": 204000
          }
        ],
        "residual_minor": 0,
        "residual_account": "ACCT-A",
        "unallocated_residual_minor": 0,
        "identity_holds": true,
        "overall": "ALLOCATION_COMPUTED",
        "refusals": [],
        "warnings": [],
        "note": "Average-price allocation in exact integer minor units (ISO 4217 minor unit for the declared currency). total_minor = half-up(sum of quantity x price). average_price = sum(quantity x price) / sum(quantity), 8 decimals half-up. Per account: half-up(shares x average) under unrounded_average, or half-up(shares x average rounded half-up to average_price_dp) under rounded_average_dp. residual_minor = total_minor - sum of account amounts; assign_largest adds it to the account with the most shares (ties to the first declared), report_unallocated leaves it unallocated. Identity: sum of final account amounts + unallocated residual = total_minor. The rounding basis and the residual rule are declared conventions of this tool, not a regulatory or fairness rule. Calculation check, not investment, legal or regulatory advice."
      },
      "golden_hash": "bf08d232e86e757672933c73b916217a40e4c56fc80687eec25a2484070422e4"
    },
    {
      "name": "V2-sell-usd-three-accounts",
      "policy_parameters": {
        "currency": "USD",
        "side": "sell",
        "fills": [
          {
            "price_per_share": "10.00",
            "quantity_shares": 3
          }
        ],
        "allocations": [
          {
            "account": "ACCT-A",
            "shares": 1
          },
          {
            "account": "ACCT-B",
            "shares": 1
          },
          {
            "account": "ACCT-C",
            "shares": 1
          }
        ]
      },
      "output_payload": {
        "currency": "USD",
        "minor_unit_exponent": 2,
        "side": "sell",
        "amount_label": "proceeds",
        "amount_basis": "unrounded_average",
        "average_price_dp": null,
        "residual_handling": "assign_largest",
        "total_shares": 3,
        "total_minor": 3000,
        "average_price": "10.00000000",
        "rounded_average_price": null,
        "allocations": [
          {
            "account": "ACCT-A",
            "shares": 1,
            "amount_minor_pre_residual": 1000,
            "amount_minor": 1000
          },
          {
            "account": "ACCT-B",
            "shares": 1,
            "amount_minor_pre_residual": 1000,
            "amount_minor": 1000
          },
          {
            "account": "ACCT-C",
            "shares": 1,
            "amount_minor_pre_residual": 1000,
            "amount_minor": 1000
          }
        ],
        "residual_minor": 0,
        "residual_account": "ACCT-A",
        "unallocated_residual_minor": 0,
        "identity_holds": true,
        "overall": "ALLOCATION_COMPUTED",
        "refusals": [],
        "warnings": [],
        "note": "Average-price allocation in exact integer minor units (ISO 4217 minor unit for the declared currency). total_minor = half-up(sum of quantity x price). average_price = sum(quantity x price) / sum(quantity), 8 decimals half-up. Per account: half-up(shares x average) under unrounded_average, or half-up(shares x average rounded half-up to average_price_dp) under rounded_average_dp. residual_minor = total_minor - sum of account amounts; assign_largest adds it to the account with the most shares (ties to the first declared), report_unallocated leaves it unallocated. Identity: sum of final account amounts + unallocated residual = total_minor. The rounding basis and the residual rule are declared conventions of this tool, not a regulatory or fairness rule. Calculation check, not investment, legal or regulatory advice."
      },
      "golden_hash": "61d9dfb687f4f9714138b608d98c2e7ed430ec320db81c60aa88c62acbd68381"
    },
    {
      "name": "V3-buy-usd-penny-residual",
      "policy_parameters": {
        "currency": "USD",
        "side": "buy",
        "fills": [
          {
            "price_per_share": "3.34",
            "quantity_shares": 1
          },
          {
            "price_per_share": "3.34",
            "quantity_shares": 1
          },
          {
            "price_per_share": "3.33",
            "quantity_shares": 1
          }
        ],
        "allocations": [
          {
            "account": "ACCT-A",
            "shares": 1
          },
          {
            "account": "ACCT-B",
            "shares": 1
          },
          {
            "account": "ACCT-C",
            "shares": 1
          }
        ]
      },
      "output_payload": {
        "currency": "USD",
        "minor_unit_exponent": 2,
        "side": "buy",
        "amount_label": "cost",
        "amount_basis": "unrounded_average",
        "average_price_dp": null,
        "residual_handling": "assign_largest",
        "total_shares": 3,
        "total_minor": 1001,
        "average_price": "3.33666667",
        "rounded_average_price": null,
        "allocations": [
          {
            "account": "ACCT-A",
            "shares": 1,
            "amount_minor_pre_residual": 334,
            "amount_minor": 333
          },
          {
            "account": "ACCT-B",
            "shares": 1,
            "amount_minor_pre_residual": 334,
            "amount_minor": 334
          },
          {
            "account": "ACCT-C",
            "shares": 1,
            "amount_minor_pre_residual": 334,
            "amount_minor": 334
          }
        ],
        "residual_minor": -1,
        "residual_account": "ACCT-A",
        "unallocated_residual_minor": 0,
        "identity_holds": true,
        "overall": "ALLOCATION_COMPUTED",
        "refusals": [],
        "warnings": [
          "RESIDUAL_ASSIGNED"
        ],
        "note": "Average-price allocation in exact integer minor units (ISO 4217 minor unit for the declared currency). total_minor = half-up(sum of quantity x price). average_price = sum(quantity x price) / sum(quantity), 8 decimals half-up. Per account: half-up(shares x average) under unrounded_average, or half-up(shares x average rounded half-up to average_price_dp) under rounded_average_dp. residual_minor = total_minor - sum of account amounts; assign_largest adds it to the account with the most shares (ties to the first declared), report_unallocated leaves it unallocated. Identity: sum of final account amounts + unallocated residual = total_minor. The rounding basis and the residual rule are declared conventions of this tool, not a regulatory or fairness rule. Calculation check, not investment, legal or regulatory advice."
      },
      "golden_hash": "1ca2e10328812ab7afb1d3684ed5002cfd730c46420523e74f66f0b4b68ba8a8"
    },
    {
      "name": "V4-shares-sum-mismatch",
      "policy_parameters": {
        "currency": "USD",
        "side": "buy",
        "fills": [
          {
            "price_per_share": "10.00",
            "quantity_shares": 100
          }
        ],
        "allocations": [
          {
            "account": "ACCT-A",
            "shares": 60
          },
          {
            "account": "ACCT-B",
            "shares": 30
          }
        ]
      },
      "output_payload": {
        "currency": "USD",
        "minor_unit_exponent": 2,
        "side": "buy",
        "amount_label": "cost",
        "amount_basis": "unrounded_average",
        "average_price_dp": null,
        "residual_handling": "assign_largest",
        "total_shares": null,
        "total_minor": null,
        "average_price": null,
        "rounded_average_price": null,
        "allocations": [],
        "residual_minor": null,
        "residual_account": null,
        "unallocated_residual_minor": null,
        "identity_holds": null,
        "overall": "INPUT_REFUSED",
        "refusals": [
          "allocations: REFUSED_INPUT_SHARES_MISMATCH"
        ],
        "warnings": [
          "INPUT_REFUSED"
        ],
        "note": "Average-price allocation in exact integer minor units (ISO 4217 minor unit for the declared currency). total_minor = half-up(sum of quantity x price). average_price = sum(quantity x price) / sum(quantity), 8 decimals half-up. Per account: half-up(shares x average) under unrounded_average, or half-up(shares x average rounded half-up to average_price_dp) under rounded_average_dp. residual_minor = total_minor - sum of account amounts; assign_largest adds it to the account with the most shares (ties to the first declared), report_unallocated leaves it unallocated. Identity: sum of final account amounts + unallocated residual = total_minor. The rounding basis and the residual rule are declared conventions of this tool, not a regulatory or fairness rule. Calculation check, not investment, legal or regulatory advice."
      },
      "golden_hash": "efb2932687f3e33b19650940a75556d2e24e67d6c3340d61cfede3b90e579155"
    },
    {
      "name": "V5-float-trap-1.005",
      "policy_parameters": {
        "currency": "USD",
        "side": "buy",
        "fills": [
          {
            "price_per_share": "1.005",
            "quantity_shares": 2
          }
        ],
        "allocations": [
          {
            "account": "ACCT-A",
            "shares": 1
          },
          {
            "account": "ACCT-B",
            "shares": 1
          }
        ]
      },
      "output_payload": {
        "currency": "USD",
        "minor_unit_exponent": 2,
        "side": "buy",
        "amount_label": "cost",
        "amount_basis": "unrounded_average",
        "average_price_dp": null,
        "residual_handling": "assign_largest",
        "total_shares": 2,
        "total_minor": 201,
        "average_price": "1.00500000",
        "rounded_average_price": null,
        "allocations": [
          {
            "account": "ACCT-A",
            "shares": 1,
            "amount_minor_pre_residual": 101,
            "amount_minor": 100
          },
          {
            "account": "ACCT-B",
            "shares": 1,
            "amount_minor_pre_residual": 101,
            "amount_minor": 101
          }
        ],
        "residual_minor": -1,
        "residual_account": "ACCT-A",
        "unallocated_residual_minor": 0,
        "identity_holds": true,
        "overall": "ALLOCATION_COMPUTED",
        "refusals": [],
        "warnings": [
          "RESIDUAL_ASSIGNED"
        ],
        "note": "Average-price allocation in exact integer minor units (ISO 4217 minor unit for the declared currency). total_minor = half-up(sum of quantity x price). average_price = sum(quantity x price) / sum(quantity), 8 decimals half-up. Per account: half-up(shares x average) under unrounded_average, or half-up(shares x average rounded half-up to average_price_dp) under rounded_average_dp. residual_minor = total_minor - sum of account amounts; assign_largest adds it to the account with the most shares (ties to the first declared), report_unallocated leaves it unallocated. Identity: sum of final account amounts + unallocated residual = total_minor. The rounding basis and the residual rule are declared conventions of this tool, not a regulatory or fairness rule. Calculation check, not investment, legal or regulatory advice."
      },
      "golden_hash": "b93d26412e2d8051b4617276944a8c5d0ee690f3069a8fd43ee1c82b40809ae8"
    },
    {
      "name": "V6-jpy-zero-minor-unit",
      "policy_parameters": {
        "currency": "JPY",
        "side": "buy",
        "fills": [
          {
            "price_per_share": "334",
            "quantity_shares": 1
          },
          {
            "price_per_share": "334",
            "quantity_shares": 1
          },
          {
            "price_per_share": "333",
            "quantity_shares": 1
          }
        ],
        "allocations": [
          {
            "account": "ACCT-A",
            "shares": 1
          },
          {
            "account": "ACCT-B",
            "shares": 1
          },
          {
            "account": "ACCT-C",
            "shares": 1
          }
        ]
      },
      "output_payload": {
        "currency": "JPY",
        "minor_unit_exponent": 0,
        "side": "buy",
        "amount_label": "cost",
        "amount_basis": "unrounded_average",
        "average_price_dp": null,
        "residual_handling": "assign_largest",
        "total_shares": 3,
        "total_minor": 1001,
        "average_price": "333.66666667",
        "rounded_average_price": null,
        "allocations": [
          {
            "account": "ACCT-A",
            "shares": 1,
            "amount_minor_pre_residual": 334,
            "amount_minor": 333
          },
          {
            "account": "ACCT-B",
            "shares": 1,
            "amount_minor_pre_residual": 334,
            "amount_minor": 334
          },
          {
            "account": "ACCT-C",
            "shares": 1,
            "amount_minor_pre_residual": 334,
            "amount_minor": 334
          }
        ],
        "residual_minor": -1,
        "residual_account": "ACCT-A",
        "unallocated_residual_minor": 0,
        "identity_holds": true,
        "overall": "ALLOCATION_COMPUTED",
        "refusals": [],
        "warnings": [
          "RESIDUAL_ASSIGNED"
        ],
        "note": "Average-price allocation in exact integer minor units (ISO 4217 minor unit for the declared currency). total_minor = half-up(sum of quantity x price). average_price = sum(quantity x price) / sum(quantity), 8 decimals half-up. Per account: half-up(shares x average) under unrounded_average, or half-up(shares x average rounded half-up to average_price_dp) under rounded_average_dp. residual_minor = total_minor - sum of account amounts; assign_largest adds it to the account with the most shares (ties to the first declared), report_unallocated leaves it unallocated. Identity: sum of final account amounts + unallocated residual = total_minor. The rounding basis and the residual rule are declared conventions of this tool, not a regulatory or fairness rule. Calculation check, not investment, legal or regulatory advice."
      },
      "golden_hash": "ed5eb6609443a1ba5909731634319e2c00482934b80cbedb90177ec7be944039"
    },
    {
      "name": "V7-largest-tied-first-declared",
      "policy_parameters": {
        "currency": "USD",
        "side": "buy",
        "fills": [
          {
            "price_per_share": "1.001",
            "quantity_shares": 10
          }
        ],
        "allocations": [
          {
            "account": "ACCT-A",
            "shares": 3
          },
          {
            "account": "ACCT-B",
            "shares": 3
          },
          {
            "account": "ACCT-C",
            "shares": 2
          },
          {
            "account": "ACCT-D",
            "shares": 2
          }
        ]
      },
      "output_payload": {
        "currency": "USD",
        "minor_unit_exponent": 2,
        "side": "buy",
        "amount_label": "cost",
        "amount_basis": "unrounded_average",
        "average_price_dp": null,
        "residual_handling": "assign_largest",
        "total_shares": 10,
        "total_minor": 1001,
        "average_price": "1.00100000",
        "rounded_average_price": null,
        "allocations": [
          {
            "account": "ACCT-A",
            "shares": 3,
            "amount_minor_pre_residual": 300,
            "amount_minor": 301
          },
          {
            "account": "ACCT-B",
            "shares": 3,
            "amount_minor_pre_residual": 300,
            "amount_minor": 300
          },
          {
            "account": "ACCT-C",
            "shares": 2,
            "amount_minor_pre_residual": 200,
            "amount_minor": 200
          },
          {
            "account": "ACCT-D",
            "shares": 2,
            "amount_minor_pre_residual": 200,
            "amount_minor": 200
          }
        ],
        "residual_minor": 1,
        "residual_account": "ACCT-A",
        "unallocated_residual_minor": 0,
        "identity_holds": true,
        "overall": "ALLOCATION_COMPUTED",
        "refusals": [],
        "warnings": [
          "RESIDUAL_ASSIGNED"
        ],
        "note": "Average-price allocation in exact integer minor units (ISO 4217 minor unit for the declared currency). total_minor = half-up(sum of quantity x price). average_price = sum(quantity x price) / sum(quantity), 8 decimals half-up. Per account: half-up(shares x average) under unrounded_average, or half-up(shares x average rounded half-up to average_price_dp) under rounded_average_dp. residual_minor = total_minor - sum of account amounts; assign_largest adds it to the account with the most shares (ties to the first declared), report_unallocated leaves it unallocated. Identity: sum of final account amounts + unallocated residual = total_minor. The rounding basis and the residual rule are declared conventions of this tool, not a regulatory or fairness rule. Calculation check, not investment, legal or regulatory advice."
      },
      "golden_hash": "7ca04955461200ab301045463aaef610a5eb7eec52ccf296d113d8e672801b4c"
    },
    {
      "name": "V8a-rounded-dp2-assign-largest",
      "policy_parameters": {
        "currency": "USD",
        "side": "buy",
        "fills": [
          {
            "price_per_share": "3.34",
            "quantity_shares": 3
          },
          {
            "price_per_share": "3.33",
            "quantity_shares": 3
          }
        ],
        "allocations": [
          {
            "account": "ACCT-A",
            "shares": 3
          },
          {
            "account": "ACCT-B",
            "shares": 3
          }
        ],
        "amount_basis": "rounded_average_dp",
        "average_price_dp": 2,
        "residual_handling": "assign_largest"
      },
      "output_payload": {
        "currency": "USD",
        "minor_unit_exponent": 2,
        "side": "buy",
        "amount_label": "cost",
        "amount_basis": "rounded_average_dp",
        "average_price_dp": 2,
        "residual_handling": "assign_largest",
        "total_shares": 6,
        "total_minor": 2001,
        "average_price": "3.33500000",
        "rounded_average_price": "3.34",
        "allocations": [
          {
            "account": "ACCT-A",
            "shares": 3,
            "amount_minor_pre_residual": 1002,
            "amount_minor": 999
          },
          {
            "account": "ACCT-B",
            "shares": 3,
            "amount_minor_pre_residual": 1002,
            "amount_minor": 1002
          }
        ],
        "residual_minor": -3,
        "residual_account": "ACCT-A",
        "unallocated_residual_minor": 0,
        "identity_holds": true,
        "overall": "ALLOCATION_COMPUTED",
        "refusals": [],
        "warnings": [
          "RESIDUAL_ASSIGNED"
        ],
        "note": "Average-price allocation in exact integer minor units (ISO 4217 minor unit for the declared currency). total_minor = half-up(sum of quantity x price). average_price = sum(quantity x price) / sum(quantity), 8 decimals half-up. Per account: half-up(shares x average) under unrounded_average, or half-up(shares x average rounded half-up to average_price_dp) under rounded_average_dp. residual_minor = total_minor - sum of account amounts; assign_largest adds it to the account with the most shares (ties to the first declared), report_unallocated leaves it unallocated. Identity: sum of final account amounts + unallocated residual = total_minor. The rounding basis and the residual rule are declared conventions of this tool, not a regulatory or fairness rule. Calculation check, not investment, legal or regulatory advice."
      },
      "golden_hash": "9cd6f0dd6bf50842ab5090109c1979a5091830df495acb49a5f188b8e8e8c2fa"
    },
    {
      "name": "V8b-rounded-dp2-report-unallocated",
      "policy_parameters": {
        "currency": "USD",
        "side": "buy",
        "fills": [
          {
            "price_per_share": "3.34",
            "quantity_shares": 3
          },
          {
            "price_per_share": "3.33",
            "quantity_shares": 3
          }
        ],
        "allocations": [
          {
            "account": "ACCT-A",
            "shares": 3
          },
          {
            "account": "ACCT-B",
            "shares": 3
          }
        ],
        "amount_basis": "rounded_average_dp",
        "average_price_dp": 2,
        "residual_handling": "report_unallocated"
      },
      "output_payload": {
        "currency": "USD",
        "minor_unit_exponent": 2,
        "side": "buy",
        "amount_label": "cost",
        "amount_basis": "rounded_average_dp",
        "average_price_dp": 2,
        "residual_handling": "report_unallocated",
        "total_shares": 6,
        "total_minor": 2001,
        "average_price": "3.33500000",
        "rounded_average_price": "3.34",
        "allocations": [
          {
            "account": "ACCT-A",
            "shares": 3,
            "amount_minor_pre_residual": 1002,
            "amount_minor": 1002
          },
          {
            "account": "ACCT-B",
            "shares": 3,
            "amount_minor_pre_residual": 1002,
            "amount_minor": 1002
          }
        ],
        "residual_minor": -3,
        "residual_account": null,
        "unallocated_residual_minor": -3,
        "identity_holds": true,
        "overall": "ALLOCATION_COMPUTED",
        "refusals": [],
        "warnings": [
          "RESIDUAL_UNALLOCATED"
        ],
        "note": "Average-price allocation in exact integer minor units (ISO 4217 minor unit for the declared currency). total_minor = half-up(sum of quantity x price). average_price = sum(quantity x price) / sum(quantity), 8 decimals half-up. Per account: half-up(shares x average) under unrounded_average, or half-up(shares x average rounded half-up to average_price_dp) under rounded_average_dp. residual_minor = total_minor - sum of account amounts; assign_largest adds it to the account with the most shares (ties to the first declared), report_unallocated leaves it unallocated. Identity: sum of final account amounts + unallocated residual = total_minor. The rounding basis and the residual rule are declared conventions of this tool, not a regulatory or fairness rule. Calculation check, not investment, legal or regulatory advice."
      },
      "golden_hash": "c7129bdeb03d274e748ad163b1a19198e30225c5cea65be02b25185e3eae665b"
    },
    {
      "name": "V8c-unrounded-same-fills",
      "policy_parameters": {
        "currency": "USD",
        "side": "buy",
        "fills": [
          {
            "price_per_share": "3.34",
            "quantity_shares": 3
          },
          {
            "price_per_share": "3.33",
            "quantity_shares": 3
          }
        ],
        "allocations": [
          {
            "account": "ACCT-A",
            "shares": 3
          },
          {
            "account": "ACCT-B",
            "shares": 3
          }
        ],
        "amount_basis": "unrounded_average"
      },
      "output_payload": {
        "currency": "USD",
        "minor_unit_exponent": 2,
        "side": "buy",
        "amount_label": "cost",
        "amount_basis": "unrounded_average",
        "average_price_dp": null,
        "residual_handling": "assign_largest",
        "total_shares": 6,
        "total_minor": 2001,
        "average_price": "3.33500000",
        "rounded_average_price": null,
        "allocations": [
          {
            "account": "ACCT-A",
            "shares": 3,
            "amount_minor_pre_residual": 1001,
            "amount_minor": 1000
          },
          {
            "account": "ACCT-B",
            "shares": 3,
            "amount_minor_pre_residual": 1001,
            "amount_minor": 1001
          }
        ],
        "residual_minor": -1,
        "residual_account": "ACCT-A",
        "unallocated_residual_minor": 0,
        "identity_holds": true,
        "overall": "ALLOCATION_COMPUTED",
        "refusals": [],
        "warnings": [
          "RESIDUAL_ASSIGNED"
        ],
        "note": "Average-price allocation in exact integer minor units (ISO 4217 minor unit for the declared currency). total_minor = half-up(sum of quantity x price). average_price = sum(quantity x price) / sum(quantity), 8 decimals half-up. Per account: half-up(shares x average) under unrounded_average, or half-up(shares x average rounded half-up to average_price_dp) under rounded_average_dp. residual_minor = total_minor - sum of account amounts; assign_largest adds it to the account with the most shares (ties to the first declared), report_unallocated leaves it unallocated. Identity: sum of final account amounts + unallocated residual = total_minor. The rounding basis and the residual rule are declared conventions of this tool, not a regulatory or fairness rule. Calculation check, not investment, legal or regulatory advice."
      },
      "golden_hash": "790a615a362aba8348fee4c4d86a23f9843f371e8ad5e14436fd769cd67fc110"
    },
    {
      "name": "V8d-rounded-without-residual-rule",
      "policy_parameters": {
        "currency": "USD",
        "side": "buy",
        "fills": [
          {
            "price_per_share": "3.34",
            "quantity_shares": 3
          },
          {
            "price_per_share": "3.33",
            "quantity_shares": 3
          }
        ],
        "allocations": [
          {
            "account": "ACCT-A",
            "shares": 3
          },
          {
            "account": "ACCT-B",
            "shares": 3
          }
        ],
        "amount_basis": "rounded_average_dp",
        "average_price_dp": 2
      },
      "output_payload": {
        "currency": "USD",
        "minor_unit_exponent": 2,
        "side": "buy",
        "amount_label": "cost",
        "amount_basis": "rounded_average_dp",
        "average_price_dp": 2,
        "residual_handling": null,
        "total_shares": null,
        "total_minor": null,
        "average_price": null,
        "rounded_average_price": null,
        "allocations": [],
        "residual_minor": null,
        "residual_account": null,
        "unallocated_residual_minor": null,
        "identity_holds": null,
        "overall": "INPUT_REFUSED",
        "refusals": [
          "residual_handling: REFUSED_INPUT_MISSING"
        ],
        "warnings": [
          "INPUT_REFUSED"
        ],
        "note": "Average-price allocation in exact integer minor units (ISO 4217 minor unit for the declared currency). total_minor = half-up(sum of quantity x price). average_price = sum(quantity x price) / sum(quantity), 8 decimals half-up. Per account: half-up(shares x average) under unrounded_average, or half-up(shares x average rounded half-up to average_price_dp) under rounded_average_dp. residual_minor = total_minor - sum of account amounts; assign_largest adds it to the account with the most shares (ties to the first declared), report_unallocated leaves it unallocated. Identity: sum of final account amounts + unallocated residual = total_minor. The rounding basis and the residual rule are declared conventions of this tool, not a regulatory or fairness rule. Calculation check, not investment, legal or regulatory advice."
      },
      "golden_hash": "dfa096125380e4fd9d8f9cd074118876a7428c9a1e759bf6d491eb79bc6c6c53"
    },
    {
      "name": "V9a-mixed-currency",
      "policy_parameters": {
        "currency": "USD",
        "side": "buy",
        "fills": [
          {
            "price_per_share": "10.00",
            "quantity_shares": 1
          },
          {
            "price_per_share": "10.00",
            "quantity_shares": 1,
            "currency": "EUR"
          }
        ],
        "allocations": [
          {
            "account": "ACCT-A",
            "shares": 2
          }
        ]
      },
      "output_payload": {
        "currency": "USD",
        "minor_unit_exponent": 2,
        "side": "buy",
        "amount_label": "cost",
        "amount_basis": "unrounded_average",
        "average_price_dp": null,
        "residual_handling": "assign_largest",
        "total_shares": null,
        "total_minor": null,
        "average_price": null,
        "rounded_average_price": null,
        "allocations": [],
        "residual_minor": null,
        "residual_account": null,
        "unallocated_residual_minor": null,
        "identity_holds": null,
        "overall": "INPUT_REFUSED",
        "refusals": [
          "fills[1].currency: REFUSED_INPUT_CURRENCY_MISMATCH"
        ],
        "warnings": [
          "INPUT_REFUSED"
        ],
        "note": "Average-price allocation in exact integer minor units (ISO 4217 minor unit for the declared currency). total_minor = half-up(sum of quantity x price). average_price = sum(quantity x price) / sum(quantity), 8 decimals half-up. Per account: half-up(shares x average) under unrounded_average, or half-up(shares x average rounded half-up to average_price_dp) under rounded_average_dp. residual_minor = total_minor - sum of account amounts; assign_largest adds it to the account with the most shares (ties to the first declared), report_unallocated leaves it unallocated. Identity: sum of final account amounts + unallocated residual = total_minor. The rounding basis and the residual rule are declared conventions of this tool, not a regulatory or fairness rule. Calculation check, not investment, legal or regulatory advice."
      },
      "golden_hash": "3934125b7c29ff869e10918db5791bcb108d6d251a7490ebae0665f0ad409578"
    },
    {
      "name": "V9b-duplicate-account",
      "policy_parameters": {
        "currency": "USD",
        "side": "buy",
        "fills": [
          {
            "price_per_share": "10.00",
            "quantity_shares": 2
          }
        ],
        "allocations": [
          {
            "account": "ACCT-A",
            "shares": 1
          },
          {
            "account": "ACCT-A",
            "shares": 1
          }
        ]
      },
      "output_payload": {
        "currency": "USD",
        "minor_unit_exponent": 2,
        "side": "buy",
        "amount_label": "cost",
        "amount_basis": "unrounded_average",
        "average_price_dp": null,
        "residual_handling": "assign_largest",
        "total_shares": null,
        "total_minor": null,
        "average_price": null,
        "rounded_average_price": null,
        "allocations": [],
        "residual_minor": null,
        "residual_account": null,
        "unallocated_residual_minor": null,
        "identity_holds": null,
        "overall": "INPUT_REFUSED",
        "refusals": [
          "allocations[1].account: REFUSED_INPUT_DUPLICATE_ACCOUNT"
        ],
        "warnings": [
          "INPUT_REFUSED"
        ],
        "note": "Average-price allocation in exact integer minor units (ISO 4217 minor unit for the declared currency). total_minor = half-up(sum of quantity x price). average_price = sum(quantity x price) / sum(quantity), 8 decimals half-up. Per account: half-up(shares x average) under unrounded_average, or half-up(shares x average rounded half-up to average_price_dp) under rounded_average_dp. residual_minor = total_minor - sum of account amounts; assign_largest adds it to the account with the most shares (ties to the first declared), report_unallocated leaves it unallocated. Identity: sum of final account amounts + unallocated residual = total_minor. The rounding basis and the residual rule are declared conventions of this tool, not a regulatory or fairness rule. Calculation check, not investment, legal or regulatory advice."
      },
      "golden_hash": "4629276f2c8ce03260b5fddf47c376a38038d916adfbb6c93a0d9a51def569d3"
    },
    {
      "name": "V9c-zero-share-row",
      "policy_parameters": {
        "currency": "USD",
        "side": "buy",
        "fills": [
          {
            "price_per_share": "10.00",
            "quantity_shares": 2
          }
        ],
        "allocations": [
          {
            "account": "ACCT-A",
            "shares": 2
          },
          {
            "account": "ACCT-B",
            "shares": 0
          }
        ]
      },
      "output_payload": {
        "currency": "USD",
        "minor_unit_exponent": 2,
        "side": "buy",
        "amount_label": "cost",
        "amount_basis": "unrounded_average",
        "average_price_dp": null,
        "residual_handling": "assign_largest",
        "total_shares": null,
        "total_minor": null,
        "average_price": null,
        "rounded_average_price": null,
        "allocations": [],
        "residual_minor": null,
        "residual_account": null,
        "unallocated_residual_minor": null,
        "identity_holds": null,
        "overall": "INPUT_REFUSED",
        "refusals": [
          "allocations[1].shares: REFUSED_INPUT_NOT_POSITIVE_INTEGER"
        ],
        "warnings": [
          "INPUT_REFUSED"
        ],
        "note": "Average-price allocation in exact integer minor units (ISO 4217 minor unit for the declared currency). total_minor = half-up(sum of quantity x price). average_price = sum(quantity x price) / sum(quantity), 8 decimals half-up. Per account: half-up(shares x average) under unrounded_average, or half-up(shares x average rounded half-up to average_price_dp) under rounded_average_dp. residual_minor = total_minor - sum of account amounts; assign_largest adds it to the account with the most shares (ties to the first declared), report_unallocated leaves it unallocated. Identity: sum of final account amounts + unallocated residual = total_minor. The rounding basis and the residual rule are declared conventions of this tool, not a regulatory or fairness rule. Calculation check, not investment, legal or regulatory advice."
      },
      "golden_hash": "1556ae1f3b4bab9f3bd212492c1759c47a6dde3bba6eaa6d0532f6ba8e6e8ad2"
    },
    {
      "name": "V9d-unknown-currency-ZZZ",
      "policy_parameters": {
        "currency": "ZZZ",
        "side": "buy",
        "fills": [
          {
            "price_per_share": "10.00",
            "quantity_shares": 2
          }
        ],
        "allocations": [
          {
            "account": "ACCT-A",
            "shares": 2
          }
        ]
      },
      "output_payload": {
        "currency": null,
        "minor_unit_exponent": null,
        "side": "buy",
        "amount_label": "cost",
        "amount_basis": "unrounded_average",
        "average_price_dp": null,
        "residual_handling": "assign_largest",
        "total_shares": null,
        "total_minor": null,
        "average_price": null,
        "rounded_average_price": null,
        "allocations": [],
        "residual_minor": null,
        "residual_account": null,
        "unallocated_residual_minor": null,
        "identity_holds": null,
        "overall": "INPUT_REFUSED",
        "refusals": [
          "currency: REFUSED_INPUT_UNKNOWN_CURRENCY"
        ],
        "warnings": [
          "INPUT_REFUSED"
        ],
        "note": "Average-price allocation in exact integer minor units (ISO 4217 minor unit for the declared currency). total_minor = half-up(sum of quantity x price). average_price = sum(quantity x price) / sum(quantity), 8 decimals half-up. Per account: half-up(shares x average) under unrounded_average, or half-up(shares x average rounded half-up to average_price_dp) under rounded_average_dp. residual_minor = total_minor - sum of account amounts; assign_largest adds it to the account with the most shares (ties to the first declared), report_unallocated leaves it unallocated. Identity: sum of final account amounts + unallocated residual = total_minor. The rounding basis and the residual rule are declared conventions of this tool, not a regulatory or fairness rule. Calculation check, not investment, legal or regulatory advice."
      },
      "golden_hash": "a56181e40730cb20c4aa8912bd3e311e877e49de6db6cb638435209ea993f031"
    },
    {
      "name": "V9e-price-nine-decimals",
      "policy_parameters": {
        "currency": "USD",
        "side": "buy",
        "fills": [
          {
            "price_per_share": "10.000000001",
            "quantity_shares": 2
          }
        ],
        "allocations": [
          {
            "account": "ACCT-A",
            "shares": 2
          }
        ]
      },
      "output_payload": {
        "currency": "USD",
        "minor_unit_exponent": 2,
        "side": "buy",
        "amount_label": "cost",
        "amount_basis": "unrounded_average",
        "average_price_dp": null,
        "residual_handling": "assign_largest",
        "total_shares": null,
        "total_minor": null,
        "average_price": null,
        "rounded_average_price": null,
        "allocations": [],
        "residual_minor": null,
        "residual_account": null,
        "unallocated_residual_minor": null,
        "identity_holds": null,
        "overall": "INPUT_REFUSED",
        "refusals": [
          "fills[0].price_per_share: REFUSED_INPUT_FORMAT"
        ],
        "warnings": [
          "INPUT_REFUSED"
        ],
        "note": "Average-price allocation in exact integer minor units (ISO 4217 minor unit for the declared currency). total_minor = half-up(sum of quantity x price). average_price = sum(quantity x price) / sum(quantity), 8 decimals half-up. Per account: half-up(shares x average) under unrounded_average, or half-up(shares x average rounded half-up to average_price_dp) under rounded_average_dp. residual_minor = total_minor - sum of account amounts; assign_largest adds it to the account with the most shares (ties to the first declared), report_unallocated leaves it unallocated. Identity: sum of final account amounts + unallocated residual = total_minor. The rounding basis and the residual rule are declared conventions of this tool, not a regulatory or fairness rule. Calculation check, not investment, legal or regulatory advice."
      },
      "golden_hash": "56392ab06f17bbb552175b98b915b63f9a4d852d930797c498e62e2e236020b7"
    },
    {
      "name": "V9f-average-price-dp-9",
      "policy_parameters": {
        "currency": "USD",
        "side": "buy",
        "fills": [
          {
            "price_per_share": "10.00",
            "quantity_shares": 2
          }
        ],
        "allocations": [
          {
            "account": "ACCT-A",
            "shares": 2
          }
        ],
        "amount_basis": "rounded_average_dp",
        "average_price_dp": 9,
        "residual_handling": "assign_largest"
      },
      "output_payload": {
        "currency": "USD",
        "minor_unit_exponent": 2,
        "side": "buy",
        "amount_label": "cost",
        "amount_basis": "rounded_average_dp",
        "average_price_dp": null,
        "residual_handling": "assign_largest",
        "total_shares": null,
        "total_minor": null,
        "average_price": null,
        "rounded_average_price": null,
        "allocations": [],
        "residual_minor": null,
        "residual_account": null,
        "unallocated_residual_minor": null,
        "identity_holds": null,
        "overall": "INPUT_REFUSED",
        "refusals": [
          "average_price_dp: REFUSED_INPUT_OUT_OF_RANGE"
        ],
        "warnings": [
          "INPUT_REFUSED"
        ],
        "note": "Average-price allocation in exact integer minor units (ISO 4217 minor unit for the declared currency). total_minor = half-up(sum of quantity x price). average_price = sum(quantity x price) / sum(quantity), 8 decimals half-up. Per account: half-up(shares x average) under unrounded_average, or half-up(shares x average rounded half-up to average_price_dp) under rounded_average_dp. residual_minor = total_minor - sum of account amounts; assign_largest adds it to the account with the most shares (ties to the first declared), report_unallocated leaves it unallocated. Identity: sum of final account amounts + unallocated residual = total_minor. The rounding basis and the residual rule are declared conventions of this tool, not a regulatory or fairness rule. Calculation check, not investment, legal or regulatory advice."
      },
      "golden_hash": "74716efce14acc8f32ef9d7af52edafa403ca48ac6c6609e18f299b6d6a923a5"
    },
    {
      "name": "V10-non-exact-total",
      "policy_parameters": {
        "currency": "USD",
        "side": "buy",
        "fills": [
          {
            "price_per_share": "3.335",
            "quantity_shares": 3
          }
        ],
        "allocations": [
          {
            "account": "ACCT-A",
            "shares": 3
          }
        ]
      },
      "output_payload": {
        "currency": "USD",
        "minor_unit_exponent": 2,
        "side": "buy",
        "amount_label": "cost",
        "amount_basis": "unrounded_average",
        "average_price_dp": null,
        "residual_handling": "assign_largest",
        "total_shares": 3,
        "total_minor": 1001,
        "average_price": "3.33500000",
        "rounded_average_price": null,
        "allocations": [
          {
            "account": "ACCT-A",
            "shares": 3,
            "amount_minor_pre_residual": 1001,
            "amount_minor": 1001
          }
        ],
        "residual_minor": 0,
        "residual_account": "ACCT-A",
        "unallocated_residual_minor": 0,
        "identity_holds": true,
        "overall": "ALLOCATION_COMPUTED",
        "refusals": [],
        "warnings": [],
        "note": "Average-price allocation in exact integer minor units (ISO 4217 minor unit for the declared currency). total_minor = half-up(sum of quantity x price). average_price = sum(quantity x price) / sum(quantity), 8 decimals half-up. Per account: half-up(shares x average) under unrounded_average, or half-up(shares x average rounded half-up to average_price_dp) under rounded_average_dp. residual_minor = total_minor - sum of account amounts; assign_largest adds it to the account with the most shares (ties to the first declared), report_unallocated leaves it unallocated. Identity: sum of final account amounts + unallocated residual = total_minor. The rounding basis and the residual rule are declared conventions of this tool, not a regulatory or fairness rule. Calculation check, not investment, legal or regulatory advice."
      },
      "golden_hash": "839299b05b94f01284cb813e7702e2a8f11288d29dcb8768741ed4ef98dde2be"
    },
    {
      "name": "R-currency-deleted",
      "policy_parameters": {
        "side": "buy",
        "fills": [
          {
            "price_per_share": "10.00",
            "quantity_shares": 1
          }
        ],
        "allocations": [
          {
            "account": "ACCT-A",
            "shares": 1
          }
        ]
      },
      "output_payload": {
        "currency": null,
        "minor_unit_exponent": null,
        "side": "buy",
        "amount_label": "cost",
        "amount_basis": "unrounded_average",
        "average_price_dp": null,
        "residual_handling": "assign_largest",
        "total_shares": null,
        "total_minor": null,
        "average_price": null,
        "rounded_average_price": null,
        "allocations": [],
        "residual_minor": null,
        "residual_account": null,
        "unallocated_residual_minor": null,
        "identity_holds": null,
        "overall": "INPUT_REFUSED",
        "refusals": [
          "currency: REFUSED_INPUT_MISSING"
        ],
        "warnings": [
          "INPUT_REFUSED"
        ],
        "note": "Average-price allocation in exact integer minor units (ISO 4217 minor unit for the declared currency). total_minor = half-up(sum of quantity x price). average_price = sum(quantity x price) / sum(quantity), 8 decimals half-up. Per account: half-up(shares x average) under unrounded_average, or half-up(shares x average rounded half-up to average_price_dp) under rounded_average_dp. residual_minor = total_minor - sum of account amounts; assign_largest adds it to the account with the most shares (ties to the first declared), report_unallocated leaves it unallocated. Identity: sum of final account amounts + unallocated residual = total_minor. The rounding basis and the residual rule are declared conventions of this tool, not a regulatory or fairness rule. Calculation check, not investment, legal or regulatory advice."
      },
      "golden_hash": "69599d4dedd3f10191c7956589f4a10505b5b67474a47bfb1f3a577b7a7978f8"
    },
    {
      "name": "R-side-wrong-case",
      "policy_parameters": {
        "currency": "USD",
        "side": "BUY",
        "fills": [
          {
            "price_per_share": "10.00",
            "quantity_shares": 1
          }
        ],
        "allocations": [
          {
            "account": "ACCT-A",
            "shares": 1
          }
        ]
      },
      "output_payload": {
        "currency": "USD",
        "minor_unit_exponent": 2,
        "side": null,
        "amount_label": null,
        "amount_basis": "unrounded_average",
        "average_price_dp": null,
        "residual_handling": "assign_largest",
        "total_shares": null,
        "total_minor": null,
        "average_price": null,
        "rounded_average_price": null,
        "allocations": [],
        "residual_minor": null,
        "residual_account": null,
        "unallocated_residual_minor": null,
        "identity_holds": null,
        "overall": "INPUT_REFUSED",
        "refusals": [
          "side: REFUSED_INPUT_NOT_ALLOWED"
        ],
        "warnings": [
          "INPUT_REFUSED"
        ],
        "note": "Average-price allocation in exact integer minor units (ISO 4217 minor unit for the declared currency). total_minor = half-up(sum of quantity x price). average_price = sum(quantity x price) / sum(quantity), 8 decimals half-up. Per account: half-up(shares x average) under unrounded_average, or half-up(shares x average rounded half-up to average_price_dp) under rounded_average_dp. residual_minor = total_minor - sum of account amounts; assign_largest adds it to the account with the most shares (ties to the first declared), report_unallocated leaves it unallocated. Identity: sum of final account amounts + unallocated residual = total_minor. The rounding basis and the residual rule are declared conventions of this tool, not a regulatory or fairness rule. Calculation check, not investment, legal or regulatory advice."
      },
      "golden_hash": "f1bddfb20501aaa7aa70348607bdc2ba195338d83d27da72259cc2cf1d0f5dc3"
    },
    {
      "name": "R-quantity-numeric-string",
      "policy_parameters": {
        "currency": "USD",
        "side": "buy",
        "fills": [
          {
            "price_per_share": "10.00",
            "quantity_shares": "1"
          }
        ],
        "allocations": [
          {
            "account": "ACCT-A",
            "shares": 1
          }
        ]
      },
      "output_payload": {
        "currency": "USD",
        "minor_unit_exponent": 2,
        "side": "buy",
        "amount_label": "cost",
        "amount_basis": "unrounded_average",
        "average_price_dp": null,
        "residual_handling": "assign_largest",
        "total_shares": null,
        "total_minor": null,
        "average_price": null,
        "rounded_average_price": null,
        "allocations": [],
        "residual_minor": null,
        "residual_account": null,
        "unallocated_residual_minor": null,
        "identity_holds": null,
        "overall": "INPUT_REFUSED",
        "refusals": [
          "fills[0].quantity_shares: REFUSED_INPUT_NOT_POSITIVE_INTEGER"
        ],
        "warnings": [
          "INPUT_REFUSED"
        ],
        "note": "Average-price allocation in exact integer minor units (ISO 4217 minor unit for the declared currency). total_minor = half-up(sum of quantity x price). average_price = sum(quantity x price) / sum(quantity), 8 decimals half-up. Per account: half-up(shares x average) under unrounded_average, or half-up(shares x average rounded half-up to average_price_dp) under rounded_average_dp. residual_minor = total_minor - sum of account amounts; assign_largest adds it to the account with the most shares (ties to the first declared), report_unallocated leaves it unallocated. Identity: sum of final account amounts + unallocated residual = total_minor. The rounding basis and the residual rule are declared conventions of this tool, not a regulatory or fairness rule. Calculation check, not investment, legal or regulatory advice."
      },
      "golden_hash": "b5d2544b45011d17537894d8b86ebd031435c68af02fc5d31250ca6f62033a97"
    },
    {
      "name": "R-price-as-number",
      "policy_parameters": {
        "currency": "USD",
        "side": "buy",
        "fills": [
          {
            "price_per_share": 10,
            "quantity_shares": 1
          }
        ],
        "allocations": [
          {
            "account": "ACCT-A",
            "shares": 1
          }
        ]
      },
      "output_payload": {
        "currency": "USD",
        "minor_unit_exponent": 2,
        "side": "buy",
        "amount_label": "cost",
        "amount_basis": "unrounded_average",
        "average_price_dp": null,
        "residual_handling": "assign_largest",
        "total_shares": null,
        "total_minor": null,
        "average_price": null,
        "rounded_average_price": null,
        "allocations": [],
        "residual_minor": null,
        "residual_account": null,
        "unallocated_residual_minor": null,
        "identity_holds": null,
        "overall": "INPUT_REFUSED",
        "refusals": [
          "fills[0].price_per_share: REFUSED_INPUT_WRONG_TYPE"
        ],
        "warnings": [
          "INPUT_REFUSED"
        ],
        "note": "Average-price allocation in exact integer minor units (ISO 4217 minor unit for the declared currency). total_minor = half-up(sum of quantity x price). average_price = sum(quantity x price) / sum(quantity), 8 decimals half-up. Per account: half-up(shares x average) under unrounded_average, or half-up(shares x average rounded half-up to average_price_dp) under rounded_average_dp. residual_minor = total_minor - sum of account amounts; assign_largest adds it to the account with the most shares (ties to the first declared), report_unallocated leaves it unallocated. Identity: sum of final account amounts + unallocated residual = total_minor. The rounding basis and the residual rule are declared conventions of this tool, not a regulatory or fairness rule. Calculation check, not investment, legal or regulatory advice."
      },
      "golden_hash": "a0630e31ea055298a88e1904cb67c85c83146ec4d2cbf36b734e524b30d2db3d"
    },
    {
      "name": "R-price-zero",
      "policy_parameters": {
        "currency": "USD",
        "side": "buy",
        "fills": [
          {
            "price_per_share": "0.00",
            "quantity_shares": 1
          }
        ],
        "allocations": [
          {
            "account": "ACCT-A",
            "shares": 1
          }
        ]
      },
      "output_payload": {
        "currency": "USD",
        "minor_unit_exponent": 2,
        "side": "buy",
        "amount_label": "cost",
        "amount_basis": "unrounded_average",
        "average_price_dp": null,
        "residual_handling": "assign_largest",
        "total_shares": null,
        "total_minor": null,
        "average_price": null,
        "rounded_average_price": null,
        "allocations": [],
        "residual_minor": null,
        "residual_account": null,
        "unallocated_residual_minor": null,
        "identity_holds": null,
        "overall": "INPUT_REFUSED",
        "refusals": [
          "fills[0].price_per_share: REFUSED_INPUT_FORMAT"
        ],
        "warnings": [
          "INPUT_REFUSED"
        ],
        "note": "Average-price allocation in exact integer minor units (ISO 4217 minor unit for the declared currency). total_minor = half-up(sum of quantity x price). average_price = sum(quantity x price) / sum(quantity), 8 decimals half-up. Per account: half-up(shares x average) under unrounded_average, or half-up(shares x average rounded half-up to average_price_dp) under rounded_average_dp. residual_minor = total_minor - sum of account amounts; assign_largest adds it to the account with the most shares (ties to the first declared), report_unallocated leaves it unallocated. Identity: sum of final account amounts + unallocated residual = total_minor. The rounding basis and the residual rule are declared conventions of this tool, not a regulatory or fairness rule. Calculation check, not investment, legal or regulatory advice."
      },
      "golden_hash": "dcb8dd9edb33912094c75e6c1a61d11c7aed63c63e02a2f7fe49d61369255330"
    },
    {
      "name": "R-shares-unsafe-integer",
      "policy_parameters": {
        "currency": "USD",
        "side": "buy",
        "fills": [
          {
            "price_per_share": "1.00",
            "quantity_shares": 1
          }
        ],
        "allocations": [
          {
            "account": "ACCT-A",
            "shares": 9007199254740991
          }
        ]
      },
      "output_payload": {
        "currency": "USD",
        "minor_unit_exponent": 2,
        "side": "buy",
        "amount_label": "cost",
        "amount_basis": "unrounded_average",
        "average_price_dp": null,
        "residual_handling": "assign_largest",
        "total_shares": null,
        "total_minor": null,
        "average_price": null,
        "rounded_average_price": null,
        "allocations": [],
        "residual_minor": null,
        "residual_account": null,
        "unallocated_residual_minor": null,
        "identity_holds": null,
        "overall": "INPUT_REFUSED",
        "refusals": [
          "allocations: REFUSED_INPUT_SHARES_MISMATCH"
        ],
        "warnings": [
          "INPUT_REFUSED"
        ],
        "note": "Average-price allocation in exact integer minor units (ISO 4217 minor unit for the declared currency). total_minor = half-up(sum of quantity x price). average_price = sum(quantity x price) / sum(quantity), 8 decimals half-up. Per account: half-up(shares x average) under unrounded_average, or half-up(shares x average rounded half-up to average_price_dp) under rounded_average_dp. residual_minor = total_minor - sum of account amounts; assign_largest adds it to the account with the most shares (ties to the first declared), report_unallocated leaves it unallocated. Identity: sum of final account amounts + unallocated residual = total_minor. The rounding basis and the residual rule are declared conventions of this tool, not a regulatory or fairness rule. Calculation check, not investment, legal or regulatory advice."
      },
      "golden_hash": "fba63200b7cd97c6aa6cf44d8dc034a3c3d0edc0ac36820da84608349d2f61d2"
    },
    {
      "name": "R-prototype-name-currency",
      "policy_parameters": {
        "currency": "constructor",
        "side": "buy",
        "fills": [
          {
            "price_per_share": "1.00",
            "quantity_shares": 1
          }
        ],
        "allocations": [
          {
            "account": "__proto__",
            "shares": 1
          }
        ]
      },
      "output_payload": {
        "currency": null,
        "minor_unit_exponent": null,
        "side": "buy",
        "amount_label": "cost",
        "amount_basis": "unrounded_average",
        "average_price_dp": null,
        "residual_handling": "assign_largest",
        "total_shares": null,
        "total_minor": null,
        "average_price": null,
        "rounded_average_price": null,
        "allocations": [],
        "residual_minor": null,
        "residual_account": null,
        "unallocated_residual_minor": null,
        "identity_holds": null,
        "overall": "INPUT_REFUSED",
        "refusals": [
          "currency: REFUSED_INPUT_UNKNOWN_CURRENCY"
        ],
        "warnings": [
          "INPUT_REFUSED"
        ],
        "note": "Average-price allocation in exact integer minor units (ISO 4217 minor unit for the declared currency). total_minor = half-up(sum of quantity x price). average_price = sum(quantity x price) / sum(quantity), 8 decimals half-up. Per account: half-up(shares x average) under unrounded_average, or half-up(shares x average rounded half-up to average_price_dp) under rounded_average_dp. residual_minor = total_minor - sum of account amounts; assign_largest adds it to the account with the most shares (ties to the first declared), report_unallocated leaves it unallocated. Identity: sum of final account amounts + unallocated residual = total_minor. The rounding basis and the residual rule are declared conventions of this tool, not a regulatory or fairness rule. Calculation check, not investment, legal or regulatory advice."
      },
      "golden_hash": "f1e1934b862d0aa99776ccc92842ffbcebb938fec24d2a495d7efdd31d071058"
    },
    {
      "name": "R-prototype-name-account-ok",
      "policy_parameters": {
        "currency": "EUR",
        "side": "sell",
        "fills": [
          {
            "price_per_share": "2.50",
            "quantity_shares": 4
          }
        ],
        "allocations": [
          {
            "account": "constructor",
            "shares": 2
          },
          {
            "account": "toString",
            "shares": 2
          }
        ]
      },
      "output_payload": {
        "currency": "EUR",
        "minor_unit_exponent": 2,
        "side": "sell",
        "amount_label": "proceeds",
        "amount_basis": "unrounded_average",
        "average_price_dp": null,
        "residual_handling": "assign_largest",
        "total_shares": 4,
        "total_minor": 1000,
        "average_price": "2.50000000",
        "rounded_average_price": null,
        "allocations": [
          {
            "account": "constructor",
            "shares": 2,
            "amount_minor_pre_residual": 500,
            "amount_minor": 500
          },
          {
            "account": "toString",
            "shares": 2,
            "amount_minor_pre_residual": 500,
            "amount_minor": 500
          }
        ],
        "residual_minor": 0,
        "residual_account": "constructor",
        "unallocated_residual_minor": 0,
        "identity_holds": true,
        "overall": "ALLOCATION_COMPUTED",
        "refusals": [],
        "warnings": [],
        "note": "Average-price allocation in exact integer minor units (ISO 4217 minor unit for the declared currency). total_minor = half-up(sum of quantity x price). average_price = sum(quantity x price) / sum(quantity), 8 decimals half-up. Per account: half-up(shares x average) under unrounded_average, or half-up(shares x average rounded half-up to average_price_dp) under rounded_average_dp. residual_minor = total_minor - sum of account amounts; assign_largest adds it to the account with the most shares (ties to the first declared), report_unallocated leaves it unallocated. Identity: sum of final account amounts + unallocated residual = total_minor. The rounding basis and the residual rule are declared conventions of this tool, not a regulatory or fairness rule. Calculation check, not investment, legal or regulatory advice."
      },
      "golden_hash": "eb7d46fa3670fd5e3191b2b7c667d3890f96652083db144c1ae6ebc0f0d0385f"
    },
    {
      "name": "R-dp-on-unrounded-basis",
      "policy_parameters": {
        "currency": "USD",
        "side": "buy",
        "fills": [
          {
            "price_per_share": "1.00",
            "quantity_shares": 1
          }
        ],
        "allocations": [
          {
            "account": "ACCT-A",
            "shares": 1
          }
        ],
        "average_price_dp": 2
      },
      "output_payload": {
        "currency": "USD",
        "minor_unit_exponent": 2,
        "side": "buy",
        "amount_label": "cost",
        "amount_basis": "unrounded_average",
        "average_price_dp": null,
        "residual_handling": "assign_largest",
        "total_shares": null,
        "total_minor": null,
        "average_price": null,
        "rounded_average_price": null,
        "allocations": [],
        "residual_minor": null,
        "residual_account": null,
        "unallocated_residual_minor": null,
        "identity_holds": null,
        "overall": "INPUT_REFUSED",
        "refusals": [
          "average_price_dp: REFUSED_INPUT_NOT_APPLICABLE"
        ],
        "warnings": [
          "INPUT_REFUSED"
        ],
        "note": "Average-price allocation in exact integer minor units (ISO 4217 minor unit for the declared currency). total_minor = half-up(sum of quantity x price). average_price = sum(quantity x price) / sum(quantity), 8 decimals half-up. Per account: half-up(shares x average) under unrounded_average, or half-up(shares x average rounded half-up to average_price_dp) under rounded_average_dp. residual_minor = total_minor - sum of account amounts; assign_largest adds it to the account with the most shares (ties to the first declared), report_unallocated leaves it unallocated. Identity: sum of final account amounts + unallocated residual = total_minor. The rounding basis and the residual rule are declared conventions of this tool, not a regulatory or fairness rule. Calculation check, not investment, legal or regulatory advice."
      },
      "golden_hash": "8b579694260f6423a54b66677caa68d9720d5192a840c8ac3a1b93bf0be912fc"
    },
    {
      "name": "R-unknown-fill-key",
      "policy_parameters": {
        "currency": "USD",
        "side": "buy",
        "fills": [
          {
            "price_per_share": "1.00",
            "quantity_shares": 1,
            "venue": "X"
          }
        ],
        "allocations": [
          {
            "account": "ACCT-A",
            "shares": 1
          }
        ]
      },
      "output_payload": {
        "currency": "USD",
        "minor_unit_exponent": 2,
        "side": "buy",
        "amount_label": "cost",
        "amount_basis": "unrounded_average",
        "average_price_dp": null,
        "residual_handling": "assign_largest",
        "total_shares": null,
        "total_minor": null,
        "average_price": null,
        "rounded_average_price": null,
        "allocations": [],
        "residual_minor": null,
        "residual_account": null,
        "unallocated_residual_minor": null,
        "identity_holds": null,
        "overall": "INPUT_REFUSED",
        "refusals": [
          "fills[0].venue: REFUSED_INPUT_UNKNOWN_KEY"
        ],
        "warnings": [
          "INPUT_REFUSED"
        ],
        "note": "Average-price allocation in exact integer minor units (ISO 4217 minor unit for the declared currency). total_minor = half-up(sum of quantity x price). average_price = sum(quantity x price) / sum(quantity), 8 decimals half-up. Per account: half-up(shares x average) under unrounded_average, or half-up(shares x average rounded half-up to average_price_dp) under rounded_average_dp. residual_minor = total_minor - sum of account amounts; assign_largest adds it to the account with the most shares (ties to the first declared), report_unallocated leaves it unallocated. Identity: sum of final account amounts + unallocated residual = total_minor. The rounding basis and the residual rule are declared conventions of this tool, not a regulatory or fairness rule. Calculation check, not investment, legal or regulatory advice."
      },
      "golden_hash": "675d2e1866499b819d2f27e4515ef2b0e5711e27ad95859351f59b3d7ecbb644"
    },
    {
      "name": "R-bhd-three-minor",
      "policy_parameters": {
        "currency": "BHD",
        "side": "buy",
        "fills": [
          {
            "price_per_share": "1.2345",
            "quantity_shares": 3
          }
        ],
        "allocations": [
          {
            "account": "ACCT-A",
            "shares": 2
          },
          {
            "account": "ACCT-B",
            "shares": 1
          }
        ]
      },
      "output_payload": {
        "currency": "BHD",
        "minor_unit_exponent": 3,
        "side": "buy",
        "amount_label": "cost",
        "amount_basis": "unrounded_average",
        "average_price_dp": null,
        "residual_handling": "assign_largest",
        "total_shares": 3,
        "total_minor": 3704,
        "average_price": "1.23450000",
        "rounded_average_price": null,
        "allocations": [
          {
            "account": "ACCT-A",
            "shares": 2,
            "amount_minor_pre_residual": 2469,
            "amount_minor": 2469
          },
          {
            "account": "ACCT-B",
            "shares": 1,
            "amount_minor_pre_residual": 1235,
            "amount_minor": 1235
          }
        ],
        "residual_minor": 0,
        "residual_account": "ACCT-A",
        "unallocated_residual_minor": 0,
        "identity_holds": true,
        "overall": "ALLOCATION_COMPUTED",
        "refusals": [],
        "warnings": [],
        "note": "Average-price allocation in exact integer minor units (ISO 4217 minor unit for the declared currency). total_minor = half-up(sum of quantity x price). average_price = sum(quantity x price) / sum(quantity), 8 decimals half-up. Per account: half-up(shares x average) under unrounded_average, or half-up(shares x average rounded half-up to average_price_dp) under rounded_average_dp. residual_minor = total_minor - sum of account amounts; assign_largest adds it to the account with the most shares (ties to the first declared), report_unallocated leaves it unallocated. Identity: sum of final account amounts + unallocated residual = total_minor. The rounding basis and the residual rule are declared conventions of this tool, not a regulatory or fairness rule. Calculation check, not investment, legal or regulatory advice."
      },
      "golden_hash": "7c91ff76f0b7b0b595d82a44753112dc8e2b6e8138fa2530c9c148c1492f4ab1"
    },
    {
      "name": "R-rounded-dp0",
      "policy_parameters": {
        "currency": "USD",
        "side": "sell",
        "fills": [
          {
            "price_per_share": "10.40",
            "quantity_shares": 1
          },
          {
            "price_per_share": "10.70",
            "quantity_shares": 1
          }
        ],
        "allocations": [
          {
            "account": "ACCT-A",
            "shares": 1
          },
          {
            "account": "ACCT-B",
            "shares": 1
          }
        ],
        "amount_basis": "rounded_average_dp",
        "average_price_dp": 0,
        "residual_handling": "report_unallocated"
      },
      "output_payload": {
        "currency": "USD",
        "minor_unit_exponent": 2,
        "side": "sell",
        "amount_label": "proceeds",
        "amount_basis": "rounded_average_dp",
        "average_price_dp": 0,
        "residual_handling": "report_unallocated",
        "total_shares": 2,
        "total_minor": 2110,
        "average_price": "10.55000000",
        "rounded_average_price": "11",
        "allocations": [
          {
            "account": "ACCT-A",
            "shares": 1,
            "amount_minor_pre_residual": 1100,
            "amount_minor": 1100
          },
          {
            "account": "ACCT-B",
            "shares": 1,
            "amount_minor_pre_residual": 1100,
            "amount_minor": 1100
          }
        ],
        "residual_minor": -90,
        "residual_account": null,
        "unallocated_residual_minor": -90,
        "identity_holds": true,
        "overall": "ALLOCATION_COMPUTED",
        "refusals": [],
        "warnings": [
          "RESIDUAL_UNALLOCATED"
        ],
        "note": "Average-price allocation in exact integer minor units (ISO 4217 minor unit for the declared currency). total_minor = half-up(sum of quantity x price). average_price = sum(quantity x price) / sum(quantity), 8 decimals half-up. Per account: half-up(shares x average) under unrounded_average, or half-up(shares x average rounded half-up to average_price_dp) under rounded_average_dp. residual_minor = total_minor - sum of account amounts; assign_largest adds it to the account with the most shares (ties to the first declared), report_unallocated leaves it unallocated. Identity: sum of final account amounts + unallocated residual = total_minor. The rounding basis and the residual rule are declared conventions of this tool, not a regulatory or fairness rule. Calculation check, not investment, legal or regulatory advice."
      },
      "golden_hash": "9124e63f1293e58e4dee7194056f1957b9b8877e0b9ed4c0146e46010ff6cd3d"
    }
  ]
}
