11// Script for Hibiscus Depot Viewer
2- // Updated 18.09 .2022 by @faiteanu
2+ // Updated 05.10 .2022 by @faiteanu
33// Original version by @mikekorb
44
55try {
@@ -24,7 +24,7 @@ function getAPIVersion() {
2424} ;
2525
2626function getVersion ( ) {
27- return "2022-09-18 " ;
27+ return "2022-10-05 " ;
2828} ;
2929
3030function getName ( ) {
@@ -143,7 +143,7 @@ function process(config) {
143143 }
144144 if ( boerse_id ) {
145145 var histUrl = getURL ( ) + "/quote/historic/historic.csv?secu=" + Packages . jsq . tools . HtmlUnitTools . getFirstElementByXpath ( page , "//input[@name='secu']" ) . getValueAttribute ( )
146- + "&boerse_id=" + boerse_id + "&clean_split=1 &clean_payout=1 &clean_bezug=1 ¤cy=" + currency_id + "&min_time=" + d1 + "." + m1 + "." + y1
146+ + "&boerse_id=" + boerse_id + "&clean_split=0 &clean_payout=0 &clean_bezug=0 ¤cy=" + currency_id + "&min_time=" + d1 + "." + m1 + "." + y1
147147 + "&max_time=" + d2 + "." + m2 + "." + y2 + "&trenner=%3B&go=Download" ;
148148 print ( histUrl ) ;
149149 text = webClient . getPage ( histUrl ) ;
@@ -162,11 +162,16 @@ function extractEvents(page, handelsplatz) {
162162 dict [ "Dividende" ] = Packages . jsq . datastructes . Const . CASHDIVIDEND ;
163163 dict [ "Ausschüttung" ] = Packages . jsq . datastructes . Const . CASHDIVIDEND ;
164164 dict [ "Split" ] = Packages . jsq . datastructes . Const . STOCKSPLIT ;
165+ dict [ "Allg. Korrektur" ] = Packages . jsq . datastructes . Const . STOCKSPLIT ;
165166 dict [ "Reverse Split" ] = Packages . jsq . datastructes . Const . STOCKREVERSESPLIT ;
166167 dict [ "Bezugsrecht" ] = Packages . jsq . datastructes . Const . SUBSCRIPTIONRIGHTS ;
167168
168-
169- eventUrl = url + "/dividende-split/?clean_split=0" ;
169+ if ( kursUrl . indexOf ( "secu=" ) > 0 ) {
170+ // fonds use a different URL from shares
171+ eventUrl = getURL ( ) + "/quote/kapitalmassnahmen.m?clean_split=0&" + kursUrl . substring ( kursUrl . indexOf ( "secu=" ) ) ;
172+ } else {
173+ eventUrl = url + "/dividende-split/?clean_split=0" ;
174+ }
170175
171176 print ( eventUrl ) ;
172177 page = webClient . getPage ( eventUrl ) ;
@@ -196,7 +201,12 @@ function extractEvents(page, handelsplatz) {
196201 }
197202 }
198203 dc . put ( "date" , d ) ;
199- dc . put ( "ratio" , hashmap . get ( "Verhältnis" ) ) ;
204+ var ratio = hashmap . get ( "Verhältnis" ) ;
205+ if ( ratio !== undefined && ratio . trim ( ) !== "" && ratio . indexOf ( ":" ) < 0 ) {
206+ // convert float to ratio with colon
207+ ratio = Packages . jsq . tools . VarTools . stringToBigDecimalGermanFormat ( ratio ) . toString ( ) + ":1" ;
208+ }
209+ dc . put ( "ratio" , ratio ) ;
200210 action = dict [ hashmap . get ( "Ereignis" ) ] ;
201211 if ( typeof action === "undefined" ) {
202212 print ( "Undef für " + hashmap ) ;
0 commit comments