It is currently April 27th, 2024, 7:15 am

WebParser for https://www.wallstreet-online.de/

Get help with creating, editing & fixing problems with skins
emp00
Posts: 83
Joined: October 7th, 2022, 8:08 pm

Re: WebParser for https://www.wallstreet-online.de/

Post by emp00 »

Yincognito wrote: January 29th, 2024, 12:45 pm P.S. One can get away without having scripts to combine symbols by simply providing a single InputText where the user can enter the symbols variable (e.g. the list of symbols separated by the | character). That variable can be used directly in the query, and the skin developer wouldn't have to bother with creating a variable number of InputText measures. If needed, the number of symbols that were entered can easily be found by replacing "symbol|" with "+1" in a String measure based on that list (you'd have to add an ending | to it for consistency), then having a Calc measure computing the result of that string Formula.
The beauty is, that all of the functionality to automatically generate all measures/meters for a user-defined number of stocks based on a template.inc and a lua script is already implemented in Mordasius' skins! Adapting this to using the above described new "one-for-all" webparser call is probably possible. However, Mordasius seems to prefer outsourcing even more to lua, if I understand his reply correctly?

Proposal: Shall we close this issue and continue the discussion in the official thread for Mordasius' financial skins?
User avatar
Yincognito
Rainmeter Sage
Posts: 7175
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: WebParser for https://www.wallstreet-online.de/

Post by Yincognito »

emp00 wrote: January 29th, 2024, 8:15 pm The beauty is, that all of the functionality to automatically generate all measures/meters for a user-defined number of stocks based on a template.inc and a lua script is already implemented in Mordasius' skins! Adapting this to using the above described new "one-for-all" webparser call is probably possible. However, Mordasius seems to prefer outsourcing even more to lua, if I understand his reply correctly?

Proposal: Shall we close this issue and continue the discussion in the official thread for Mordasius' financial skins?
Ah, I see - didn't know that. For sure that if his skin(s) already have the foundation built in Lua, it makes perfect sense to continue on that path and use the existing automated structure built there. Obviously the details on such a potential implementation belong more to the thread on his skin, so from my point of view I have no problem with you two continuing the discussion there - I'll keep an eye on the thread anyway, if by any chance I can help with something in that regard. :thumbup:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Mordasius
Posts: 1173
Joined: January 22nd, 2011, 4:23 pm
Location: GMT +8

Re: WebParser for https://www.wallstreet-online.de/

Post by Mordasius »

emp00 wrote: January 29th, 2024, 8:15 pm Proposal: Shall we close this issue and continue the discussion in the official thread for Mordasius' financial skins?
Having started the discussion on reading stocks/shares info from an xml file here I think it would best to continue it here.

As I understand it you want to modify the MyPortfolio skin to read stock prices using something like https://quote.cnbc.com/quote-html-webservice/quote.htm?partnerId=2&requestMethod=quick&exthrs=1&noform=1&fund=1&"output=jsonp&symbols=.SPX|.IXIC|.FTSE|.N225|.HSI|.SSEC|.VIX|.GDAXI|US10Y|US30Y|US5Y|US2Y|US3M|DE10Y-DE|JP10Y-JP|%40CL.1|%40NG.1|%40GC.1|%40SI.1|%40W.1|%40HG.1|JPYUSD%3D|.DXY|JPY%3D|GBP%3D|EUR%3D|USDCAD|AUD%3D|.RUT|.GSPTSE&callback=quoteHandl
to get all the stock info with a single webparser measure and then display it in the same way that the prices along with losses/gains are presented in the MyPortfolio skin. If that is all you want to do then you certainly don't need to use lua. You can simply modify the [InfoIndexXX] measures to get the appropriate strings from the single parent webparser measure.

