{"ref":{"kind":"component","id":"loan","key":"sha256:33676d8c2aa9c626539a101e18879e5105c01c13f0771e42de8ef014c3704422"},"label":"Term loan","description":"Fund and service one fixed-rate loan.","inputs":[{"label":"Amortization","name":"amortization","valueType":{"axes":[],"dtype":"i64","unit":"1"}},{"label":"Interest Only","name":"interest_only","valueType":{"axes":[],"dtype":"i64","unit":"1"}},{"label":"Principal","name":"principal","valueType":{"axes":[],"dtype":"f64","unit":"$"}},{"label":"Rate","name":"rate","valueType":{"axes":[],"dtype":"f64","unit":"%"}},{"label":"Term","name":"term","valueType":{"axes":[],"dtype":"i64","unit":"1"}}],"outputs":[{"label":"Amortization Domain","name":"amortization_domain","valueType":{"axes":[],"dtype":"f64","unit":"1"}},{"label":"Balance","name":"balance","valueType":{"axes":[{"extent":121,"name":"month","variable":false}],"dtype":"f64","unit":"$"}},{"label":"Balloon","name":"balloon","valueType":{"axes":[{"extent":121,"name":"month","variable":false}],"dtype":"f64","unit":"$"}},{"label":"Balloon Total","name":"balloon_total","valueType":{"axes":[],"dtype":"f64","unit":"$"}},{"label":"Closing","name":"closing","valueType":{"axes":[{"extent":121,"name":"month","variable":false}],"dtype":"f64","unit":"$"}},{"label":"Funding","name":"funding","valueType":{"axes":[{"extent":121,"name":"month","variable":false}],"dtype":"f64","unit":"$"}},{"label":"Interest","name":"interest","valueType":{"axes":[{"extent":121,"name":"month","variable":false}],"dtype":"f64","unit":"$"}},{"label":"Interest Only Bound","name":"interest_only_bound","valueType":{"axes":[],"dtype":"i64","unit":"1"}},{"label":"Interest Only Domain","name":"interest_only_domain","valueType":{"axes":[],"dtype":"f64","unit":"1"}},{"label":"Interest Total","name":"interest_total","valueType":{"axes":[],"dtype":"f64","unit":"$"}},{"label":"Nonnegative","name":"nonnegative","valueType":{"axes":[{"extent":121,"name":"month","variable":false}],"dtype":"f64","unit":"$"}},{"label":"Opening","name":"opening","valueType":{"axes":[{"extent":121,"name":"month","variable":false}],"dtype":"f64","unit":"$"}},{"label":"Payment","name":"payment","valueType":{"axes":[],"dtype":"f64","unit":"$"}},{"label":"Principal Domain","name":"principal_domain","valueType":{"axes":[],"dtype":"f64","unit":"$"}},{"label":"Rate Domain","name":"rate_domain","valueType":{"axes":[],"dtype":"f64","unit":"%"}},{"label":"Repayment","name":"repayment","valueType":{"axes":[{"extent":121,"name":"month","variable":false}],"dtype":"f64","unit":"$"}},{"label":"Service","name":"service","valueType":{"axes":[{"extent":121,"name":"month","variable":false}],"dtype":"f64","unit":"$"}},{"label":"Settled","name":"settled","valueType":{"axes":[{"extent":121,"name":"month","variable":false}],"dtype":"f64","unit":"$"}},{"label":"Term Domain","name":"term_domain","valueType":{"axes":[],"dtype":"f64","unit":"1"}}],"dependencies":[{"id":"loan_period","key":"sha256:2b75e34ee2cc03b534690f8a7e64cf8b335fad68799577f66fd97bbeb30ef5f1","kind":"component"}],"libraries":["loan"],"notes":{"conventions":["Fund the full principal at opening; opening has no interest or repayment.","Pay monthly in arrears. The periodic interest rate is the nominal annual rate divided by 12.","Start the amortization period after the interest-only period; keep the scheduled payment constant.","Cap scheduled principal at the outstanding balance, then repay the remainder at maturity.","Exclude fees, reserves, prepayments, additional draws, and day-count adjustments.","Retain full precision in calculations; round only for display."],"checks":[{"appliesWhen":null,"escalatesWhen":null,"failureRepair":null,"id":"interest_only_bound","inputs":["interest_only","term"],"kind":"value","label":"Interest only bound","message":"Interest-only months must not exceed the loan term.","notApplicableMessage":null,"output":"interest_only_bound","path":"interest_only","phase":"input","reducer":"all","relation":"at_most","role":"integrity","severity":"error","sourceInputs":[],"threshold":0.0,"unavailable":null},{"appliesWhen":null,"escalatesWhen":null,"failureRepair":null,"id":"balance","inputs":[],"kind":"value","label":"Balance","message":"Opening principal plus funding less repayments must equal closing principal.","notApplicableMessage":null,"output":"balance","path":"balance","phase":"model","reducer":"all","relation":"absolute","role":"integrity","severity":"error","sourceInputs":[],"threshold":1e-06,"unavailable":null},{"appliesWhen":null,"escalatesWhen":null,"failureRepair":null,"id":"settled","inputs":[],"kind":"value","label":"Settled","message":"Principal must be fully repaid at maturity and remain zero.","notApplicableMessage":null,"output":"settled","path":"settled","phase":"model","reducer":"all","relation":"absolute","role":"integrity","severity":"error","sourceInputs":[],"threshold":1e-06,"unavailable":null},{"appliesWhen":null,"escalatesWhen":null,"failureRepair":null,"id":"nonnegative","inputs":[],"kind":"value","label":"Nonnegative","message":"Principal must remain nonnegative.","notApplicableMessage":null,"output":"nonnegative","path":"nonnegative","phase":"model","reducer":"all","relation":"at_least","role":"integrity","severity":"error","sourceInputs":[],"threshold":-1e-06,"unavailable":null},{"appliesWhen":null,"escalatesWhen":null,"failureRepair":null,"id":"principal_domain","inputs":["principal"],"kind":"value","label":"Principal domain","message":"The input must be at least 0.","notApplicableMessage":null,"output":"principal_domain","path":"principal","phase":"input","reducer":"all","relation":"at_least","role":"integrity","severity":"error","sourceInputs":[],"threshold":0.0,"unavailable":null},{"appliesWhen":null,"escalatesWhen":null,"failureRepair":null,"id":"rate_domain","inputs":["rate"],"kind":"value","label":"Rate domain","message":"The input must be from 0 through 1.","notApplicableMessage":null,"output":"rate_domain","path":"rate","phase":"input","reducer":"all","relation":"at_least","role":"integrity","severity":"error","sourceInputs":[],"threshold":0.0,"unavailable":null},{"appliesWhen":null,"escalatesWhen":null,"failureRepair":null,"id":"term_domain","inputs":["term"],"kind":"value","label":"Term domain","message":"The input must be from 1 through 120.","notApplicableMessage":null,"output":"term_domain","path":"term","phase":"input","reducer":"all","relation":"at_least","role":"integrity","severity":"error","sourceInputs":[],"threshold":0.0,"unavailable":null},{"appliesWhen":null,"escalatesWhen":null,"failureRepair":null,"id":"interest_only_domain","inputs":["interest_only"],"kind":"value","label":"Interest only domain","message":"The input must be from 0 through 120.","notApplicableMessage":null,"output":"interest_only_domain","path":"interest_only","phase":"input","reducer":"all","relation":"at_least","role":"integrity","severity":"error","sourceInputs":[],"threshold":0.0,"unavailable":null},{"appliesWhen":null,"escalatesWhen":null,"failureRepair":null,"id":"amortization_domain","inputs":["amortization"],"kind":"value","label":"Amortization domain","message":"The input must be from 1 through 600.","notApplicableMessage":null,"output":"amortization_domain","path":"amortization","phase":"input","reducer":"all","relation":"at_least","role":"integrity","severity":"error","sourceInputs":[],"threshold":0.0,"unavailable":null}]},"calculation":{"nodes":[{"id":"input-amortization","label":"Amortization","kind":"input"},{"id":"input-interest_only","label":"Interest Only","kind":"input"},{"id":"input-principal","label":"Principal","kind":"input"},{"id":"input-rate","label":"Rate","kind":"input"},{"id":"input-term","label":"Term","kind":"input"},{"id":"output-amortization_domain","kind":"output","label":"Amortization Domain","rule":"Lower of (Amortization − 1) and (600 − Amortization)","sources":[{"node":"input-amortization"}]},{"id":"output-interest_only_domain","kind":"output","label":"Interest Only Domain","rule":"Lower of Interest Only and (120 − Interest Only)","sources":[{"node":"input-interest_only"}]},{"id":"output-principal_domain","kind":"output","label":"Principal Domain","rule":"Principal","sources":[{"node":"input-principal"}]},{"id":"step-value0","label":"(Rate ÷ 12)","kind":"step","rule":"(Rate ÷ 12)","sources":[{"node":"input-rate"}]},{"id":"output-rate_domain","kind":"output","label":"Rate Domain","rule":"Lower of Rate and (1 − Rate)","sources":[{"node":"input-rate"}]},{"id":"output-interest_only_bound","kind":"output","label":"Interest Only Bound","rule":"(Interest Only − Term)","sources":[{"node":"input-interest_only"},{"node":"input-term"}]},{"id":"output-term_domain","kind":"output","label":"Term Domain","rule":"Lower of (Term − 1) and (120 − Term)","sources":[{"node":"input-term"}]},{"id":"step-value1","label":"(((Rate ÷ 12) × Amortization) < 0.001)","kind":"step","rule":"(((Rate ÷ 12) × Amortization) < 0.001)","sources":[{"node":"step-value0"},{"node":"input-amortization"}]},{"id":"step-payment","label":"Payment","kind":"step","rule":"(Principal × if (((Rate ÷ 12) × Amortization) < 0.001), then (((1 ÷ Amortization) + (((Rate ÷ 12) × (Amortization + 1)) ÷ (2 × Amortization))) + ((((Rate ÷ 12) ^ 2) × ((Amortization ^ 2) − 1)) ÷ (12 × Amortization))), otherwise ((Rate ÷ 12) ÷ if (((Rate ÷ 12) × Amortization) < 0.001), then 1, otherwise (1 − ((1 + (Rate ÷ 12)) ^ (Amortization × -1)))))","sources":[{"node":"input-principal"},{"node":"step-value1"},{"node":"input-amortization"},{"node":"step-value0"}]},{"id":"step-months","label":"Months","kind":"step","rule":"Run Loan period for each month. Carry the closing state into the next period.","sources":[{"node":"input-interest_only"},{"node":"step-payment"},{"node":"input-principal"},{"node":"step-value0"},{"node":"input-term"}],"calls":[{"component":"loan_period","label":"Loan period","purpose":"Roll one month of loan funding, interest, principal repayment, and maturity settlement.","bindings":[{"name":"inputs.interest_only","label":"Inputs Interest Only","value":"Interest Only"},{"name":"inputs.month","label":"Inputs Month","value":"consecutive values from 0 to 120"},{"name":"inputs.payment","label":"Inputs Payment","value":"Payment"},{"name":"inputs.principal","label":"Inputs Principal","value":"Principal"},{"name":"inputs.rate","label":"Inputs Rate","value":"(Rate ÷ 12)"},{"name":"inputs.term","label":"Inputs Term","value":"Term"}],"carry":[{"input":"state","output":"state","label":"State","initial":"0"}]}]},{"id":"output-payment","kind":"output","label":"Payment","rule":"Payment","sources":[{"node":"step-payment"}]},{"id":"output-balance","kind":"output","label":"Balance","rule":"((((Months · Opening + Months · Funding) − Months · Repayment) − Months · Balloon) − Months · State)","sources":[{"node":"step-months","field":"opening","fieldLabel":"Opening","url":"/catalog/components/loan_period/#output-opening"},{"node":"step-months","field":"funding","fieldLabel":"Funding","url":"/catalog/components/loan_period/#output-funding"},{"node":"step-months","field":"repayment","fieldLabel":"Repayment","url":"/catalog/components/loan_period/#output-repayment"},{"node":"step-months","field":"balloon","fieldLabel":"Balloon","url":"/catalog/components/loan_period/#output-balloon"},{"node":"step-months","field":"state","fieldLabel":"State","url":"/catalog/components/loan_period/#output-state"}]},{"id":"output-balloon","kind":"output","label":"Balloon","rule":"Months · Balloon","sources":[{"node":"step-months","field":"balloon","fieldLabel":"Balloon","url":"/catalog/components/loan_period/#output-balloon"}]},{"id":"output-funding","kind":"output","label":"Funding","rule":"Months · Funding","sources":[{"node":"step-months","field":"funding","fieldLabel":"Funding","url":"/catalog/components/loan_period/#output-funding"}]},{"id":"output-interest","kind":"output","label":"Interest","rule":"Months · Interest","sources":[{"node":"step-months","field":"interest","fieldLabel":"Interest","url":"/catalog/components/loan_period/#output-interest"}]},{"id":"output-opening","kind":"output","label":"Opening","rule":"Months · Opening","sources":[{"node":"step-months","field":"opening","fieldLabel":"Opening","url":"/catalog/components/loan_period/#output-opening"}]},{"id":"output-repayment","kind":"output","label":"Repayment","rule":"Months · Repayment","sources":[{"node":"step-months","field":"repayment","fieldLabel":"Repayment","url":"/catalog/components/loan_period/#output-repayment"}]},{"id":"output-service","kind":"output","label":"Service","rule":"Months · Service","sources":[{"node":"step-months","field":"service","fieldLabel":"Service","url":"/catalog/components/loan_period/#output-service"}]},{"id":"output-balloon_total","kind":"output","label":"Balloon Total","rule":"Sum(Months · Balloon)","sources":[{"node":"step-months","field":"balloon","fieldLabel":"Balloon","url":"/catalog/components/loan_period/#output-balloon"}]},{"id":"output-closing","kind":"output","label":"Closing","rule":"Months · State","sources":[{"node":"step-months","field":"state","fieldLabel":"State","url":"/catalog/components/loan_period/#output-state"}]},{"id":"output-interest_total","kind":"output","label":"Interest Total","rule":"Sum(Months · Interest)","sources":[{"node":"step-months","field":"interest","fieldLabel":"Interest","url":"/catalog/components/loan_period/#output-interest"}]},{"id":"output-nonnegative","kind":"output","label":"Nonnegative","rule":"Months · State","sources":[{"node":"step-months","field":"state","fieldLabel":"State","url":"/catalog/components/loan_period/#output-state"}]},{"id":"output-settled","kind":"output","label":"Settled","rule":"if (consecutive values from 0 to 120 ≥ Term), then Months · State, otherwise 0","sources":[{"node":"input-term"},{"node":"step-months","field":"state","fieldLabel":"State","url":"/catalog/components/loan_period/#output-state"}]}],"topics":[{"label":"Term loan","results":["output-amortization_domain","output-balance","output-interest_only_bound","output-interest_only_domain","output-payment","output-principal_domain","output-rate_domain","output-settled","output-term_domain"]},{"label":"Loan period","results":["output-balloon","output-funding","output-interest","output-opening","output-repayment","output-service","output-balloon_total","output-closing","output-interest_total","output-nonnegative"]}]},"usedBy":[]}
