com.nodelab.equity

Type CalcBlackScholes

com.nodelab.0.10172
Instance of Type
Inheriting from Calculator

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.equity.CalcBlackScholes

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.10377
/*
BaliCalculator subclass: #BaliCalcBlackScholes
	instanceVariableNames: 'maturityText maturity type spot price gamma sigma theta delta rate strike rho vega realtimeIndicator '
	classVariableNames: ''
	poolDictionaries: ''
	category: 'Bali'!


!BaliCalcBlackScholes methodsFor: 'aspects'!

date
	^self display dimHistory focus!

date: aBaliTime
	self display dimHistory focus: aBaliTime.!

dateText
	^self display dimHistory focusHolder!

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

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

maturity
	maturity isNil ifTrue: [self maturity: (BaliTime now addYears: 1)].
	^maturity!

maturity: aBaliTime
	maturity := aBaliTime.
	self maturityText value: (maturity printType: #day)!

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

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

rate
	^rate isNil
		ifTrue:
			[rate := self server defaultRate asDouble asValue]
		ifFalse:
			[rate]!

realtimeIndicator
	"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."

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

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

sigma
	^sigma isNil
		ifTrue:
			[sigma := 25 asValue]
		ifFalse:
			[sigma]!

spot
	| env |
	env := self display envDimensions.
	^spot isNil
		ifTrue:
			[spot := (self display plugin firstSource valueAspect: #price environment: env) asValue]
		ifFalse:
			[spot]!

strike
	^strike isNil
		ifTrue:
			[strike := self spot value asValue]
		ifFalse:
			[strike]!

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

type
	^type isNil
		ifTrue:
			[type := #call asValue]
		ifFalse:
			[type]!

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

!BaliCalcBlackScholes methodsFor: 'actions'!

calculate
	| source years spotValue strikeValue sigmaValue rateValue |
	source := self display plugin firstSource.
	spotValue := self spot value.
	spotValue isNil ifTrue: [^nil].
	spotValue := spotValue asDouble.
	years := (self maturity subtractDate: self display dimHistory focus) / 365.
	strikeValue := self strike value asDouble.
	sigmaValue := self sigma value asDouble.
	rateValue := self rate value asDouble.
	self price value: (source
		bsPriceCall: (self type value = #call)
		spot: spotValue
		years: years
		strike: strikeValue
		sigma: sigmaValue
		rate: rateValue).
	self delta value: (source
		bsDeltaCall: (self type value = #call)
		spot: spotValue
		years: years
		strike: strikeValue
		sigma: sigmaValue
		rate: rateValue).
	self gamma value: (source
		bsGammaCall: (self type value = #call)
		spot: spotValue
		years: years
		strike: strikeValue
		sigma: sigmaValue
		rate: rateValue).
	self theta value: (source 
		bsThetaCall: (self type value = #call)
		spot: spotValue
		years: years
		strike: strikeValue
		sigma: sigmaValue
		rate: rateValue).
	self vega value: (source 
		bsVegaCall: (self type value = #call)
		spot: spotValue
		years: years
		strike: strikeValue
		sigma: sigmaValue
		rate: rateValue).
	self rho value: (source 
		bsRhoCall: (self type value = #call)
		spot: spotValue
		years: years
		strike: strikeValue
		sigma: sigmaValue
		rate: rateValue).
	self display dimHistory realtime value
		ifTrue: [self realtimeIndicator value: '']
		ifFalse: [self realtimeIndicator value: 'Historical data']!

changeDate
	self display dimHistory realtime value: false.
	self date: (BaliTime fromString: self dateText value string).
	self reset.!

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

changeRealtime
	| env |
	env := self display envDimensions.
	self spot value: (self display plugin firstSource valueAspect: #price environment: env).
	self strike value: self spot value.
	super changeRealtime.!

reset
	| env |
	env := self display envDimensions.
	self spot value: (self firstSource valueAspect: #last environment: env).
	self strike value: self spot value.
	super reset.! !
"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!

BaliCalcBlackScholes class
	instanceVariableNames: ''!


!BaliCalcBlackScholes class methodsFor: 'interface specs'!

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

	
	^#(#FullSpec 
		#window: 
		#(#WindowSpec 
			#label: 'Black & Scholes' 
			#min: #(#Point 183 335 ) 
			#max: #(#Point 183 335 ) 
			#bounds: #(#Rectangle 812 675 995 1010 ) 
			#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 5 6 ) 
					#label: ' date' ) 
				#(#LabelSpec 
					#layout: #(#Point 5 29 ) 
					#label: 'Spot' ) 
				#(#LabelSpec 
					#layout: #(#Point 5 53 ) 
					#label: 'Strike' ) 
				#(#LabelSpec 
					#layout: #(#Point 5 75 ) 
					#label: 'Sigma' ) 
				#(#LabelSpec 
					#layout: #(#Point 5 98 ) 
					#label: 'Maturity' ) 
				#(#LabelSpec 
					#layout: #(#Point 5 121 ) 
					#label: 'Rate' ) 
				#(#InputFieldSpec 
					#layout: #(#Rectangle 77 4 177 25 ) 
					#isOpaque: true 
					#colors: 
					#(#LookPreferences 
						#setBackgroundColor: #(#ColorValue #white ) ) 
					#model: #dateText 
					#callbacksSpec: 
					#(#UIEventCallbackSubSpec 
						#valueChangeSelector: #changeDate ) 
					#tabable: false 
					#isReadOnly: false 
					#type: #string ) 
				#(#InputFieldSpec 
					#layout: #(#Rectangle 77 27 177 48 ) 
					#isOpaque: true 
					#colors: 
					#(#LookPreferences 
						#setBackgroundColor: #(#ColorValue #white ) ) 
					#model: #spot 
					#callbacksSpec: 
					#(#UIEventCallbackSubSpec 
						#valueChangeSelector: #calculate ) 
					#tabable: true 
					#isReadOnly: false 
					#type: #number ) 
				#(#InputFieldSpec 
					#layout: #(#Rectangle 77 50 177 71 ) 
					#isOpaque: true 
					#colors: 
					#(#LookPreferences 
						#setBackgroundColor: #(#ColorValue #white ) ) 
					#model: #strike 
					#callbacksSpec: 
					#(#UIEventCallbackSubSpec 
						#valueChangeSelector: #calculate ) 
					#tabable: true 
					#isReadOnly: false 
					#type: #number ) 
				#(#InputFieldSpec 
					#layout: #(#Rectangle 77 73 177 94 ) 
					#isOpaque: true 
					#colors: 
					#(#LookPreferences 
						#setBackgroundColor: #(#ColorValue #white ) ) 
					#model: #sigma 
					#callbacksSpec: 
					#(#UIEventCallbackSubSpec 
						#valueChangeSelector: #calculate ) 
					#tabable: true 
					#isReadOnly: false 
					#type: #number ) 
				#(#InputFieldSpec 
					#layout: #(#Rectangle 77 96 177 117 ) 
					#isOpaque: true 
					#colors: 
					#(#LookPreferences 
						#setBackgroundColor: #(#ColorValue #white ) ) 
					#model: #maturityText 
					#callbacksSpec: 
					#(#UIEventCallbackSubSpec 
						#valueChangeSelector: #changeMaturity ) 
					#tabable: true 
					#isReadOnly: false 
					#type: #string ) 
				#(#InputFieldSpec 
					#layout: #(#Rectangle 77 119 177 140 ) 
					#isOpaque: true 
					#colors: 
					#(#LookPreferences 
						#setBackgroundColor: #(#ColorValue #white ) ) 
					#model: #rate 
					#callbacksSpec: 
					#(#UIEventCallbackSubSpec 
						#valueChangeSelector: #calculate ) 
					#tabable: true 
					#isReadOnly: false 
					#type: #number ) 
				#(#RadioButtonSpec 
					#layout: #(#Point 6 144 ) 
					#model: #type 
					#callbacksSpec: 
					#(#UIEventCallbackSubSpec 
						#valueChangeSelector: #calculate ) 
					#label: 'Call' 
					#select: #call ) 
				#(#RadioButtonSpec 
					#layout: #(#Point 58 144 ) 
					#model: #type 
					#callbacksSpec: 
					#(#UIEventCallbackSubSpec 
						#valueChangeSelector: #calculate ) 
					#label: 'Put' 
					#select: #put ) 
				#(#DividerSpec 
					#layout: #(#LayoutFrame 93 0 175 0 -5 1 179 0 ) ) 
				#(#ActionButtonSpec 
					#layout: #(#Rectangle 3 162 90 191 ) 
					#model: #calculate 
					#label: 'Calculate' 
					#defaultable: true ) 
				#(#LabelSpec 
					#layout: #(#Point 5 194 ) 
					#label: 'Price' ) 
				#(#LabelSpec 
					#layout: #(#Point 5 217 ) 
					#label: ' delta' ) 
				#(#LabelSpec 
					#layout: #(#Point 5 242 ) 
					#label: 'Gamma' ) 
				#(#LabelSpec 
					#layout: #(#Point 5 266 ) 
					#label: 'Theta' ) 
				#(#LabelSpec 
					#layout: #(#Point 5 289 ) 
					#label: 'Vega' ) 
				#(#LabelSpec 
					#layout: #(#Point 5 312 ) 
					#label: 'Rho' ) 
				#(#InputFieldSpec 
					#layout: #(#Rectangle 77 194 177 215 ) 
					#colors: 
					#(#LookPreferences 
						#setBackgroundColor: #(#ColorValue 7700 7700 7700 ) ) 
					#model: #price 
					#tabable: false 
					#isReadOnly: true 
					#type: #number 
					#formatString: '0.000' ) 
				#(#InputFieldSpec 
					#layout: #(#Rectangle 77 217 177 238 ) 
					#colors: 
					#(#LookPreferences 
						#setBackgroundColor: #(#ColorValue 7700 7700 7700 ) ) 
					#model: #delta 
					#tabable: false 
					#isReadOnly: true 
					#type: #number 
					#formatString: '0.000' ) 
				#(#InputFieldSpec 
					#layout: #(#Rectangle 77 240 177 261 ) 
					#colors: 
					#(#LookPreferences 
						#setBackgroundColor: #(#ColorValue 7700 7700 7700 ) ) 
					#model: #gamma 
					#tabable: false 
					#isReadOnly: true 
					#type: #number 
					#formatString: '0.000' ) 
				#(#InputFieldSpec 
					#layout: #(#Rectangle 77 263 177 284 ) 
					#colors: 
					#(#LookPreferences 
						#setBackgroundColor: #(#ColorValue 7700 7700 7700 ) ) 
					#model: #theta 
					#tabable: false 
					#isReadOnly: true 
					#type: #number 
					#formatString: '0.000' ) 
				#(#InputFieldSpec 
					#layout: #(#Rectangle 77 286 177 307 ) 
					#colors: 
					#(#LookPreferences 
						#setBackgroundColor: #(#ColorValue 7700 7700 7700 ) ) 
					#model: #vega 
					#tabable: false 
					#isReadOnly: true 
					#type: #number 
					#formatString: '0.000' ) 
				#(#InputFieldSpec 
					#layout: #(#Rectangle 77 309 177 330 ) 
					#colors: 
					#(#LookPreferences 
						#setBackgroundColor: #(#ColorValue 7700 7700 7700 ) ) 
					#model: #rho 
					#tabable: false 
					#isReadOnly: true 
					#type: #number 
					#formatString: '0.000' ) 
				#(#ArbitraryComponentSpec 
					#layout: #(#LayoutFrame -30 1 167 0 -5 1 186 0 ) 
					#flags: 0 
					#component: #logotype ) ) ) )! !




*/