Entity: Investment 250 46 null * presentValue double 3 false false false futureValue double 3 false false false internalRate double 3 false false false coupon double 3 false false false frequency int 3 false false false period double 3 false false false term double 3 false false false Operation: createFlows Investment true Integer.subrange(1,( term * frequency )->floor())->forAll( i | CashFlow->exists( f | f.amount = coupon & f.timePoint = i * period & f : flows )) Operation: totalValue Investment double r double query true result = flows->collect( f | f.amount / ( ( 1 + r )->pow(f.timePoint) ) )->sum() + futureValue / ( ( 1 + r )->pow(flows.last.timePoint) ) Operation: payout Investment double query true result = flows->collect(amount)->sum() Operation: findirr Investment double r double rl double ru double query true v = totalValue(r) & ( ( v > presentValue + 0.0010 => result = findirr(( ru + r ) / 2,r,ru) ) & ( v < presentValue - 0.0010 => result = findirr(( r + rl ) / 2,rl,r) ) & ( true => result = r ) ) Operation: secant Investment double rn double rminus double tvminus double tol double query true tvn = totalValue(rn) - presentValue & ( tvn.abs < tol => result = rn ) & ( tvn.abs >= tol => result = secant(rn - tvn * ( ( rn - rminus ) / ( tvn - tvminus ) ),rn,tvn,tol) ) Operation: cTotalValue Investment double r double query r > 0 result = flows->collect( f | f.amount * ( -r * f.timePoint )->exp() )->sum() + futureValue * ( -r * flows.last.timePoint )->exp() Operation: macaulayD Investment double r double query true result = (flows->collect(timeAmount(r))->sum()) / totalValue(r) Entity: CashFlow 687 31 null * amount double 3 false false false timePoint double 3 false false false discount double 3 false false false rate double 3 false false false Operation: setDiscount CashFlow r double true discount = 1 / ( 1 + r )->pow(timePoint) Operation: discountedAmount CashFlow double query true result = amount * discount@pre Operation: timeAmount CashFlow double r double query true result = (timePoint * amount) / (( 1 + r )->pow(timePoint)) Entity: YieldData 30 299 null * maturity String 3 false true false timePoint double 3 false false false rate double 3 false false false Association: Investment CashFlow 1 460 84 688 70 0 flows null ordered GeneralUseCase: bootstrap false Constraint: null true Investment->exists( b | b.presentValue = 115 & b.term = 4 & b.frequency = 1 & b.period = 1.0 ) null bootstrap false Constraint: i : Integer.subrange(1,( term * frequency )->floor()) null CashFlow->exists( f | f.amount = 2 & f.timePoint = i * period & f : flows ) Investment bootstrap false Constraint: i : Integer.subrange(1,flows.size - 1) null flows[i].rate = YieldData[i + ""].rate & flows[i].discount = 1 / ( 1 + YieldData[i + ""].rate )->pow(flows[i].timePoint) Investment bootstrap false Constraint: n = flows.size null flows[n].discount = ( presentValue - Integer.Sum(1,n - 1,i,flows[i].discountedAmount()) ) / ( flows[n].amount + 100 ) Investment bootstrap false Constraint: n = flows.size null flows[n].rate = ( flows[n].discount->pow(-1 / flows[n].timePoint) ) - 1 Investment bootstrap false Constraint: n = flows.size null ( "The " + n + " period rate is " + flows[n].rate )->display() Investment bootstrap false GeneralUseCase: getValue false Constraint: null true Investment->exists( b | b.presentValue = 115 & b.futureValue = 100 & b.term = 10 & b.frequency = 1 & b.coupon = 2 & b.period = 1.0 ) null getValue false Constraint: null true createFlows() Investment getValue false Constraint: null true payout()->display() Investment getValue false Constraint: null true internalRate = findirr(0.25,0,0.5) & internalRate->display() Investment getValue false Constraint: null true totalValue(0.05)->display() & cTotalValue(0.05)->display() Investment getValue false Constraint: null true macaulayD(internalRate)->display() Investment getValue false GeneralUseCase: purchaseBond trm double coup double price double false Constraint: null true Investment->exists( b | b.term = trm & b.coupon = coup & b.presentValue = price ) null purchaseBond false