com.nodelab.interest

Type CalcBond

com.nodelab.0.10173
Instance of Type
Inheriting from Calculator

Type dataValue
org.uninode.Type.displayPatterna {att:org.uninode.Node.type}
org.uninode.Resource.resourceType
org.uninode.Resource.label
org.uninode.Resource.resourceOfList{}
org.uninode.Listable.resourcesReference[org.uninode.Listable.resources] of com.nodelab.interest.CalcBond

Attribute summaryDefined inUninode® IdPropertiesDefault
Reference[org.uninode.Listable.resources]resourcesListableorg.uninode.0.2001type
StringtoString
This is the display string.
Nodeorg.uninode.0.102
Typetype
The type of an object determines the behaviour and attributes of the object.
Nodeorg.uninode.0.101
StringuriNodeorg.uninode.0.103
StringlabelResourceorg.uninode.0.2041type
List[Type]resourceOfResourceorg.uninode.0.2042type
SignatureresourceType
This defines the type of resource. It can be 'view', 'adapter' or 'action'
Resourceorg.uninode.0.2043type

Method summaryDefined inOverridesProperties
voidactivateListable
voiddesignEditor(WidgetWorkspace ws)Listable
voidgenerateScript(ScriptGenerationInfo info)
Prepare and generate initialization code
ScriptGenerator
voidinstanceScript(ScriptGenerationInfo info)
return either variable name (like 'ave1', found in info), or a constructor call (new ...)
ScriptGenerator
BooleanisResourceOf(Listable listable, Signature aspect)Mixabletype
ListablemixOn(Mixable mix)Mixable
ListablemixWith(Mixable mix)Mixable
StringresourceStringListableintrospection
voidcom.nodelab.java.view.ActivateViewListable
Intcom.nodelab.java.view.ActorCountView
Actorcom.nodelab.java.view.ActorForSoView
Actorcom.nodelab.java.view.AddSourceSoView
voidcom.nodelab.java.view.ConstructorView
voidcom.nodelab.java.view.DesignViewWWView
Dimensioncom.nodelab.java.view.DimensionAtInView
Intcom.nodelab.java.view.DimensionCountView
Dimensioncom.nodelab.java.view.DimensionTypeTyView
voidcom.nodelab.java.view.DragMouseReReReReView
voidcom.nodelab.java.view.GenerateScriptSIViewScriptGenerator
Actorcom.nodelab.java.view.GetActorInView
voidcom.nodelab.java.view.InstallView
voidcom.nodelab.java.view.InstanceScriptSIViewScriptGenerator
Booleancom.nodelab.java.view.IsPerpetualView
voidcom.nodelab.java.view.PrepareView
Collection[Type]com.nodelab.java.view.RequiredDimensionsView
Scenecom.nodelab.java.view.SceneView
WidgetWorkspacecom.nodelab.java.view.WorkspaceView

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));
  });
}
*/