Node com.nodelab.interest.CalcIndex

com.nodelab.0.10379
Instance of TypeScriptInfo

Node dataValue
org.edgescript.TypeScriptInfo.prerequisiteParcelsList{}
org.edgescript.TypeScriptInfo.prerequisiteMethodsList{}
org.edgescript.TypeScriptInfo.script/* constructor() { View:(); } */ /* BaliCalculator subclass: #BaliCalcIndex instanceVariableNames: 'forwards totalValue indexValue hedgeTableInterface hedgeTable index weights hedges timestamp yesterdayValue lastEdit ' classVariableNames: 'Indices ' poolDictionaries: '' category: 'Bali'! !BaliCalcIndex methodsFor: 'actions'! calculateDelta 1 to: self hedges rowSize do: [:i | self hedges at: 1@i put: ((self hedges at: 7@i) * 100 / self totalValue value) asDouble. self hedges at: 1@i put: (((self hedges at: 1@i) * 100) rounded / 100) asDouble. self hedges at: 5@i put: (self indexValue value * self forwards value negated * (self hedges at: 1@i) / (self hedges at: 3@i)) rounded].! calculateValue self totalValue value: 0. self yesterdayValue value: 0. 1 to: self hedges rowSize do: [:i | self hedges at: 6@i put: (self weights at: 2@i). self hedges at: 7@i put: ((self hedges at: 3@i) * (self hedges at: 6@i)) rounded. self hedges at: 8@i put: (self weights at: 3@i). self hedges at: 10@i put: ((self hedges at: 8@i) * (self hedges at: 9@i)) rounded. self totalValue value: self totalValue value + (self hedges at: 7@i). self yesterdayValue value: self yesterdayValue value + (self hedges at: 10@i)].! changeForwards self calculateValue. self calculateDelta. self setTable.! changeIndex self halt. weights := nil. self totalValue value: 0. self yesterdayValue value: 0. self setLast. self calculateValue. self setIndex. self calculateDelta. self setTable.! changeIndexValue self calculateValue. self calculateDelta. self setTable.! changeLast | row | row := self hedgeTableInterface selectionIndex y. row = 0 ifTrue: [^Dialog warn: 'You must select a row to edit']. self hedges at: 3@row put: self lastEdit value. self calculateValue. self setIndex. self calculateDelta. self setTable.! copyTable | str | self index value isNil ifTrue: [^Dialog warn: 'No index chosen']. Cursor execute showWhile: [ str := ((self builder componentAt: #indices) widget menu labelAtValue: self index value) , self tab , self indexValue value printString, self tab , self timestamp value , self tab , 'forwards' , self tab , self forwards value printString , self cr , (GotheTools tableInterface: self hedgeTableInterface asStringWithSeparator: self tab) , self cr , 'Total market value' , self tab , self totalValue value printString , self tab , 'Yesterday market value' , self tab , self yesterdayValue value printString. ParagraphEditor currentSelection: str asText].! setIndex | indexSrc env | indexSrc := self server element: self index value asSymbol. indexSrc isNil ifFalse: [ indexSrc baliMessage: #setDependents with: self. indexSrc dbLoadInfo: 2. (indexSrc loadAspects includes: #last) ifFalse: [indexSrc loadAspects add: #last]. env := JazzEnvironment new. env localAt: 'cond_history' put: (self server now addDays: -1). env localAt: 'cond_history_from' put: (BaliTime now addDays: -10). env localAt: 'cond_history_to' put: (BaliTime now addDays: 1). env localAt: 'cond_history_resolution' put: #day. self indexValue value: (indexSrc estimatedAspect: #value environment: env). self timestamp value: (indexSrc realtime timestamp printType: #minute). self indexValue value: (((self indexValue value * self totalValue value / self yesterdayValue value) * 100) rounded / 100) asDouble].! setLast | src env today yesterday | hedges := nil. env := JazzEnvironment new. today := self server now addDays: 1. yesterday := self server now addDays: -1. env localAt: 'cond_history_from' put: (BaliTime now addDays: -10). env localAt: 'cond_history_to' put: (BaliTime now addDays: 1). env localAt: 'cond_history_resolution' put: #day. 1 to: self hedges rowSize do: [:i | src := self server element: (self weights at: 1@i) asSymbol. src dbLoadInfo: 2. (src loadAspects includes: #last) ifFalse: [src loadAspects add: #last]. self hedges at: 2@i put: src name. src checkRealtime: true. env localAt: 'cond_history' put: today. self hedges at: 3@i put: (src estimatedAspect: #value environment: env) asDouble. self hedges at: 4@i put: (src realtime timestamp printType: #hour). env localAt: 'cond_history' put: yesterday. self hedges at: 9@i put: (src estimatedAspect: #value environment: env) asDouble].! setTable | widths gc width | 1 to: self hedges rowSize do: [:i | self hedges at: 5@i put: (GotheTools formatInteger: (self hedges at: 5@i) rounded). self hedges at: 6@i put: (GotheTools formatInteger: (self hedges at: 6@i) rounded). self hedges at: 7@i put: (GotheTools formatInteger: (self hedges at: 7@i) rounded) , ' '. self hedges at: 8@i put: (GotheTools formatInteger: (self hedges at: 8@i) rounded). self hedges at: 10@i put: (GotheTools formatInteger: (self hedges at: 10@i) rounded) , ' ']. self hedgeTableInterface tableView isNil ifFalse: [ widths := List new. gc := self hedgeTableInterface tableView graphicsContext. 1 to: self hedges columnSize do: [:col | width := gc widthOfString: (self hedgeTableInterface columnLabels value at: col). 1 to: self hedges rowSize do: [:row | width := width max: (gc widthOfString: (self hedges at: col@row) printString)]. widths add: width + 10]]. self hedgeTableInterface columnWidths: widths. self hedgeTable table: self hedges.! ! !BaliCalcIndex methodsFor: 'aspects'! columnCount ^10! forwards ^forwards isNil ifTrue: [forwards := 0 asValue] ifFalse: [forwards]! hedges hedges isNil ifTrue: [hedges := TwoDList on: (Array new: (self weights size * self columnCount / 3)) columns: self columnCount]. ^hedges! hedgeTable hedgeTable isNil ifTrue: [hedgeTable := SelectionInTable with: self hedges]. ^hedgeTable! hedgeTableInterface hedgeTableInterface isNil ifTrue: [ hedgeTableInterface := TableInterface new selectionInTable: self hedgeTable. hedgeTableInterface columnLabelsFormats: #right. hedgeTableInterface elementFormats: #right. hedgeTableInterface columnLabelsArray: #('%' 'Name' 'Last' 'Timestamp' ' delta' 'Shares' 'Market value' 'Shares yest.' 'Last yest.' 'Market v. yest.' )]. ^hedgeTableInterface! index "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." ^index isNil ifTrue: [index := nil asValue] ifFalse: [index]! indexValue "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." ^indexValue isNil ifTrue: [indexValue := 0 asValue] ifFalse: [indexValue]! lastEdit "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." ^lastEdit isNil ifTrue: [lastEdit := 0 asValue] ifFalse: [lastEdit]! table table isNil ifTrue: [table := SelectionInTable with: self hedges]. ^table! timestamp timestamp isNil ifTrue: [timestamp := nil asValue]. ^timestamp! totalValue "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." ^totalValue isNil ifTrue: [totalValue := 0 asValue] ifFalse: [totalValue]! weights | tmpList dict | weights isNil ifTrue: [ tmpList := List new. self index value isNil ifFalse: [ self secretary infoAspects2: self index value asString aspect1: 'shares' do: [:an | tmpList add: (an at: 1). tmpList add: (GotheTools atod: (an at: 2)) rounded. tmpList add: 0]]. weights := TwoDList on: tmpList columns: 3. self index value isNil ifFalse: [ dict := Dictionary new. self secretary infoAspects2: self index value asString aspect1: 'shares yesterday' do: [:an | dict at: (an at: 1) put: (GotheTools atod: (an at: 2)) rounded]. 1 to: weights rowSize do: [:i | weights at: 3@i put: (dict at: (weights at: 1@i) ifAbsent: 0)]]]. " self index value isNil ifFalse: [ dict = Dictionary new. i := 1. self secretary infoAspects2: self index value asString aspect1: 'shares yesterday' do: [:an | weights at: 3@i put: (GotheTools atod: (an at: 2)) rounded. i := i + 1]]]." ^weights! yesterdayValue "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." ^yesterdayValue isNil ifTrue: [yesterdayValue := 0 asValue] ifFalse: [yesterdayValue]! ! "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "! BaliCalcIndex class instanceVariableNames: ''! !BaliCalcIndex class methodsFor: 'interface specs'! windowSpec "UIPainter new openOnClass: self andSelector: #windowSpec" ^#(#FullSpec #window: #(#WindowSpec #label: 'Unlabeled Canvas' #bounds: #(#Rectangle 557 771 1044 1169 ) ) #component: #(#SpecCollection #collection: #( #(#MenuButtonSpec #layout: #(#Rectangle 7 5 254 29 ) #name: #indices #model: #index #callbacksSpec: #(#UIEventCallbackSubSpec #valueChangeSelector: #changeIndex ) #menu: #indices ) #(#InputFieldSpec #layout: #(#Rectangle 328 5 406 29 ) #colors: #(#LookPreferences #setBackgroundColor: #(#ColorValue #white ) ) #model: #indexValue #callbacksSpec: #(#UIEventCallbackSubSpec #valueChangeSelector: #changeIndexValue ) #tabable: false #isReadOnly: false #type: #number ) #(#LabelSpec #layout: #(#Point 263 10 ) #label: 'Index' ) #(#LabelSpec #layout: #(#Point 262 34 ) #label: 'Forwards' ) #(#InputFieldSpec #layout: #(#Rectangle 328 34 406 58 ) #colors: #(#LookPreferences #setBackgroundColor: #(#ColorValue #white ) ) #model: #forwards #callbacksSpec: #(#UIEventCallbackSubSpec #valueChangeSelector: #changeForwards ) #type: #number ) #(#TableViewSpec #layout: #(#LayoutFrame 8 0 63 0 -5 1 -30 1 ) #model: #hedgeTableInterface #tabable: false #selectionStyle: #row ) #(#InputFieldSpec #layout: #(#LayoutFrame 123 0 -26 1 266 0 -3 1 ) #model: #totalValue #tabable: false #type: #number ) #(#LabelSpec #layout: #(#LayoutOrigin 9 0 -24 1 ) #label: 'Total market value' ) #(#LabelSpec #layout: #(#Point 415 9 ) #label: 'Time' ) #(#InputFieldSpec #layout: #(#Rectangle 472 6 611 30 ) #model: #timestamp #tabable: false #isReadOnly: true ) #(#ActionButtonSpec #layout: #(#LayoutFrame -75 1 -28 1 -2 1 -2 1 ) #model: #copyTable #label: 'Copy' #defaultable: true ) #(#LabelSpec #layout: #(#LayoutOrigin 283 0 -24 1 ) #label: 'Yesterday market value' ) #(#InputFieldSpec #layout: #(#LayoutFrame 424 0 -26 1 567 0 -3 1 ) #model: #yesterdayValue #tabable: false #type: #number ) #(#LabelSpec #layout: #(#Point 74 35 ) #label: 'Edit last' ) #(#InputFieldSpec #layout: #(#Rectangle 128 34 199 56 ) #colors: #(#LookPreferences #setBackgroundColor: #(#ColorValue #white ) ) #model: #lastEdit #callbacksSpec: #(#UIEventCallbackSubSpec #valueChangeSelector: #changeLast ) #type: #number ) ) ) )! ! !BaliCalcIndex class methodsFor: 'resources'! indices "MenuEditor new openOnClass: self andSelector: #indices" ^#(#Menu #( #(#MenuItem #rawLabel: 'OMX Index' #value: #'SSE_RT-OMX' ) ) #(1 ) nil ) decodeAsLiteralArray! ! */
org.edgescript.TypeScriptInfo.defineTypecom.nodelab.interest.CalcIndex
org.edgescript.TypeScriptInfo.prerequisiteScriptsList{}