org.unizone.finance.interest

Type YieldSwapPricing

org.unizone.0.6390
Instance of Type
Inheriting from SourceAdapterSingleTimeseries

Type dataValue
org.uninode.Type.displayPattern{att:org.unizone.source.Source.displayName}
org.unizone.source.Source.valueAttribute
org.uninode.Resource.resourceType
org.uninode.Resource.label
org.uninode.Resource.resourceOfList{}
org.uninode.Listable.resourcesReference[org.uninode.Listable.resources] of org.unizone.finance.interest.YieldSwapPricing

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
StringdisplayName
The display name is the name that is shown in lists, displays and graphs.
Sourceorg.unizone.0.4001essential
AttributevalueAttribute
The value attribute is used for determining the default value that should be used for displaying this source in a graph.
Sourceorg.unizone.0.4011type
inheritValue
SignaturevalueType
The value type determines which axes should be used in graphs.
Sourceorg.unizone.0.4002inheritValue
SourcesourceSourceAdapterSingleorg.unizone.0.4051

Method summaryDefined inOverridesProperties
voidactivateListable
voidcheckRangeSourceAdapterSingleSource
voiddesignEditor(WidgetWorkspace ws)Listable
voidgenerateScript(ScriptGenerationInfo info)SourceAdapterSingleScriptGenerator
Realget(DateTime timestamp)SourceAdapterSingleTimeseries
BooleanisResourceOf(Listable listable, Signature aspect)Mixabletype
ListablemixOn(Mixable mix)Mixable
ListablemixWith(Mixable mix)Mixable
voidput(DateTime timestamp, Real value)SourceAdapterSingleTimeseries
StringresourceStringListableintrospection
voidsetSource(Source source)SourceAdapterSingle
SourcesourceSourceAdapterSingle
voidXXXcom.nodelab.java.sourceadaptersingle.CheckRangeSourceAdapterSingle
SignatureXXXcom.nodelab.java.sourceadaptersingle.ValueTypeSourceAdapterSingle
voidcom.nodelab.java.source.ActivateSourceListable
Listablecom.nodelab.java.source.MixWithMiSourceMixable

Script summary
org.unizone.0.8544
/*
instance YieldSwap yield;
instance InstrumentBond bond;
constructor() {
  TimeBuffer:();
}
constructor(YieldSwap yield, InstrumentBond bond) {
  TimeBuffer:();
  instance yield = yield;
  instance bond = bond;
  addNextSource(instance yield);
  addNextSource(instance bond);
}
class Boolean isResourceOf(Listable node, Symbol aspect) {
  if (aspect == #adaptors) return true;
  false;
}
class String resourceLabel() "Name of resource" {
  "swap pricing";
}
String resourceString() "Description of resource" {
  instance bond.toString + " on " + instance yield.toString;
}
Symbol valueType() {
  #yieldSwapPricing;
}
Void setYieldSwap(YieldSwap yield) {
  instance yield = yield;
  addNextSource(yield);
}
Void setBond(InstrumentBond bond) {
  instance bond = bond;
  addNextSource(bond);
}
trace Mixable mixWith(Mixable item) {
  instance yield = Producer.mix(0);
  if (instance yield == null'  '!instance yield.class.subclassOf(YieldSwap)) {
    Producer.report("Top mix must be a swap yield");
    return null;
  }
  instance bond = Producer.mix(1);
  if (instance bond == null'  '!instance bond.class.subclassOf(InstrumentBond)) {
    Producer.report("Second mix must be a bond");
    return null;
  }
  addNextSource(instance yield);
  addNextSource(instance bond);
  this;
}
Collection[Class] requiredConditions() {
  #(ConditionHistory);
}
Object preferredFrom(Condition condition) {
  if (condition.class == ConditionHistory) 
    return Time{ConditionHistory{condition}.to}.addDays(-30);
  TimeBuffer:preferredFrom(condition);
}
trace TimeData createData(Time time, Symbol resolution) {
  Producer.report("Preparing " + toString() + " at " + time.toString);
  Real price = 0.0;
  Real t = Time{instance bond.aspectValue(#maturity)}.subtractDate360(time) / 360;
  while (t > 0) {
    external cond_maturity = t;
    price = price + instance yield.aspectReal(#discountFactor);
    t = t - 1;
  }
  price = price * Real{instance bond.aspectValue(#coupon)} + 100 -
    instance bond.dirtyPriceGreek();
  t = Time{instance bond.aspectValue(#maturity)}.subtractDate360(time) / 360;
  Real divider = 0.0;
  external cond_maturity = t;
  Real d0 = instance yield.aspectReal(#discountFactor);
  Real d1;
  t = t - 0.25;
  while (t > 0) {
    external cond_maturity = t;
    d1 = d0;
    d0 = instance yield.aspectReal(#discountFactor);
    price = price - (d0 / d1 - 1) * 100 * d1;
    divider = divider + 25 * d1;
    t = t - 0.25;
  }
  price = price - (1 / d0 - 1) * 100 * d0;
  divider = divider + (t + 0.25) * 100 * d0;
  TimeData td = new TimeData(this, time);
  td.setAspect(#value, 10000 * price / divider);
  td;
}
String instanceScript(InstanceScriptInfo info) {
  instance yield.instanceScript(info); // create variables
  instance bond.instanceScript(info); // create variables
  info.objectId(this, AdaptorYieldSwapPricing, "ysp");
}
String initScript(InstanceScriptInfo info) {
  String prefix = info.methodPrefix(this);
  "  " + prefix + "setYieldSwap(" + instance yield.instanceScript(info) + ");
  " + prefix + "setBond(" + instance bond.instanceScript(info) + ");
";
}

*/