You can use Yincognito's sample skin to get the ball rolling
Yincognito wrote: January 28th, 2024, 10:29 pm Just for fun, to help you both (the regex is not that hard to handle, see the Item and the Lookahead Assertion parts here), my own bonus - a very basic sample that can be built upon...
Financial_1.0.0.rmskin
Details in the comments. Change the symbols variable to get other data. Keep the update related options unchanged if by any chance you think of doing animations in the skin (only change the Update variable if you need a lower update in the skin, the WebParsers update frequency won't be affected). Add similar corresponding measures / meters to retrieve the value of other fields from the interrogated .xml result.
I'm off for a long lunch now and may, or may not, be able to give you a template when I get back - depends on the type and volume of liquid refreshment involved.
emp00
Posts: 83
Joined: October 7th, 2022, 8:08 pm

Re: WebParser for https://www.wallstreet-online.de/

Post by emp00 »

Mordasius wrote: January 30th, 2024, 2:53 am As I understand it you want to modify the MyPortfolio skin to read stock prices using something like https://quote.cnbc.com/quote-html-webservice/quote.htm?[i]XXXXXX (see above)[/i] to get all the stock info with a single webparser measure and then display it in the same way that the prices along with losses/gains are presented in the MyPortfolio skin. If that is all you want to do then you certainly don't need to use lua. You can simply modify the [InfoIndexXX] measures to get the appropriate strings from the single parent webparser measure. You can use Yincognito's sample skin to get the ball rolling.
This is exactly my plan. I have checked out Yincognito's demo script and I understand how it works. Thanks Yincognito!!

What I still need is a method to generate the initiating Webparser-call based on the the variables defined in StockSymbols.inc. Currently I think this needs to be integrated into the MakeMeterMeasures.lua script, but maybe I'm wrong? See below how my stock variables are currently defined -> somehow the Label-X variables need to be concatenated in a loop running over all 6 activated stocks. Can this be done without lua? Every time the NumberOfStocks variable is changed, the initiating call url needs to be rebuilt and therefore I guess it's a task for the lua script which already does walk through all activated stocks and builds the ^1^ meters via the MetMeaTemplate.inc. I understand how this all works, only the initiating call gives me headaches currently.

PS: I'm starting with the MarketPrices skin -> MyPortfolio will be modified thereafter. Cheers Mordasius!! :thumbup:

Code: Select all

NumberOfStocks=6

Label-1="S&P 500"
Symbol1=.SPX

Label-2="NASDAQ"
Symbol2=.IXIC
...
User avatar
Mordasius
Posts: 1173
Joined: January 22nd, 2011, 4:23 pm
Location: GMT +8

Re: WebParser for https://www.wallstreet-online.de/

Post by Mordasius »

Okay I've had a good lunch with more than a few glasses of fine wine. So my question now is exactly what is the problem or issue you are having with the MarketPrices or MyPortfolio skins?

I should perhaps say that I'm a great believer in the old adage of "It it ain't broke don't try and fix it"
emp00
Posts: 83
Joined: October 7th, 2022, 8:08 pm

Re: WebParser for https://www.wallstreet-online.de/

Post by emp00 »

See above in the paragraph "What I still need is ..." - nothing more, nothing less.
User avatar
Yincognito
Rainmeter Sage
Posts: 7175
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: WebParser for https://www.wallstreet-online.de/

Post by Yincognito »

emp00 wrote: January 30th, 2024, 3:41 pmWhat I still need is a method to generate the initiating Webparser-call based on the the variables defined in StockSymbols.inc.
I don't believe you absolutely need Lua for what you described, even if it's about Mordasius' skin(s). A simple:

Code: Select all

[StockList]
Measure=String
String=#Symbol1#|#Symbol2#|#Symbol3#|#Symbol4#|#Symbol5#|#Symbol6#|#Symbol7#|#Symbol8#|#Symbol9#|#Symbol10#|#Symbol11#|#Symbol12#|#Symbol13#|#Symbol14#|#Symbol15#|#Symbol16#|#Symbol17#|#Symbol18#|#Symbol19#|#Symbol20#|#Symbol21#|#Symbol22#|#Symbol23#|#Symbol24#|#Symbol25#|#Symbol26#|#Symbol27#|#Symbol28#|#Symbol29#|#Symbol30#|
RegExpSubstitute=1
Substitute="(?siU)^((?:.*\|){#NumberOfStocks#}).*$":"\1","^\\1$":"","#(?:Symbol\d+)#\|":"","\|$":""
DynamicVariables=1
before the main WebParser will concatenate all #SymbolN# variables using the | separator suited for the CNBC query syntax in the String option, then in the regx Substitute will keep only the first #NumberOfStocks# parts, delete any invalid 0 stocks results, delete any #SymbolN#| part corresponding to a #SymbolN# variable that doesn't exist or isn't defined, and finally delete the ending | sign. All the deleting steps above are optional, just to cover all possibilities. You can then use the value of this measure in the following multi-symbol WebParser by referencing it as [&StockList] in the query from its URL option, assuming the WebParser has DynamicVariables=1 set on it.

As for the template and the ^1^ sections, I don't think it matters what's in them, the script will build things up automatically regardless, according to the ^1^ index markers. Not sure if the Label-X need concatenation since they're just labels used according to their ^1^ index and don't play any part in setting up the URL query / address. Obviously, for the whole thing to work I guess you'd have to follow Mordasius' advice and:
Mordasius wrote: January 30th, 2024, 2:53 amYou can simply modify the [InfoIndexXX] measures to get the appropriate strings from the single parent webparser measure.

emp00 wrote: January 30th, 2024, 3:41 pmThanks Yincognito!!
You're welcome! ;-)
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
emp00
Posts: 83
Joined: October 7th, 2022, 8:08 pm

Re: WebParser for https://www.wallstreet-online.de/

Post by emp00 »

Triple^3 thank You Yincognito !

I understand your description and I appreciate the straightforward concatenation approach incl. error-handling in one magic String measure (I would never have been able to do this one) thereby getting around an update of the lua script (I have zero experience with this language). With this and Mordasius' hints I currently feel confident to actually implement the task at hand.

Tomorrow I need to start working early, so hopefully in 24h from now I have time to get this rolling. Thanks guys!! :17drums

Edit: I couldn't resist -> Step1 = Yincognito's String concatenation measure already works perfectly "out of the box". Now I "only" need to adjust the meters as per your magic Financial_1.0.0.rmskin -> e.g. [name1] adressing the first stock symbol via StringIndex=1 and the other [nameX] measures I will adjust/integrate in MetMeaTemplate.inc using i.a. StringIndex=^1^ to build the required number of meters with Mordasius' existing script, I have understood how this template works and how it plays together with MarketPrices.ini --> So, I think tomorrow I can finish the job! Thanks to your kind and cooperative help. :rosegift:
User avatar
Yincognito
Rainmeter Sage
Posts: 7175
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: WebParser for https://www.wallstreet-online.de/

Post by Yincognito »

emp00 wrote: January 30th, 2024, 8:18 pm Triple^3 thank You Yincognito !

I understand your description and I appreciate the straightforward concatenation approach incl. error-handling in one magic String measure (I would never have been able to do this one) thereby getting around an update of the lua script (I have zero experience with this language). With this and Mordasius' hints I currently feel confident to actually implement the task at hand.

Tomorrow I need to start working early, so hopefully in 24h from now I have time to get this rolling. Thanks guys!! :17drums

Edit: I couldn't resist -> Step1 = Yincognito's String concatenation measure already works perfectly "out of the box". Now I "only" need to adjust the meters as per your magic Financial_1.0.0.rmskin -> e.g. [name1] adressing the first stock symbol via StringIndex=1 and the other [nameX] measures I will adjust/integrate in MetMeaTemplate.inc using i.a. StringIndex=^1^ to build the required number of meters with Mordasius' existing script, I have understood how this template works and how it plays together with MarketPrices.ini --> So, I think tomorrow I can finish the job! Thanks to your kind and cooperative help. :rosegift:
Exactly - you got the idea! :thumbup:

Coincidentally, I couldn't resist either... :oops:
MarketPrices_300124.rmskin
MarketPrices.jpg
Didn't change any section name, only some measure contents where needed, so things matched up seamlessly and this could be released by Mordasius as it is, if he wants to (the author and the version are along the same lines as in his original skin). You can either verify your work by checking it or install it directly.
You do not have the required permissions to view the files attached to this post.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Mordasius
Posts: 1173
Joined: January 22nd, 2011, 4:23 pm
Location: GMT +8

Re: WebParser for https://www.wallstreet-online.de/

Post by Mordasius »

Yincognito wrote: January 30th, 2024, 10:28 pm Coincidentally, I couldn't resist either... :oops:
MarketPrices_300124.rmskin
Many, many Thanks for this Yincognito :thumbup:

I would never have been able to come up with that [Symbols] measure to not only combine all the symbols but also delete all the unused ones with a single Substitute.

Code: Select all

[Symbols]
Measure=String
String=#Symbol1#|#Symbol2#|#Symbol3#|#Symbol4#|#Symbol5#|#Symbol6#|#Symbol7#|#Symbol8#|#Symbol9#|#Symbol10#|#Symbol11#|#Symbol12#|#Symbol13#|#Symbol14#|#Symbol15#|#Symbol16#|#Symbol17#|#Symbol18#|#Symbol19#|#Symbol20#|#Symbol21#|#Symbol22#|#Symbol23#|#Symbol24#|#Symbol25#|#Symbol26#|#Symbol27#|#Symbol28#|#Symbol29#|#Symbol30#|
RegExpSubstitute=1
Substitute="(?siU)^((?:.*\|){#NumberOfStocks#}).*$":"\1","^\\1$":"","#(?:Symbol\d+)#\|":"","\|$":""
The joy in your additions is that I can now play around with the skin displaying info from thirty or more stocks/indexes by downloading a single file and switching to URL=file://#@#Stocks.xml Again Many Thanks

I've already updated the MarketPrices skin on DA and will be updating the MyPortfolio skin as soon as I've incorporated a few more updates.