Skip to content

Investment · Calculation

Correlated property stress scenarios

Models up to sixteen explicit shocks and a bounded seeded distribution. The six factors are insurance, HOA, property tax, vacancy, rent drop and capital expense, in that order. Supply a symmetric positive-semidefinite correlation matrix, with ones on the diagonal. Results include cash-flow percentiles, reserve breaches and a tornado sensitivity table.

Open Rental Stress Test Calculator in HT Calc

This HT Calc screen includes a Pro sample for visitors.

Example result · state: available See output

Cost per success
20 calculation credits
Production plans
Standard, Business, Scale, Enterprise
Plan allowances
Free sandbox
Not available

Integration example

Make a request

Use a production key scoped to investor-correlated-stress.

Keep the key on your server. A successful call uses 20 calculation credits.

Production request

Set HT_PRODUCTION_KEY on your server. Save as example.mjs and run node example.mjs with Node.js 18 or later.

import { randomUUID } from "node:crypto";

const key = process.env.HT_PRODUCTION_KEY;
if (!key) throw new Error("Set HT_PRODUCTION_KEY on your server.");
const endpoint = "https://calc.hasstechapi.com/v2/calc/investor-correlated-stress";
const input = {
  "annualScheduledRent": 30000,
  "baseVacancyPct": 5,
  "annualInsurance": 1200,
  "annualHoa": 0,
  "annualPropertyTax": 2400,
  "annualOtherExpenses": 6000,
  "annualDebtService": 12000,
  "startingReserves": 12000,
  "minimumDscr": 1.25,
  "scenarios": [
    {
      "insuranceIncreasePct": 20,
      "hoaIncreasePct": 0,
      "taxIncreasePct": 10,
      "vacancyIncreasePctPoints": 5,
      "rentDecreasePct": 10,
      "capexShock": 1000
    }
  ],
  "simulation": {
    "seed": 123,
    "samples": 100,
    "factorScales": [
      20,
      0,
      10,
      5,
      10,
      1000
    ],
    "correlation": [
      [
        1,
        0,
        0,
        0,
        0,
        0
      ],
      [
        0,
        1,
        0,
        0,
        0,
        0
      ],
      [
        0,
        0,
        1,
        0,
        0,
        0
      ],
      [
        0,
        0,
        0,
        1,
        0,
        0
      ],
      [
        0,
        0,
        0,
        0,
        1,
        0
      ],
      [
        0,
        0,
        0,
        0,
        0,
        1
      ]
    ]
  }
};
const requestId = process.env.HT_REQUEST_ID || Date.now() + "." + randomUUID();
// Keep this ID to look up usage if the connection is interrupted.
console.error("Usage lookup ID:", requestId);

const response = await fetch(endpoint, {
  method: "POST",
  redirect: "error",
  headers: {
    "Authorization": "Bearer " + key,
    "Content-Type": "application/json",
    "Idempotency-Key": requestId
  },
  body: JSON.stringify(input)
});
if (!response.ok) {
  const problem = await response.json().catch(() => null);
  const code = problem?.error?.code || response.statusText;
  const delay = response.headers.get("retry-after");
  if (delay) console.error("Retry-After (seconds):", delay);
  console.error("HTTP " + response.status + " " + code + ". Usage lookup ID: " + requestId);
  if (Array.isArray(problem?.error?.details)) {
    for (const issue of problem.error.details) console.error("Input issue:", JSON.stringify(issue));
  }
  process.exitCode = 1;
} else {
  console.log(JSON.stringify(await response.json(), null, 2));
}
cURL (shell)

Set HT_PRODUCTION_KEY on your server. Run in a POSIX shell with cURL 7.76+ and Python 3.7+ to create a request ID.

