| com.nodelab.interest | ![]() |
com.nodelab.0.10173
Instance of Type
Inheriting from Calculator
| Type data | Value |
| org.uninode.Type.displayPattern | a {att:org.uninode.Node.type} |
| org.uninode.Resource.resourceType | |
| org.uninode.Resource.label | |
| org.uninode.Resource.resourceOf | List{} |
| org.uninode.Listable.resources | Reference[org.uninode.Listable.resources] of com.nodelab.interest.CalcBond |
| Attribute summary | Defined in | Uninode® Id | Properties | Default | |
| Reference[org.uninode.Listable.resources] | resources | Listable | org.uninode.0.2001 | type | |
| String | toString This is the display string. | Node | org.uninode.0.102 | ||
| Type | type The type of an object determines the behaviour and attributes of the object. | Node | org.uninode.0.101 | ||
| String | uri | Node | org.uninode.0.103 | ||
| String | label | Resource | org.uninode.0.2041 | type | |
| List[Type] | resourceOf | Resource | org.uninode.0.2042 | type | |
| Signature | resourceType This defines the type of resource. It can be 'view', 'adapter' or 'action' | Resource | org.uninode.0.2043 | type | |
| Script summary |
com.nodelab.0.10378/*
constructor() {
View:();
}
class Boolean isResourceOf(Listable node, Symbol aspect) {
if (aspect == #views) return true;
false;
}
class String resourceLabel() "Name of resource" {
"bond calculator";
}
inline introspect Collection[Class] requiredConditions() {
#(ConditionHistory, ConditionMaturity);
}
Void designView(WidgetWorkspace ws) {
InstrumentBond bond = InstrumentBond{partAt(0).source};
ws.addHeader(new Place(0, 0).setDimensions(3, 1).setWeight(1.0, 0.0, #horizontal), this);
ws.addLabel(new Place(0, 1), "Date");
Condition condHist = conditionType(ConditionHistory);
ws.addField(
new Place(1, 1).setWeight(1.0, 0.0, #horizontal).setDimensions(2, 1),
condHist,
null);
ws.addLabel(new Place(0, 2), "Settlement");
Value[Int] settlement = new Value(Int, 3);
ws.addField(
new Place(1, 2).setPrefSize(30, 0).setFill(#none),
settlement,
null);
ws.addLabel(new Place(2, 1), "days");
Value[Time] settlementDate = new Value(Time, null);
WidgetField f = ws.addField(
new Place(1, 3).setDimensions(2, 1),
settlementDate,
null);
ws.setTrigger(Void(){
settlementDate.set(Time{condHist.focus}.settlement(settlement.value));
});
// f.addListener(Void(){settlement = null});
ws.addLabel(new Place(0, 4), "Maturity");
Value[Time] maturity = new Value(Time, bond.aspectValue(#maturity));
ws.addField(
new Place(1, 4).setDimensions(2, 1),
maturity,
null);
ws.addLabel(new Place(0, 5), "Rate");
Value[Real] rate = new Value(Real, bond.aspectValue(#bid));
ws.addField(
new Place(1, 5).setDimensions(2, 1),
rate,
null);
condHist.addListener(Void() {rate.set(bond.aspectValue(#bid))});
ws.addLabel(new Place(0, 6), "Coupon");
Value[Real] coupon = new Value(Real, bond.aspectValue(#coupon));
ws.addField(
new Place(1, 6).setDimensions(2, 1),
coupon,
null);
ws.addLabel(new Place(0, 7), "Dirty price");
Value[Real] dirtyPrice = new Value(Real, null);
ws.addField(
new Place(1, 7).setDimensions(2, 1),
dirtyPrice,
null);
ws.setTrigger(Void(){
dirtyPrice.set(InstrumentBond.dirtyPriceQuote(settlementDate.value, maturity.value, rate.value, coupon.value));
});
ws.addLabel(new Place(0, 8), "Clean price");
Value[Real] cleanPrice = new Value(Real, null);
ws.addField(
new Place(1, 8).setDimensions(2, 1),
cleanPrice,
null);
ws.setTrigger(Void(){
cleanPrice.set(InstrumentBond.cleanPriceQuote(settlementDate.value, maturity.value, rate.value, coupon.value));
});
ws.addLabel(new Place(0, 9), "Delta");
Value[Real] delta = new Value(Real, null);
ws.addField(
new Place(1, 9).setDimensions(2, 1),
delta,
null);
ws.setTrigger(Void(){
delta.set(InstrumentBond.delta(settlementDate.value, maturity.value, rate.value, coupon.value));
});
ws.addLabel(new Place(0, 10), "Duration");
Value[Real] duration = new Value(Real, null);
ws.addField(
new Place(1, 10).setDimensions(2, 1),
duration,
null);
ws.setTrigger(Void(){
duration.set(InstrumentBond.duration(settlementDate.value, maturity.value, rate.value, coupon.value));
});
ws.addLabel(new Place(0, 11), "Mod Dur");
Value[Real] modDuration = new Value(Real, null);
ws.addField(
new Place(1, 11).setDimensions(2, 1),
modDuration,
null);
ws.setTrigger(Void(){
modDuration.set(InstrumentBond.modDuration(settlementDate.value, maturity.value, rate.value, coupon.value));
});
ws.addLabel(new Place(0, 12), "Convexity");
Value[Real] convexity = new Value(Real, null);
ws.addField(
new Place(1, 12).setDimensions(2, 1),
convexity,
null);
ws.setTrigger(Void(){
convexity.set(InstrumentBond.convexity(settlementDate.value, maturity.value, rate.value, coupon.value));
});
}
*/ |