/* Define CSV Input Class */
CSV(Cashflow);

/* Financial Example */
Float rateMultiplier := 2.0;

/* Cashflow Object */
Object Cashflow {
number -> Int,
startDate -> String,
endDate -> String,
payDate -> String,
principal -> Float,
rate -> Float,
yearFraction -> Float
};

/* Discount Factors used to price */
Float discountFactors[4] := { 0.99, 0.98, 0.97, 0.96 };

/* Data Table Definition */
/* Note: Cashflow is the type of the object to be iterated */
Table Price(Cashflow) {
number -> Int : item.number,
price -> Float :
Float df;

/* Discount Factor */
df := discountFactors[item.number];

/* Price of a cashflow is rateMultiplier * principal * rate * yearFraction */
rateMultiplier * item.principal * item.rate * item.yearFraction * df };

/* Build Table */
Tab Price results := Price(Input);

/* Print Table */
results.print();