(
  set -eu
  : "${HT_PRODUCTION_KEY:?Set HT_PRODUCTION_KEY on your server}"
  request_id="${HT_REQUEST_ID:-}"
  if [ -z "$request_id" ]; then
    request_id=$(python3 -c 'import time, uuid; print(str(time.time_ns() // 1000000) + "." + str(uuid.uuid4()))')
  fi
  printf 'Usage lookup ID: %s\n' "$request_id" >&2
  # On INVALID_INPUT, read error.details in the JSON response body.
  curl --disable --silent --show-error --fail-with-body --include \
    --request POST 'https://calc.hasstechapi.com/v2/calc/investor-correlated-stress' \
    --header "Authorization: Bearer $HT_PRODUCTION_KEY" \
    --header 'Content-Type: application/json' \
    --header "Idempotency-Key: $request_id" \
    --data-binary @- <<'HT_INPUT'
{
  "annualScheduledRent": 30000,
  "baseVacancyPct": 5,
  "annualInsurance": 1200,
  "annualHoa": 0,
  "annualPropertyTax": 2400,
  "annualOtherExpenses": 6000,
  "annualDebtService": 12000,
  "startingReserves": 12000,
  "minimumDscr": 1.25,
  "scenarios": [
    {
      "insuranceIncreasePct": 20,
      "hoaIncreasePct": 0,
      "taxIncreasePct": 10,
      "vacancyIncreasePctPoints": 5,
      "rentDecreasePct": 10,
      "capexShock": 1000
    }
  ],
  "simulation": {
    "seed": 123,
    "samples": 100,
    "factorScales": [
      20,
      0,
      10,
      5,
      10,
      1000
    ],
    "correlation": [
      [
        1,
        0,
        0,
        0,
        0,
        0
      ],
      [
        0,
        1,
        0,
        0,
        0,
        0
      ],
      [
        0,
        0,
        1,
        0,
        0,
        0
      ],
      [
        0,
        0,
        0,
        1,
        0,
        0
      ],
      [
        0,
        0,
        0,
        0,
        1,
        0
      ],
      [
        0,
        0,
        0,
        0,
        0,
        1
      ]
    ]
  }
}
HT_INPUT
)
If your request fails
400 INVALID_INPUT

Read error.details when present. Node prints each issue. cURL returns the JSON body. Each path points into your request. An empty path refers to the whole body.

Check the accepted inputs for required fields, units and ranges. Send the corrected JSON as a new request.

401 or 403
Check that the server has the bearer key for the endpoint’s environment and that the key includes investor-correlated-stress.
429
Read the service error code, check your allowance, and wait for the Retry-After interval when supplied before trying again.
Lost response, 409 or 503
Open Request lookup, select the same environment and enter the printed usage lookup ID. A settled ID has already consumed credits. To retry the same calculation, set HT_REQUEST_ID to the original ID and reuse the same inputs. A settled request does not return its result again. Unset the variable for a new request, which can consume credits.

The usage lookup ID is the Idempotency-Key your server sends. The response’s x-request-id identifies the HTTP exchange for support.

Output

Example result

These values come from running this operation on the example inputs.

state
available
formulaVersion
stress-correlated-simulation-1.1.0
value.base.name
Base
How to interpret this result
  • Models up to sixteen explicit shocks and a bounded seeded distribution. The six factors are insurance, HOA, property tax, vacancy, rent drop and capital expense, in that order. Supply a symmetric positive-semidefinite correlation matrix, with ones on the diagonal. Results include cash-flow percentiles, reserve breaches and a tornado sensitivity table.
Full example response (JSON)
{
  "status": "available",
  "result": {
    "state": "available",
    "fieldErrors": {},
    "warnings": [],
    "assumptions": [],
    "provenance": [],
    "formulaVersion": "stress-correlated-simulation-1.1.0",
    "ruleVersions": [],
    "auditTrail": [
      "Correlation matrix passed symmetry, bounds, diagonal, and Cholesky positive-semidefinite checks.",
      "100 adverse-only correlated samples generated from seed 123."
    ],
    "value": {
      "base": {
        "name": "Base",
        "effectiveRevenue": "28500",
        "operatingExpenses": "9600",
        "noi": "18900",
        "dscr": "1.575",
        "endingReserves": "18900",
        "covenantBreaches": []
      },
      "scenarios": [
        {
          "name": "Scenario 1",
          "effectiveRevenue": "24300",
          "operatingExpenses": "11080",
          "noi": "13220",
          "dscr": "1.101666666666666666666666666666666666667",
          "endingReserves": "13220",
          "covenantBreaches": [
            "DSCR 1.102 is below 1.250."
          ]
        }
      ],
      "simulation": {
        "p10": "-318.82",
        "p50": "2490.47",
        "p90": "4945.07",
        "seed": 123,
        "samples": 100
      },
      "tornado": [
        {
          "factor": "rent",
          "cashFlowImpact": "-2850"
        },
        {
          "factor": "vacancy",
          "cashFlowImpact": "-1500"
        },
        {
          "factor": "capex",
          "cashFlowImpact": "-1000"
        },
        {
          "factor": "insurance",
          "cashFlowImpact": "-240"
        },
        {
          "factor": "tax",
          "cashFlowImpact": "-240"
        },
        {
          "factor": "hoa",
          "cashFlowImpact": "0"
        }
      ],
      "correlationValidated": true
    }
  },
  "formulaVersion": "stress-correlated-simulation-1.1.0",
  "units": {
    "baseRentAndCosts": "USD per year",
    "startingReserves": "USD",
    "minimumDscr": "ratio",
    "vacancyIncreasePctPoints": "percentage points",
    "rentDecreasePct": "percent of scheduled rent",
    "capexShock": "USD per year",
    "factorScales": "[insurance %, HOA %, tax %, vacancy percentage points, rent %, USD capex]",
    "correlation": "six by six correlation coefficients",
    "p10": "USD annual cash flow",
    "p50": "USD annual cash flow",
    "p90": "USD annual cash flow"
  },
  "assumptions": [
    "Models up to sixteen explicit shocks and a bounded seeded distribution. The six factors are insurance, HOA, property tax, vacancy, rent drop and capital expense, in that order. Supply a symmetric positive-semidefinite correlation matrix, with ones on the diagonal. Results include cash-flow percentiles, reserve breaches and a tornado sensitivity table."
  ],
  "warnings": [],
  "creditCost": 20
}

