Node org.unizone.finance.interest.TheoreticalBond

org.unizone.0.8537
Instance of TypeScriptInfo

Node dataValue
org.edgescript.TypeScriptInfo.prerequisiteParcelsList{}
org.edgescript.TypeScriptInfo.prerequisiteMethodsList{}
org.edgescript.TypeScriptInfo.script/* 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'! ! */
org.edgescript.TypeScriptInfo.defineTypeorg.unizone.finance.interest.TheoreticalBond
org.edgescript.TypeScriptInfo.prerequisiteScriptsList{}