@@ -9,7 +9,7 @@ DataSheetNames=:<;._1' Actuals Forecast'
DebtSeries=:<;._1' D0 D1 D2 D3 D4'
DebtSeriesNames=:<;._1' dbhouse dbcar dboptional dbother dbmedical'
ExpenseSeries=:<;._1' E0 E1 E2 E3 E4 E5 E6 E7 E8 EC EF'
IFACEWORDSSwag=:<;._1' FutureScenarios LoadConfig LoadSheets Swag SwagTest RunTest RunTheNumbers'
IFACEWORDSSwag=:<;._1' FutureScenarios LoadConfig LoadSheets Swag SwagTest RawReservesFromLast RunTest RunTheNumbers'
IncomeSeries=:<;._1' I0 I1 I2 I3 I4 I5 IC'
MainConfiguration=:<;._1' CrossReference Parameters'
MethodArguments=:<;._1' MethodArguments BackPeriods Fee Initial Interest LoanEquity YearInflate Schedule YearTerm DHouse DCar DOptional DOther DMedical RSavings RInvest REquity ROther'
@@ -18,7 +18,7 @@ MethodTokens=:;:'()[=.'
ModelConfiguration=:0$a:
ModelLocale=:'Swag'
NoChange=:'';i.0
ROOTWORDSSwag=:<;._1' FutureScenarios IFACEWORDSSwag MainConfiguration ROOTWORDSSwag RepeatScenario RunTheNumbers TestConfiguration'
ROOTWORDSSwag=:<;._1' FutureScenarios IFACEWORDSSwag MainConfiguration ROOTWORDSSwag RawReservesFromLast RepeatScenario RunTheNumbers TestConfiguration'
ReserveSeries=:<;._1' R0 R1 R2 R3'
ReserveSeriesNames=:<;._1' rssavings rsinvest rsequity rsother'
SSpreadPrefix=:'-s'
@@ -426,6 +426,10 @@ sf=.sf,RunTest~sn,3
end.
sf
)
LastFOM=:3 :0
'a m d'=.|:datefrint,y
($y)$intfrdate(a-0=<:m),.((<:m){_1|.>:i.12),.1
)
LoadConfig=:3 :0
ConfigSheetNames LoadConfig y
:
@@ -457,6 +461,33 @@ RangeIndexes=:4 :0
y=.<.y[x=.<.x
I.(+./\1(y i.0{x)}0#~#y )**./\0(y i.1{x)}1#~#y
)
RawReservesFromLast=:3 :0
(0 100 100#.<.3&{.@(6!:0)'')RawReservesFromLast y
:
'no last reserves'assert 2<#t=.readtd2 y
'date last amt'=.h i.;:'Date LastActive Amount'[h =.0{t
d=.}.(date,last){"1 t
'missing reserve amount date(s)'assert-.a:e.0{"1 d
'invalid reserve amount date(s)'assert valdate datefrint(0{"1 d)BadNumber&".@-.&>'-'
'invalid last active date(s)'assert valdate datefrint((}.1 {"1 d)-.a:)BadNumber&".@-.&>'-'
symd=.".(;0{0{d)-.'-'[t=.2}.t
d=.".&>(}.0{"1 d)-.&.>'-'[f=.LastFOM x
b=.d<:f[d=.symd(I.symd>d)}d
d=.FormatSheetDates b#d[t=.b#t
k=.tolower@(rebc@(alltrim@(';;'&beforestr)))&.>t{"1~h i.;:'Name Category Description'
k=.'-'&beforelaststr&.><"1;"1' -'&charsub&.>k,&.>'-'
if.0 e.b=.~:k =.(('-'&beforelaststr&.>d),&.><'-01'),.k do.
smoutput(-.b)#t
'multiple monthly reserves'assert 0
end.
k=./:~k,.amt{"1 t
s=.a:,.~>,{(<1 FirstMonthRange symd,f),<1 {"1 k
l=.(~:0 1{"1 k){:;.1 k
s=.(((1 {"1 s)i.~1 {"1 l){2{"1 l)(<a:;2)}s
q=.(0 1{"1 s)i.0 1{"1 k
s=./:~(2{"1 k)(<q;2)}s
(;:'Date Name Amount Key'),(('-'&beforestr&.>1 {"1 s)(<a:;1 )}s),.1 {"1 s
)
RepeatScenario=:4 :0
'minimum replications >: 2'assert 2<:0{x
hd=.0{y
@@ -689,7 +720,13 @@ pp=.pay-ip=.osb*i
pay,.osb,.ip,.pp
)
assert=:0 0"_$13!:8^:((0:e.])`(12"_))
beforelaststr=:]{.~1&(i:~)@([E.])
beforestr=:]{.~1&(i.~)@([E.])
boxopen=:<^:(L.=0:)
charsub=:4 :0
'f t'=.((#x)$0 1)<@,&a./.x
t{~f i.y
)
datefrint=:0 100 100&#:@<.
dev=:-"_1 _ mean
erase=:[:4!:55;: ::]
@@ -712,6 +749,7 @@ q1=:median@((median>]) #]) ::_:
q3=:median@((median<]) #]) ::_:
read=:1!:1&(]`<@.(32&>@(3!:0)))
readtd2=:[:<;._2&>(9{a.),&.>~[:<;._2[:(],((10{a.)"_={:)}.(10{a.)"_)(13{a.)-.~1!:1&(]`<@.(32&>@(3!:0)))
rebc=:]#~[:-.' '&E.
skewness=:%:@#*+/@(^&3)@dev%^&1.5@ssdev
smoutput=:0 0$1!:2&2
ssdev=:+/@:*:@dev
@@ -742,13 +780,14 @@ NB.POST_Swag post processor.

smoutput 0 : 0
NB. interface word(s):
NB. FutureScenarios NB. compute scenarios (y) as if all dates in future
NB. LoadConfig NB. loads shared configuration sheets
NB. LoadSheets NB. loads TAB delimited scenario actuals and forecast sheets
NB. RunTest NB. run test scenario
NB. RunTheNumbers NB. compute all scenarios on list (y)
NB. Swag NB. compute Silly Wild Ass Guess forecast TAB delimited sheets
NB. SwagTest NB. generates simulated scenario test sheets
NB. FutureScenarios NB. compute scenarios (y) as if all dates in future
NB. LoadConfig NB. loads shared configuration sheets
NB. LoadSheets NB. loads TAB delimited scenario actuals and forecast sheets
NB. RawReservesFromLast NB. raw reserves sheet from last reserves file
NB. RunTest NB. run test scenario
NB. RunTheNumbers NB. compute all scenarios on list (y)
NB. Swag NB. compute Silly Wild Ass Guess forecast TAB delimited sheets
NB. SwagTest NB. generates simulated scenario test sheets
)

cocurrent 'base'
BIN +232 KB swag/swag.xlsx
Binary file not shown.
@@ -18,7 +18,7 @@ loan s_1 buy car 15000 2020-07-01 2025-07-01 borrow Interest=. 5 [ YearTerm=. 5
reservetotal s_1 buy car 10000 2020-07-01 2020-08-01 spend car down payment from savings
reservetotal s_1 inherit 250000 2023-01-01 2023-02-01 reserve Initial=.1 inheritance to savings
reservetotal s_1 buy house 150000 2023-03-01 2023-04-01 transfer Fee=. 200 [ DHouse=.1 pay off remaining mortgage balance after inheritance Fee is closing cost
annuities s_1 50 2024-12-01 2044-01-01 history any Canada pension payments to spouse
annuities s_1 50 2024-12-01 2044-01-01 history any pension payments to spouse
annuities s_1 100 2035-08-01 2044-01-01 history any us social security survivor spouse collects after partner death
living s_10 fut history test 1 2000 2013-05-01 2019-03-01 history mean value of relevant historical periods added to date range
reservetotal s_100 assumptions 0 2015-09-01 2035-09-01 assume RSavings=. 0.5 [ RInvest=. 3 [ REquity=. 3 [ ROther=. 1 annual nominal percent reserve growth or decline during period
@@ -67,7 +67,7 @@ reservetotal s_19 reserve test 5 1000 2027-05-01 2029-05-01 reserve Fee=. 10 [
house s_2 625 2011-05-01 2016-08-01 history BackPeriods=.1 current rent until move
insurance s_2 115 2011-05-01 2044-01-01 history car and home insurance
living s_2 1500 2011-05-01 2044-01-01 history YearInflate=.2 normal monthly living expenses
salary s_2 5600 2011-05-01 2018-07-01 history BackPeriods=.4 [ YearInflate=.1.5 maintain net monthly income until I retire
salary s_2 5600 2011-05-01 2018-07-01 history BackPeriods=.4 [ YearInflate=.1.5 maintain net monthly income until retirement
reservetotal s_2 100000 2011-05-01 2011-06-01 reserve Initial=.1 total savings at model start
house s_2 200 2016-08-01 2044-01-01 history incidental housing expenses after move assuming no mortgage or rent
annuities s_2 100 2018-07-01 2035-08-01 history monthly retirement and other annuity payments end date is unknown
@@ -238,6 +238,60 @@ annuities s_66 50 2024-12-01 2044-01-01 history any retirement pension paymen
annuities s_66 100 2035-08-01 2044-01-01 history any us social security survivor benefit after first death
reservetotal s_7 borrow test 2 70000 2021-04-01 2021-05-01 reserve Initial=. 1 deposit to savings
loan s_7 borrow test 2 10000 2022-03-01 2025-03-01 borrow Interest=. 7.3 [ YearTerm=. 2 [ RSavings=. 1 borrow other at 7.3% with 2 year payback with payments from savings
reservetotal s_77 assumptions 0 2015-09-01 2015-10-01 assume RSavings=. 0.5 [ RInvest=. 3 [ REquity=. 3 [ ROther=. 1 annual nominal percent reserve growth or decline during period
car s_77 50 2015-09-01 2035-08-01 history annualized car maintenance until first death
house s_77 912 2015-09-01 2016-08-01 history BackPeriods=.1 current rent until move
insurance s_77 100 2015-09-01 2035-08-01 history car insurance
living s_77 1650 2015-09-01 2044-01-01 history YearInflate=.5 normal monthly living expenses
salary s_77 4800 2015-09-01 2016-08-01 history BackPeriods=.4 [ YearInflate=.1.5 maintain net monthly income until move
reservetotal s_77 25000 2015-09-01 2015-10-01 reserve Initial=.1 [ RInvest=. 1 stock value at model start
reservetotal s_77 130000 2015-09-01 2015-10-01 reserve Initial=.1 savings at model start
salary s_77 4200 2016-08-01 2023-07-01 history BackPeriods=.4 [ YearInflate=.1.5 reduced net income after move until retirement
house s_77 move 2000 2016-08-01 2016-09-01 history moving expenses
house s_77 100 2016-08-01 2044-01-01 history incidental housing expenses after move
house s_77 100 2016-08-01 2044-01-01 history home owners association payments
house s_77 150 2016-08-01 2044-01-01 history property taxes
reservetotal s_77 buy house 110000 2016-08-01 2016-09-01 reserve Initial=.1 [ REquity=. 1 down payment added to house equity initial setting prevents double spend
loan s_77 buy house 150000 2016-08-01 2023-02-01 borrow Interest=. 4.5 [ YearTerm=. 30 [ DHouse=.1 [ LoanEquity=.1 30 year mortgage rate on house until inheritance
reservetotal s_77 buy house 110000 2016-08-01 2016-09-01 spend down payment on house from savings
annuities s_77 250 2018-07-01 2035-08-01 history monthly retirement and other annuity payments end date is unknown
annuities s_77 50 2018-07-01 2035-08-01 history any government pension payments
reservetotal s_77 assumptions 0 2020-01-01 2044-01-01 assume RSavings=. -2.5 [ RInvest=. -5.0 [ REquity=. -5.0 [ ROther=. 2 market tanks government introduces negative interest
loan s_77 buy car 10000 2020-07-01 2025-07-01 borrow Interest=. 5 [ YearTerm=. 5 [ DCar=.1 pay balance of car at 5% for 5 years
reservetotal s_77 buy car 7000 2020-07-01 2020-08-01 spend car down payment from savings
reservetotal s_77 inherit 180000 2023-01-01 2023-02-01 reserve Initial=.1 inheritance to savings
reservetotal s_77 buy house 150000 2023-03-01 2023-04-01 transfer Fee=. 1500 [ DHouse=.1 pay off remaining mortgage balance after inheritance fee is closing cost
salary s_77 1400 2023-07-01 2035-08-01 history estimated social security payments spread over expected life
insurance s_77 700 2023-07-01 2024-12-01 history medical insurance in the gap between retirement and spouse medicare eligibility
annuities s_77 100 2024-12-01 2044-01-01 history any retirement pension payments to spouse
annuities s_77 100 2035-08-01 2044-01-01 history any us social security survivor benefit after first death
reservetotal s_78 assumptions 0 2015-09-01 2015-10-01 assume RSavings=. 0.5 [ RInvest=. 3 [ REquity=. 3 [ ROther=. 1 annual nominal percent reserve growth or decline during period
car s_78 50 2015-09-01 2035-08-01 history annualized car maintenance until first death
house s_78 912 2015-09-01 2016-08-01 history BackPeriods=.1 current rent until move
insurance s_78 100 2015-09-01 2035-08-01 history car insurance
living s_78 1650 2015-09-01 2044-01-01 history YearInflate=.5 normal monthly living expenses
salary s_78 4800 2015-09-01 2016-08-01 history BackPeriods=.4 [ YearInflate=.1.5 maintain net monthly income until move
reservetotal s_78 25000 2015-09-01 2015-10-01 reserve Initial=.1 [ RInvest=. 1 stock value at model start
reservetotal s_78 130000 2015-09-01 2015-10-01 reserve Initial=.1 savings at model start
salary s_78 4200 2016-08-01 2018-07-01 history BackPeriods=.4 [ YearInflate=.1.5 reduced net income after move until retirement
house s_78 move 2000 2016-08-01 2016-09-01 history moving expenses
house s_78 100 2016-08-01 2044-01-01 history incidental housing expenses after move
house s_78 100 2016-08-01 2044-01-01 history home owners association payments
house s_78 150 2016-08-01 2044-01-01 history property taxes
reservetotal s_78 buy house 110000 2016-08-01 2016-09-01 reserve Initial=.1 [ REquity=. 1 down payment added to house equity initial setting prevents double spend
loan s_78 buy house 150000 2016-08-01 2023-02-01 borrow Interest=. 4.5 [ YearTerm=. 30 [ DHouse=.1 30 year mortgage rate on house until inheritance
reservetotal s_78 buy house 110000 2016-08-01 2016-09-01 spend down payment on house from savings
annuities s_78 250 2018-07-01 2035-08-01 history monthly retirement and other annuity payments end date is unknown
annuities s_78 50 2018-07-01 2035-08-01 history any government pension payments
reservetotal s_78 assumptions 0 2020-01-01 2044-01-01 assume RSavings=. -2.5 [ RInvest=. -5.0 [ REquity=. -5.0 [ ROther=. 2 market tanks government introduces negative interest
loan s_78 buy car 10000 2020-07-01 2025-07-01 borrow Interest=. 5 [ YearTerm=. 5 [ DCar=.1 pay balance of car at 5% for 5 years
reservetotal s_78 buy car 7000 2020-07-01 2020-08-01 spend car down payment from savings
reservetotal s_78 inherit 180000 2023-01-01 2023-02-01 reserve Initial=.1 inheritance to savings
reservetotal s_78 buy house 150000 2023-03-01 2023-04-01 transfer Fee=. 1500 [ DHouse=.1 pay off remaining mortgage balance after inheritance fee is closing cost
salary s_78 1400 2023-07-01 2035-08-01 history estimated social security payments spread over expected life
insurance s_78 700 2023-07-01 2024-12-01 history medical insurance in the gap between retirement and spouse medicare eligibility
annuities s_78 100 2024-12-01 2044-01-01 history any retirement pension payments to spouse
annuities s_78 100 2035-08-01 2044-01-01 history any us social security survivor benefit after first death
reservetotal s_8 borrow test 3 100000 2021-04-01 2021-05-01 reserve Initial=. 1 [ RInvest=.1 deposit to investments
loan s_8 borrow test 3 20000 2022-03-01 2025-03-01 borrow Interest=. 5 [ YearTerm=. 10 [ RInvest=. 1 borrow at 5% with 10 year payback with payments from investments to other loan
reservetotal s_9 borrow test 4 30000 2021-04-01 2021-05-01 reserve Initial=. 1 deposit to savings
BIN +1.57 KB (100%) swag/tests/tp.xlsx
Binary file not shown.
BIN -87 Bytes (100%) swag/tests/tr0.xlsm
Binary file not shown.