| org.unizone.finance.interest | ![]() |
org.unizone.0.6140
Instance of Type
Inheriting from SourceAdapterSingleTimeseries
| Type data | Value |
| 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.resourceOf | List{} |
| org.uninode.Listable.resources | Reference[org.uninode.Listable.resources] of org.unizone.finance.interest.TheoreticalBond |
| 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 | |
| String | displayName The display name is the name that is shown in lists, displays and graphs. | Source | org.unizone.0.4001 | essential | |
| Attribute | valueAttribute The value attribute is used for determining the default value that should be used for displaying this source in a graph. | Source | org.unizone.0.4011 | type inheritValue | |
| Signature | valueType The value type determines which axes should be used in graphs. | Source | org.unizone.0.4002 | inheritValue | |
| Source | source | SourceAdapterSingle | org.unizone.0.4051 | ||
| Method summary | Defined in | Overrides | Properties | |
| void | activate | Listable | ||
| void | checkRange | SourceAdapterSingle | Source | |
| void | designEditor(WidgetWorkspace ws) | Listable | ||
| void | generateScript(ScriptGenerationInfo info) | SourceAdapterSingle | ScriptGenerator | |
| Real | get(DateTime timestamp) | SourceAdapterSingleTimeseries | ||
| Boolean | isResourceOf(Listable listable, Signature aspect) | Mixable | type | |
| Listable | mixOn(Mixable mix) | Mixable | ||
| Listable | mixWith(Mixable mix) | Mixable | ||
| void | put(DateTime timestamp, Real value) | SourceAdapterSingleTimeseries | ||
| String | resourceString | Listable | introspection | |
| void | setSource(Source source) | SourceAdapterSingle | ||
| Source | source | SourceAdapterSingle | ||
| void | XXXcom.nodelab.java.sourceadaptersingle.CheckRange | SourceAdapterSingle | ||
| Signature | XXXcom.nodelab.java.sourceadaptersingle.ValueType | SourceAdapterSingle | ||
| void | com.nodelab.java.source.Activate | Source | Listable | |
| Listable | com.nodelab.java.source.MixWithMi | Source | Mixable | |
| Script summary |
org.unizone.0.8537/*
BaliSecBond subclass: #BaliYieldSecurity
instanceVariableNames: 'interest maturity coupon adaptorType '
classVariableNames: ''
poolDictionaries: ''
category: 'Bali'!
!BaliYieldSecurity methodsFor: 'source'!
asSourceAdaptor
self nextSource: self user currentSource.
self user previousSources size >= 2 ifTrue: [
self interest value: (self user previousSources at: 2)].
(self interest value isNil not
and: [self interest value isKindOf: BaliSecBond])
ifFalse: [
self adaptorType value: #maturityCoupon.
self interest value: nil.
self report: 'No bond on source stack'].
^self!
baseSources
"return a list of the system sources that this source depends on"
| src |
(src := self nextSource) isNil
ifTrue: [^List new]
ifFalse: [^src baseSources].!
basicDimensionsRequired: aBaliDisplay
^#(#dimHistory)!
basicValueAspect: anAspect environment: env
| rate |
anAspect = #cleanPrice ifTrue: [
rate := self valueAspect: #value environment: env.
^BaliSecBond new
cleanPriceAt: env timestamp
maturity: self maturity value
rate: rate
coupon: self coupon value].
anAspect = #dirtyPrice ifTrue: [
rate := self valueAspect: #value environment: env.
^BaliSecBond new
dirtyPriceAt: env timestamp
maturity: self maturity value
rate: rate
coupon: self coupon value].
^super basicValueAspect: anAspect environment: env!
basicValueTypes
^#(#rate)!
defaultName
self adaptorType value = #theoreticalInterest
ifTrue: [self interest value isNil
ifTrue: [^'theoretical bond, no interest']
ifFalse: [^'theor. bond (' , self interest value name , ', ' ,
self nextSource name , ')']]
ifFalse: [^'theor. bond (' , self maturity value printString ,
', cup. ' , self coupon value printString , ', ' ,
self nextSource name , ')']!
estimatedAspect: anAspect environment: env
"return value of the first possible non-nil value"
^self valueAspect: anAspect environment: env!
listAspects: aDictionary
super listAspects: aDictionary.
aDictionary at: #cleanPrice put: nil.
aDictionary at: #dirtyPrice put: nil.
aDictionary at: #bid put: nil.
aDictionary at: #maturity put: nil.
aDictionary at: #coupon put: nil.!
nextSourcesAspect: anAspect
| res |
res := super nextSourcesAspect: anAspect.
self interest value isNil ifFalse: [res add: self interest value].
^res! !
!BaliYieldSecurity methodsFor: 'aspects'!
adaptorType
"#theoreticalInterest (non-existent interest) or #virtualInterest (based on a real interest)"
^adaptorType isNil
ifTrue:
[adaptorType := #theoreticalInterest asValue]
ifFalse:
[adaptorType]!
coupon
^coupon isNil
ifTrue:
[coupon := 0 asValue]
ifFalse:
[coupon]!
interest
^interest isNil
ifTrue:
[interest := nil asValue]
ifFalse:
[interest]!
maturity
^maturity isNil
ifTrue:
[maturity := ((BaliTime now addYears: 10) type: #day) asValue]
ifFalse:
[maturity]!
uiClass
^BaliYieldSecurityUI! !
!BaliYieldSecurity methodsFor: 'timeSource'!
basicCreateDataAt: aBaliTime resolution: aResolution environment: env
| data val newData |
newData := BaliTimeData new source: self.
newData aspects at: #timestamp put: aBaliTime.
self adaptorType value = #theoreticalInterest
ifFalse: [
val := self
zeroCouponRate: self nextSource
at: aBaliTime
maturity: self maturity value
coupon: self coupon value.
newData aspects at: #bid put: val.
newData aspects at: #maturity put: self maturity value.
newData aspects at: #coupon put: self coupon value]
ifTrue: [
self interest value isNil ifTrue: [^newData].
data := self interest value dataTime: aBaliTime resolution: aResolution environment: env.
newData aspects: Dictionary new.
data isNil
ifFalse: [
val := data zeroCouponRate: self nextSource.
data aspects keys do: [:key | newData aspects at: key put: (data aspects at: key)]]
ifTrue: [val := nil].
newData aspects at: #timestamp put: aBaliTime.
newData aspects at: #bid put: val].
^newData!
reportPreparation
^true! !
!BaliYieldSecurity methodsFor: 'copying'!
baliCopy: aDictionary
| src |
src := aDictionary at: self ifAbsent: nil.
src isNil ifFalse: [^src].
src := super baliCopy: aDictionary.
src nextSource: (self nextSource baliCopy: aDictionary).
self interest value isNil
ifFalse: [src interest value: (self interest value baliCopy: aDictionary)].
src adaptorType value: self adaptorType value.
src maturity value: self maturity value copy.
src coupon value: self coupon value.
^src! !
!BaliYieldSecurity methodsFor: ' database'!
addDefinition
| aspects |
(aspects := super addDefinition) isNil ifTrue: [^nil].
self interest value isNil ifFalse: [
aspects := aspects + 1.
self
addAspect: #dbInterest
value: self interest value symbol asString
position: aspects.
self interest value addDefinition].
maturity value isNil ifFalse: [
aspects := aspects + 1.
self
addAspect: #dbMaturity
value: self maturity value asSybaseString
position: aspects].
coupon value isNil ifFalse: [
aspects := aspects + 1.
self
addAspect: #dbCoupon
value: self coupon value printString
position: aspects].
self
addAspect: #dbAdaptorType
value: self adaptorType value asString
position: aspects + 1.
^aspects + 1!
dbAdaptorType: aString
self adaptorType value: aString asSymbol!
dbCoupon: aString
self coupon value: (GotheTools atod: aString)!
dbInterest: aString
self interest value: (self server element: aString asSymbol)!
dbLoadInfo2!
dbMaturity: aString
self maturity value: (BaliTime fromString: aString)! !
!BaliYieldSecurity methodsFor: 'menus'!
setEffectMenu: aMenu
super setEffectMenu: aMenu.
aMenu addItem: ((MenuItem labeled: 'Clean Price') value: BaliPriceClean).
aMenu addItem: ((MenuItem labeled: ' dirty Price') value: BaliPriceDirty).! !
!BaliYieldSecurity methodsFor: 'timeList'!
prepareDataFrom: aBaliTime resolution: aResolution
"load all historical data between (including) aBaliTime and now"
| env set first timeList load |
load := self loadResolution: aResolution.
load loadedFrom isNil
ifTrue: [first := BaliTime now addDays: 1]
ifFalse: [first := load loadedFrom].
aBaliTime < first ifFalse: [^nil].
env := JazzEnvironment new.
env localAt: 'cond_history_from' put: (aBaliTime subtractDays: 30).
env localAt: 'cond_history_to' put: first.
env localAt: 'cond_history_resolution' put: #day.
set := Set new.
self nextSource collectStepsDim: #dimHistory environment: env into: set.
timeList := set asList.
timeList sort.
timeList do: [:time |
time < first ifTrue: [
self dataList add: (self createDataAt: time resolution: aResolution environment: env)]].
load loadedFrom: timeList first.
self dataList sort.! !
!BaliYieldSecurity methodsFor: 'steps'!
collectStepsFor: aBaliDisplay environment: aJazzEnvironment
self nextSources do: [:src |
src collectStepsFor: aBaliDisplay environment: aJazzEnvironment].! !
"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!
BaliYieldSecurity class
instanceVariableNames: ''!
!BaliYieldSecurity class methodsFor: 'aspects'!
scriptClass
^'YieldInterest'!
scriptSuperClass
^'Effect'! !
*/ |