Request contract

Accepted inputs

Fields for this example. Expand the schema for all supported combinations and limits.

FieldType, units and limits

annualScheduledRentRequired
number

Gross scheduled rent before vacancy, in USD per year.

Min 0 · Max 1000000000
baseVacancyPctRequired
number

Uncollected share of scheduled rent, in percent (5 means 5%).

Min 0 · Max 100
annualInsuranceRequired
number

Base insurance cost, in USD per year.

Min 0 · Max 1000000000
annualHoaRequired
number

Base association fees, in USD per year.

Min 0 · Max 1000000000
annualPropertyTaxRequired
number

Base property taxes, in USD per year.

Min 0 · Max 1000000000
annualOtherExpensesRequired
number

Operating costs outside insurance, HOA and property taxes, in USD per year.

Min 0 · Max 1000000000
annualDebtServiceRequired
number

Debt service, in USD per year.

Min 0 · Max 1000000000
startingReservesRequired
number

Cash reserves before the modeled year, in USD.

Min 0 · Max 1000000000
minimumDscrRequired
number

Minimum ratio of annual net operating income to annual debt service (1.25 means 1.25×).

Min 0 · Max 100
scenariosRequired
arrayMin items 1 · Max items 16
scenarios[].insuranceIncreasePctRequired
number

Scenario increase in base insurance cost, in percent.

Min 0 · Max 100
scenarios[].hoaIncreasePctRequired
number

Scenario increase in base association fees, in percent.

Min 0 · Max 100
scenarios[].taxIncreasePctRequired
number

Scenario increase in base property taxes, in percent.

Min 0 · Max 100
scenarios[].vacancyIncreasePctPointsRequired
number

Scenario addition to base vacancy, in percentage points.

Min 0 · Max 100
scenarios[].rentDecreasePctRequired
number

Scenario decrease in scheduled rent, in percent.

Min 0 · Max 100
scenarios[].capexShockRequired
number

Additional one-time capital expense in the scenario year, in USD.

Min 0 · Max 1000000000
simulationRequired
object
simulation.seedRequired
integer

Unsigned integer seed for reproducible pseudorandom sampling, unitless.

Min 0 · Max 4294967295
simulation.samplesRequired
integer

Count of simulated adverse scenarios used to compute the percentile distribution.

