com.nodelab.interest

Type YieldPricing

com.nodelab.0.10188
Instance of Type
Inheriting from Calculator

This calculator calculates the theoretical value of a bond, based on the yield. It displays clean and dirty price, delta, duration, modified duration and convexity.

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.YieldPricing

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.10389
/*


BaliCalculator subclass: #BaliCalcYieldPricing

	instanceVariableNames: 'zeroCouponYield break zeroCouponYieldText couponRate duration rate convexity delta settlementText modDuration settlement interestType cleanPrice dirtyPrice '
	classVariableNames: ''
	poolDictionaries: ''
	category: 'Bali'!


!BaliCalcYieldPricing methodsFor: 'actions'!

calculate
	| source interest modDate |
	(source := self firstSource) isNil ifTrue: [^self message: 'No source'].
	(source isKindOf: BaliYield) ifFalse: [^self message: 'Not a yield'].
	self zeroCouponYield: source.
	self date: self display dimHistory focus.
	self date isNil ifTrue: [^nil].
	modDate := self date addYears: source maturityOffset.
	self settlement: self settlement.
	self interestType value = #tbill
		ifTrue: [interest := BaliSecTBill new]
		ifFalse: [interest := BaliSecBond new].
	interest settlementDays: self settlement.
	self rate value: (interest 
		zeroCouponRate: self zeroCouponYield 
		at: modDate
		maturity: self maturity
		coupon: self couponRate value asDouble).
	(self rate value isNil or: [(interest isKindOf: BaliSecBond) not]) ifTrue: [
		self cleanPrice value: nil.
		self dirtyPrice value: nil.
		self delta value: nil.
		self duration value: nil.
		self modDuration value: nil.
		self convexity value: nil.
		^nil].
	self cleanPrice value: (interest 
		cleanPriceAt: modDate
		maturity: self maturity
		rate: self rate value asDouble
		coupon: self couponRate value asDouble).
	self dirtyPrice value: (interest 
		dirtyPriceAt: modDate
		maturity: self maturity
		rate: self rate value asDouble
		coupon: self couponRate value asDouble).
	self delta value: (interest 
		deltaAt: modDate
		maturity: self maturity
		rate: self rate value asDouble
		coupon: self couponRate value asDouble).
	self duration value: (interest 
		durationAt: modDate
		maturity: self maturity
		rate: self rate value asDouble
		coupon: self couponRate value asDouble).
	self modDuration value: (interest 
		modDurationAt: modDate
		maturity: self maturity
		rate: self rate value asDouble
		coupon: self couponRate value asDouble).
	self convexity value: (interest 
		convexityAt: modDate
		maturity: self maturity
		rate: self rate value asDouble
		coupon: self couponRate value asDouble).!

changeMaturity
	self maturity: (BaliTime fromString: self maturityText value).
	self reset.!

decSettlement
	(self settlement > 1) ifTrue: [
		self settlement: (self settlement - 1).
		self calculate].!

incSettlement
	self settlement: self settlement + 1.
	self calculate!

message: aString
	self dateText value: aString.
	self zeroCouponYieldText value: ''.
	self maturityText value: ''.
	self rate value: 0! !

!BaliCalcYieldPricing methodsFor: 'aspects'!

break
	^break!

break: years
	break := years!

cleanPrice
	"This method was generated by UIDefiner.  Any edits made here
	may be lost whenever methods are automatically defined.  The
	initialization provided below may have been preempted by an
	initialize method."

	^cleanPrice isNil
		ifTrue:
			[cleanPrice := 0 asValue]
		ifFalse:
			[cleanPrice]!

convexity
	"This method was generated by UIDefiner.  Any edits made here
	may be lost whenever methods are automatically defined.  The
	initialization provided below may have been preempted by an
	initialize method."
	^convexity isNil
		ifTrue:
			[convexity := 0 asValue]
		ifFalse:
			[convexity]!

couponRate
	"This method was generated by UIDefiner.  Any edits made here
	may be lost whenever methods are automatically defined.  The
	initialization provided below may have been preempted by an
	initialize method."
	^couponRate isNil
		ifTrue:
			[couponRate := 0 asValue]
		ifFalse:
			[couponRate]!

date
	^self display dimHistory focus!

date: aBaliTime
	self display dimHistory focus: aBaliTime.!

dateText
	^self display dimHistory focusHolder!

delta
	"This method was generated by UIDefiner.  Any edits made here
	may be lost whenever methods are automatically defined.  The
	initialization provided below may have been preempted by an
	initialize method."
	^delta isNil
		ifTrue:
			[delta := 0 asValue]
		ifFalse:
			[delta]!

dirtyPrice
	"This method was generated by UIDefiner.  Any edits made here
	may be lost whenever methods are automatically defined.  The
	initialization provided below may have been preempted by an
	initialize method."

	^dirtyPrice isNil
		ifTrue:
			[dirtyPrice := 0 asValue]
		ifFalse:
			[dirtyPrice]!

duration
	"This method was generated by UIDefiner.  Any edits made here
	may be lost whenever methods are automatically defined.  The
	initialization provided below may have been preempted by an
	initialize method."
	^duration isNil
		ifTrue:
			[duration := 0 asValue]
		ifFalse:
			[duration]!

interestType
	"This method was generated by UIDefiner.  Any edits made here
	may be lost whenever methods are automatically defined.  The
	initialization provided below may have been preempted by an
	initialize method."
	^interestType isNil
		ifTrue:
			[interestType := #bond asValue]
		ifFalse:
			[interestType]!

maturity
	^self display dimMaturity focusDate!

maturity: aBaliTime
	self display dimMaturity focusDate: aBaliTime.!

maturityText
	^self display dimMaturity focusHolder!

modDuration
	"This method was generated by UIDefiner.  Any edits made here
	may be lost whenever methods are automatically defined.  The
	initialization provided below may have been preempted by an
	initialize method."
	^modDuration isNil
		ifTrue:
			[modDuration := 0 asValue]
		ifFalse:
			[modDuration]!

rate
	"This method was generated by UIDefiner.  Any edits made here
	may be lost whenever methods are automatically defined.  The
	initialization provided below may have been preempted by an
	initialize method."
	^rate isNil
		ifTrue:
			[rate := 0 asValue]
		ifFalse:
			[rate]!

settlement
	settlement isNil ifTrue: [^settlement := 3].
	^settlement!

settlement: aNumber
	settlement := aNumber.
	self settlementText value: 
		((self settlementDate printType: #day) , ' (' , self settlement printString , ')').!

settlementDate
	^(self date addYears: self firstSource maturityOffset) settlement: self settlement!

settlementText
	^settlementText isNil
		ifTrue:
			[settlementText := String new asValue]
		ifFalse:
			[settlementText]!

zeroCouponYield
	^zeroCouponYield!

zeroCouponYield: aBaliYield
	zeroCouponYield := aBaliYield.
	self zeroCouponYieldText value: aBaliYield printString.!

zeroCouponYieldText
	"This method was generated by UIDefiner.  Any edits made here
	may be lost whenever methods are automatically defined.  The
	initialization provided below may have been preempted by an
	initialize method."
	^zeroCouponYieldText isNil
		ifTrue:
			[zeroCouponYieldText := String new asValue]
		ifFalse:
			[zeroCouponYieldText]! !
"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!

BaliCalcYieldPricing class
	instanceVariableNames: ''!


!BaliCalcYieldPricing class methodsFor: 'interface specs'!

windowSpec
	"UIPainter new openOnClass: self andSelector: #windowSpec"

	
	^#(#FullSpec 
		#window: 
		#(#WindowSpec 
			#label: 'Bond Evaluator' 
			#min: #(#Point 189 315 ) 
			#max: #(#Point 388 372 ) 
			#bounds: #(#Rectangle 274 493 468 831 ) 
			#colors: 
			#(#LookPreferences 
				#setForegroundColor: #(#ColorValue #black ) 
				#setBackgroundColor: #(#ColorValue 6143 7167 8191 ) 
				#setSelectionForegroundColor: #(#ColorValue #black ) 
				#setSelectionBackgroundColor: #(#ColorValue 4915 4915 4915 ) 
				#setBorderColor: #(#ColorValue #black ) ) 
			#isEventDriven: true ) 
		#component: 
		#(#SpecCollection 
			#collection: #(
				#(#LabelSpec 
					#layout: #(#Point 3 109 ) 
					#label: 'Coupon' ) 
				#(#InputFieldSpec 
					#layout: #(#Rectangle 58 107 123 133 ) 
					#colors: 
					#(#LookPreferences 
						#setBackgroundColor: #(#ColorValue #white ) ) 
					#model: #couponRate 
					#callbacksSpec: 
					#(#UIEventCallbackSubSpec 
						#valueChangeSelector: #calculate ) 
					#type: #number ) 
				#(#InputFieldSpec 
					#layout: #(#Rectangle 5 3 188 27 ) 
					#colors: 
					#(#LookPreferences 
						#setBackgroundColor: #(#ColorValue 7167 7679 8191 ) ) 
					#model: #zeroCouponYieldText 
					#tabable: false 
					#alignment: #center 
					#isReadOnly: true ) 
				#(#LabelSpec 
					#layout: #(#Point 4 82 ) 
					#label: 'Maturity' ) 
				#(#InputFieldSpec 
					#layout: #(#Rectangle 58 80 188 105 ) 
					#colors: 
					#(#LookPreferences 
						#setBackgroundColor: #(#ColorValue #white ) ) 
					#model: #maturityText 
					#callbacksSpec: 
					#(#UIEventCallbackSubSpec 
						#valueChangeSelector: #changeMaturity ) 
					#tabable: false 
					#isReadOnly: false ) 
				#(#LabelSpec 
					#layout: #(#Point 4 30 ) 
					#label: ' date' ) 
				#(#InputFieldSpec 
					#layout: #(#Rectangle 58 31 188 53 ) 
					#colors: 
					#(#LookPreferences 
						#setBackgroundColor: #(#ColorValue 7700 7700 7700 ) ) 
					#model: #dateText 
					#tabable: false 
					#isReadOnly: true ) 
				#(#InputFieldSpec 
					#layout: #(#Rectangle 90 190 188 212 ) 
					#colors: 
					#(#LookPreferences 
						#setBackgroundColor: #(#ColorValue 7700 7700 7700 ) ) 
					#model: #rate 
					#tabable: false 
					#isReadOnly: true 
					#type: #number 
					#formatString: '0.0000' ) 
				#(#InputFieldSpec 
					#layout: #(#Rectangle 90 286 188 308 ) 
					#colors: 
					#(#LookPreferences 
						#setBackgroundColor: #(#ColorValue 7700 7700 7700 ) ) 
					#model: #duration 
					#tabable: false 
					#isReadOnly: true 
					#type: #number 
					#formatString: '0.000' ) 
				#(#LabelSpec 
					#layout: #(#Point 6 288 ) 
					#label: ' duration' ) 
				#(#DividerSpec 
					#layout: #(#LayoutFrame 5 0 177 0 -5 1 181 0 ) ) 
				#(#LabelSpec 
					#layout: #(#Point 4 192 ) 
					#label: 'Theor. Bid' ) 
				#(#InputFieldSpec 
					#layout: #(#Rectangle 126 109 175 130 ) 
					#flags: 0 
					#model: #couponRate 
					#tabable: false 
					#isReadOnly: true 
					#type: #number ) 
				#(#InputFieldSpec 
					#layout: #(#Rectangle 90 336 188 359 ) 
					#colors: 
					#(#LookPreferences 
						#setBackgroundColor: #(#ColorValue 7700 7700 7700 ) ) 
					#model: #convexity 
					#tabable: false 
					#isReadOnly: true 
					#type: #number 
					#formatString: '0.000' ) 
				#(#LabelSpec 
					#layout: #(#Point 5 336 ) 
					#label: 'Convexity' ) 
				#(#LabelSpec 
					#layout: #(#Point 5 263 ) 
					#label: ' delta' ) 
				#(#InputFieldSpec 
					#layout: #(#Rectangle 90 262 188 284 ) 
					#colors: 
					#(#LookPreferences 
						#setBackgroundColor: #(#ColorValue 7700 7700 7700 ) ) 
					#model: #delta 
					#tabable: false 
					#isReadOnly: true 
					#type: #number 
					#formatString: '0.0' ) 
				#(#InputFieldSpec 
					#layout: #(#Rectangle 58 55 151 78 ) 
					#colors: 
					#(#LookPreferences 
						#setBackgroundColor: #(#ColorValue 7700 7700 7700 ) ) 
					#model: #settlementText 
					#tabable: false 
					#isReadOnly: true ) 
				#(#LabelSpec 
					#layout: #(#Point 5 58 ) 
					#label: 'Settl.' ) 
				#(#LabelSpec 
					#layout: #(#Point 4 312 ) 
					#label: 'Mod. Duration' ) 
				#(#InputFieldSpec 
					#layout: #(#Rectangle 90 311 188 334 ) 
					#colors: 
					#(#LookPreferences 
						#setBackgroundColor: #(#ColorValue 7700 7700 7700 ) ) 
					#model: #modDuration 
					#tabable: false 
					#isReadOnly: true 
					#type: #number 
					#formatString: '0.000' ) 
				#(#ActionButtonSpec 
					#layout: #(#Rectangle 153 56 189 65 ) 
					#flags: 0 
					#model: #incSettlement 
					#tabable: false 
					#label: '+' 
					#defaultable: true ) 
				#(#ActionButtonSpec 
					#layout: #(#Rectangle 153 68 189 77 ) 
					#flags: 0 
					#model: #decSettlement 
					#tabable: false 
					#label: '-' 
					#defaultable: true ) 
				#(#RadioButtonSpec 
					#layout: #(#Point 54 132 ) 
					#model: #interestType 
					#callbacksSpec: 
					#(#UIEventCallbackSubSpec 
						#valueChangeSelector: #calculate ) 
					#tabable: false 
					#label: 'Bond' 
					#select: #bond ) 
				#(#RadioButtonSpec 
					#layout: #(#Point 54 150 ) 
					#model: #interestType 
					#callbacksSpec: 
					#(#UIEventCallbackSubSpec 
						#valueChangeSelector: #calculate ) 
					#tabable: false 
					#label: 'T-bill' 
					#select: #tbill ) 
				#(#ArbitraryComponentSpec 
					#layout: #(#LayoutFrame -28 1 166 0 -5 1 190 0 ) 
					#flags: 0 
					#component: #logotype ) 
				#(#LabelSpec 
					#layout: #(#Point 4 216 ) 
					#label: 'Clean Price' ) 
				#(#InputFieldSpec 
					#layout: #(#Rectangle 90 214 188 236 ) 
					#colors: 
					#(#LookPreferences 
						#setBackgroundColor: #(#ColorValue 7700 7700 7700 ) ) 
					#model: #cleanPrice 
					#tabable: false 
					#isReadOnly: true 
					#type: #number 
					#formatString: '0.000' ) 
				#(#LabelSpec 
					#layout: #(#Point 4 240 ) 
					#label: ' dirty Price' ) 
				#(#InputFieldSpec 
					#layout: #(#Rectangle 90 238 188 260 ) 
					#colors: 
					#(#LookPreferences 
						#setBackgroundColor: #(#ColorValue 7700 7700 7700 ) ) 
					#model: #dirtyPrice 
					#tabable: false 
					#isReadOnly: true 
					#type: #number 
					#formatString: '0.000000' ) ) ) )! !




*/