org.unizone.finance.equity | ![]() |
org.unizone.0.5800
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.equity.VolatilityBS |
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.8532/* BaliTimeSource subclass: #BaliVolatilityBS instanceVariableNames: ' days standardVol ' classVariableNames: '' poolDictionaries: '' category: 'Bali'! !BaliVolatilityBS methodsFor: 'black&scholes'! cashFlowVol: vol rate: rate timeArray: timeArray valueArray: valueArray | extraDays matDate call delta cashFlow trailDelta res strikePrice spotPrice years lastPrice | extraDays := 10. spotPrice := strikePrice := valueArray at: 1. matDate := timeArray last addDays: extraDays. delta := 0. cashFlow := 0. spotPrice isNil ifFalse: [ years := (matDate subtractDate: timeArray first) / 365. call := self nextSource bsPriceCall: true spot: spotPrice years: years strike: strikePrice sigma: vol rate: rate. delta := self nextSource bsDeltaCall: true spot: spotPrice years: years strike: strikePrice sigma: vol rate: rate. cashFlow := (spotPrice * delta - call) * (self raise: (1 + (rate / 100)) to: (years - (extraDays / 365)))]. 2 to: timeArray size do: [:i | trailDelta := delta. spotPrice := valueArray at: i. spotPrice isNil ifFalse: [ strikePrice isNil ifTrue: [strikePrice := spotPrice]. lastPrice := spotPrice. years := (matDate subtractDate: (timeArray at: i)) / 365. delta := self nextSource bsDeltaCall: true spot: spotPrice years: years strike: strikePrice sigma: vol rate: rate. cashFlow := cashFlow + ((delta - trailDelta) * spotPrice * (self raise: (1 + (rate / 100)) to: (years - (extraDays / 365))))]]. res := cashFlow - (lastPrice * delta) + (self nextSource bsPriceCall: true spot: lastPrice years: years strike: strikePrice sigma: vol rate: rate). ^res! volCalcRate: rate environment: env | res startVol src newEnv set sourceSteps array | startVol := self standardVol valueAspect: #value environment: env. startVol isNil ifTrue: [startVol := 25]. src := self nextSource. newEnv := JazzEnvironment new. newEnv localAt: 'cond_history_from' put: (env timestamp subtractDays: self days value). newEnv localAt: 'cond_history_to' put: env timestamp. newEnv localAt: 'cond_history_resolution' put: #day. set := Set new. src collectStepsDim: #dimHistory environment: newEnv into: set. sourceSteps := set asList. sourceSteps sort. (sourceSteps size = 0 or: [(env timestamp subtractDate: (sourceSteps at: 1)) < (self days value - 10)]) ifTrue: [^nil]. array := Array new: sourceSteps size. 1 to: array size do: [:i | newEnv localAt: 'cond_history' put: (sourceSteps at: i). array at: i put: (src valueAspect: #price environment: newEnv)]. res := self optimize: [:vol | vol > 0 ifTrue: [self cashFlowVol: vol rate: rate timeArray: sourceSteps valueArray: array] ifFalse: [self cashFlowVol: 1 rate: rate timeArray: sourceSteps valueArray: array]] final: 0 lowStart: startVol * 0.5 highStart: startVol * 1.5 maxDiff: 0.0001. ^res! ! !BaliVolatilityBS methodsFor: 'source'! asSourceAdaptor self user currentSource isNil ifTrue: [^nil]. self nextSource: self user currentSource. self user sourceCommandQty value > 0 ifTrue: [self days value: self user sourceCommandQty value]. ^self! basicValueTypes ^#(#volatility)! defaultName self nextSource isNil ifTrue: [^self days truncated printString , ' days volatility']. ^self days value truncated printString , ' days B&S vol ' , self nextSource name.! ! !BaliVolatilityBS methodsFor: 'aspects'! days days isNil ifTrue: [days := 30 asValue]. ^days! nextSource: aBaliSource super nextSource: aBaliSource. self standardVol nextSource: aBaliSource.! standardVol standardVol isNil ifTrue: [standardVol := BaliVolatility new days: self days; nextSource: self nextSource]. ^standardVol! ! !BaliVolatilityBS methodsFor: 'timeSource'! basicCreateDataAt: aBaliTime resolution: aResolution environment: env | data | self server user report: 'Preparing ' , self name , ' at ' , (aBaliTime printType: #day). data := BaliTimeData new source: self. data aspects at: #timestamp put: aBaliTime. data aspects at: #value put: (self volCalcRate: self server defaultRate environment: env). self server user report: ''. ^data! ! !BaliVolatilityBS methodsFor: 'copying'! baliCopy: aDictionary | src | src := aDictionary at: self ifAbsent: nil. src isNil ifFalse: [^src]. src := super baliCopy: aDictionary. src days value: self days value. ^src! ! !BaliVolatilityBS methodsFor: ' database'! addDefinition | aspects | (aspects := super addDefinition) isNil ifTrue: [^nil]. self addAspect: #dbDays value: self days value printString position: aspects + 1. ^aspects + 1! dbDays: aString self days value: (GotheTools atod: aString) truncated! ! !BaliVolatilityBS methodsFor: 'element'! uiClass ^BaliDaysUI! ! "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "! BaliVolatilityBS class instanceVariableNames: ''! !BaliVolatilityBS class methodsFor: 'aspects'! scriptClass ^'VolatilityBS'! scriptSuperClass ^'Effect'! ! */ |