Min 100 · Max 1000
simulation.factorScalesRequired
arrayMin items 6 · Max items 6
simulation.correlationRequired
arrayMin items 6 · Max items 6
Example request body (JSON)
{
  "annualScheduledRent": 30000,
  "baseVacancyPct": 5,
  "annualInsurance": 1200,
  "annualHoa": 0,
  "annualPropertyTax": 2400,
  "annualOtherExpenses": 6000,
  "annualDebtService": 12000,
  "startingReserves": 12000,
  "minimumDscr": 1.25,
  "scenarios": [
    {
      "insuranceIncreasePct": 20,
      "hoaIncreasePct": 0,
      "taxIncreasePct": 10,
      "vacancyIncreasePctPoints": 5,
      "rentDecreasePct": 10,
      "capexShock": 1000
    }
  ],
  "simulation": {
    "seed": 123,
    "samples": 100,
    "factorScales": [
      20,
      0,
      10,
      5,
      10,
      1000
    ],
    "correlation": [
      [
        1,
        0,
        0,
        0,
        0,
        0
      ],
      [
        0,
        1,
        0,
        0,
        0,
        0
      ],
      [
        0,
        0,
        1,
        0,
        0,
        0
      ],
      [
        0,
        0,
        0,
        1,
        0,
        0
      ],
      [
        0,
        0,
        0,
        0,
        1,
        0
      ],
      [
        0,
        0,
        0,
        0,
        0,
        1
      ]
    ]
  }
}
Full JSON schema
{
  "type": "object",
  "properties": {
    "annualScheduledRent": {
      "type": "number",
      "minimum": 0,
      "maximum": 1000000000,
      "description": "Gross scheduled rent before vacancy, in USD per year."
    },
    "baseVacancyPct": {
      "type": "number",
      "minimum": 0,
      "maximum": 100,
      "description": "Uncollected share of scheduled rent, in percent (5 means 5%)."
    },
    "annualInsurance": {
      "type": "number",
      "minimum": 0,
      "maximum": 1000000000,
      "description": "Base insurance cost, in USD per year."
    },
    "annualHoa": {
      "type": "number",
      "minimum": 0,
      "maximum": 1000000000,
      "description": "Base association fees, in USD per year."
    },
    "annualPropertyTax": {
      "type": "number",
      "minimum": 0,
      "maximum": 1000000000,
      "description": "Base property taxes, in USD per year."
    },
    "annualOtherExpenses": {
      "type": "number",
      "minimum": 0,
      "maximum": 1000000000,
      "description": "Operating costs outside insurance, HOA and property taxes, in USD per year."
    },
    "annualDebtService": {
      "type": "number",
      "minimum": 0,
      "maximum": 1000000000,
      "description": "Debt service, in USD per year."
    },
    "startingReserves": {
      "type": "number",
      "minimum": 0,
      "maximum": 1000000000,
      "description": "Cash reserves before the modeled year, in USD."
    },
    "minimumDscr": {
      "type": "number",
      "minimum": 0,
      "maximum": 100,
      "description": "Minimum ratio of annual net operating income to annual debt service (1.25 means 1.25×)."
    },
    "scenarios": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "insuranceIncreasePct": {
            "type": "number",
            "minimum": 0,
            "maximum": 100,
            "description": "Scenario increase in base insurance cost, in percent."
          },
          "hoaIncreasePct": {
            "type": "number",
            "minimum": 0,
            "maximum": 100,
            "description": "Scenario increase in base association fees, in percent."
          },
          "taxIncreasePct": {
            "type": "number",
            "minimum": 0,
            "maximum": 100,
            "description": "Scenario increase in base property taxes, in percent."
          },
          "vacancyIncreasePctPoints": {
            "type": "number",
            "minimum": 0,
            "maximum": 100,
            "description": "Scenario addition to base vacancy, in percentage points."
          },
          "rentDecreasePct": {
            "type": "number",
            "minimum": 0,
            "maximum": 100,
            "description": "Scenario decrease in scheduled rent, in percent."
          },
          "capexShock": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000,
            "description": "Additional one-time capital expense in the scenario year, in USD."
          }
        },
        "required": [
          "insuranceIncreasePct",
          "hoaIncreasePct",
          "taxIncreasePct",
          "vacancyIncreasePctPoints",
          "rentDecreasePct",
          "capexShock"
        ],
        "additionalProperties": false
      },
      "minItems": 1,
      "maxItems": 16
    },
    "simulation": {
      "type": "object",
      "properties": {
        "seed": {
          "type": "integer",
          "minimum": 0,
          "maximum": 4294967295,
          "description": "Unsigned integer seed for reproducible pseudorandom sampling, unitless."
        },
        "samples": {
          "type": "integer",
          "minimum": 100,
          "maximum": 1000,
          "description": "Count of simulated adverse scenarios used to compute the percentile distribution."
        },
        "factorScales": {
          "type": "array",
          "items": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000,
            "description": "Scale by index in order: insurance increase %, HOA increase %, tax increase %, vacancy percentage points, rent decrease %, then capital expense in USD."
          },
          "minItems": 6,
          "maxItems": 6
        },
        "correlation": {
          "type": "array",
          "items": {
            "type": "array",
            "items": {
              "type": "number",
              "minimum": -1,
              "maximum": 1,
              "description": "Unitless pairwise correlations from −1 through 1 in the same six-factor order as factorScales. Diagonal entries equal 1."
            },
            "minItems": 6,
            "maxItems": 6
          },
          "minItems": 6,
          "maxItems": 6
        }
      },
      "required": [
        "seed",
        "samples",
        "factorScales",
        "correlation"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "annualScheduledRent",
    "baseVacancyPct",
    "annualInsurance",
    "annualHoa",
    "annualPropertyTax",
    "annualOtherExpenses",
    "annualDebtService",
    "startingReserves",
    "minimumDscr",
    "scenarios",
    "simulation"
  ],
  "additionalProperties": false,
  "description": "Models up to sixteen explicit shocks and a bounded seeded distribution. The six factors are insurance, HOA, property tax, vacancy, rent drop and capital expense, in that order. Supply a symmetric positive-semidefinite correlation matrix, with ones on the diagonal. Results include cash-flow percentiles, reserve breaches and a tornado sensitivity table."
}

Production endpoint: POST https://calc.hasstechapi.com/v2/calc/investor-correlated-stress
Formula: stress-correlated-simulation-1.1.0