It is currently April 27th, 2024, 1:17 pm

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

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

Post by emp00 »

Dear Team,

Wallstreet-online is a financial portal, well known in Germany. I have registered as a free user and created a portfolio. Now I would like to read out the portfolio page (accessible via a specific url) with Rainmenter using a WebParser measure. I read the docs and I know WebParser only works with HTTP AUTH. There's no information on the site if this is supported, I simply tested it with my correct username/password (urlencoded):

URL=https://USERNANE:PASSWORD@www.wallstreet-online.de/portfolio

It returns the front page in WebParserDump.txt but I'm not logged in - just the regular homepage is returned. So obviously, HTTP AUTH is not supported, which is also not surprising since it's rather old technology. When using my browser I just need to login once and then it just works for already more than 1 month without re-login (in the browser). Probably it's a session cookie saving the login credentials, but I don't know for sure.

Now the obvious question: Does anybody know a "cheap trick" to access this website logged-in via Rainmeter in order to RegEX and display selected portfolio data in a skin/meter? Thanks for suggestions!

It must be possible with Rainmeter the swiss knife for all custom skinning jobs (my last words?) ;-)

PS: Yes, I already know the My Portfolio skin, but it polls financial market prices from cnbc.com - I don't want to poll 15 separate stocks from this site and therefore would like to use wallstreet-online which does the portfolio calculation under the hood so that I just need to poll 1 page with the full data I need...
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 27th, 2024, 9:55 pm PS: Yes, I already know the My Portfolio skin, but it polls financial market prices from cnbc.com -
That MyPortfolio skin was retired some time ago. The most recent version can be found here:-> https://www.deviantart.com/mordasius/art/MyPortfolio-Rainmeter-skin-887967381
emp00
Posts: 83
Joined: October 7th, 2022, 8:08 pm

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

Post by emp00 »

Mordasius wrote: January 28th, 2024, 2:41 am That MyPortfolio skin was retired some time ago. The most recent version can be found here:-> https://www.deviantart.com/mordasius/art/MyPortfolio-Rainmeter-skin-887967381
Got it - actually, I would be very willing to use your MyPortfolio skin, but I got scared due to our discussions around the Market Prices meter last week. You and two other users mentioned repeatedly: "I've had my IP banned in the past when repeatedly making quick changes and then refreshing the skin. To avoid getting blocked I used a dummy skin ...". That's why I made up my mind to rather use another webservice which already does the portfolio calculations server-side so that I don't need to poll every single stock value one-by-one from cnbc.com. My idea was to use one Webparser call on the calculated portfolio table from wallstreet-online.de, but it requires login/authentification which Rainmeter seems to struggling with, see above.

Facts are: I already have the Market Prices skin running with 6 stocks (polled every 10mins) and would like to use MyPortfolio with another 15 stocks. That totals 21 stocks to be polled from cnbc.com every 10 mins. Those 21 calls are executed one-after-another as per design and due to your warnings I was 100% sure this would get my IP banned right away... I mean for real-life parallel usage of your two skins both with UpdateRate=600, not for frequent refreshing/testing.
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 28th, 2024, 11:41 am Got it - actually, I would be very willing to use your MyPortfolio skin, but I got scared due to our discussions around the Market Prices meter last week. You and two other users mentioned repeatedly: "I've had my IP banned in the past when repeatedly making quick changes and then refreshing the skin. To avoid getting blocked I used a dummy skin ...". That's why I made up my mind to rather use another webservice which already does the portfolio calculations server-side so that I don't need to poll every single stock value one-by-one from cnbc.com. My idea was to use one Webparser call on the calculated portfolio table from wallstreet-online.de, but it requires login/authentification which Rainmeter seems to struggling with, see above.

Facts are: I already have the Market Prices skin running with 6 stocks (polled every 10mins) and would like to use MyPortfolio with another 15 stocks. That totals 21 stocks to be polled from cnbc.com every 10 mins. Those 21 calls are executed one-after-another as per design and due to your warnings I was 100% sure this would get my IP banned right away... I mean for real-life parallel usage of your two skins both with UpdateRate=600, not for frequent refreshing/testing.
Some quick general observations (I'm on my phone right now, so can't test yet):
- if the manual says that HTTP Authentication is supported by Rainmeter, then most likely it's the site that doesn't support it
- if cnbc.com can display more than one stock at a time, then most likely you can grab multiple stocks at a time from it with Rainmeter
- sometimes investigating the site page with Developer Tools / Inspect / Network tab can reveal the true address the site itself takes the data from, and if it uses an URL query / API in the background there might be a way to select the desired stocks to grab directly in one go, just by manipulating the query's parameters; similarly, looking for other attempts on GitHub can reveal the same, e.g. (that address, once concatenated, does produce results in the specified format, test it in the browser and you'll see):
https://github.com/madnight/cnbc-market/blob/master/index.js
- if the data updating interval on cnbc.com is large enough, you could wait for a bit before querying the next item in the skin, via UpdateDivider and other techniques (assuming the site allows the amount of polling per day that you need, of course), thus avoiding high frequency polling that might get you blocked or banned; alternatively, you could display and query just one stock at a time on demand, via some click or scroll triggering, if you don't absolutely need all 21 stocks displayed at once in the skin
- there might be other sites that can provide what you're looking for in a still free and feasible fashion, so if you find another 20 of them, problem solved (I know, a bit far fetched, but just saying)

There might be other possible considerations to be mentioned here, but although a bit difficult in this area since typically money information costs money, you might find a reasonable way to get the desired data, preferably in one go, or in separate attempts at either reasonable intervals or from different sites. Obviously, care should be taken in the testing phase to not abuse polling in the skin - because otherwise, testing things directly in the browser shouldn't produce any drawbacks (you can save the page source from the browser too, then use the resulted local file to polish your regex or whatever other details without worrying about being banned).
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 »

Yincognito wrote: January 28th, 2024, 1:15 pm - if cnbc.com can display more than one stock at a time, then most likely you can grab multiple stocks at a time from it with Rainmeter
- sometimes investigating the site page with Developer Tools / Inspect / Network tab can reveal the true address the site itself takes the data from, and if it uses an URL query / API in the background there might be a way to select the desired stocks to grab directly in one go, just by manipulating the query's parameters; similarly, looking for other attempts on GitHub can reveal the same, e.g. (that address, once concatenated, does produce results in the specified format, test it in the browser and you'll see):
https://github.com/madnight/cnbc-market/blob/master/index.js
Thank you @Yincognito, this is an excellent idea!

Mordasius' skins (Market Prices, MyPortfolio and Currency Markets) all rely on cnbc.com and they all pull each stock data separately, via this Webparser url, here for the symbol .FTSE:
https://www.cnbc.com/quotes/.FTSE

I can confirm this url gives the same data, only in xml format - nicely structured and no overhead like headlines/scripts/ads/images etcpp.
https://quote.cnbc.com/quote-html-webservice/quote.htm?partnerId=2&requestMethod=quick&exthrs=1&noform=1&fund=1&%22output=jsonp&symbols=.FTSE&callback=quoteHandler1

And now the best part - it's 100% true, that via this url call you can query multiple stocks at once!
1.) here: NIKKEI and FTSE
https://quote.cnbc.com/quote-html-webservice/quote.htm?partnerId=2&requestMethod=quick&exthrs=1&noform=1&fund=1&%22output=jsonp&symbols=.FTSE%7C.N225%7C&callback=quoteHandler1

2.) here: Query of total 30 SYMBOLS, taken from the github example:
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=quoteHandler1

So, absolutely - with this method we can grab all our stock data for at least 30, possibly even more (but if you need even more, I guess you don't use Rainmenter any more) with just one single query! The server reply is super-fast, super-efficient and (hopefully) this removes our issue of potentially getting IP banned via multiple sequential Webparser queries!

I will have a closer look, I think the main "ToDo" is to write a measure which concatenates all symbols for the single query - and then adapt the REGEX measures to grab our data points per stock. This would be a great improvement for Mordasius' skins! Does anybody see a roadblock, shall we follow this or not? Of course we'd rely on the availability of the special query url - but the same holds true for the current method of using the website query... Any thoughts?
Last edited by emp00 on January 28th, 2024, 4:10 pm, edited 3 times in total.
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 28th, 2024, 2:15 pm Thank you @Yincognito, this is an excellent idea!

Mordasius' skins (Market Prices, MyPortfolio and Currency Markets all rely on cnbc.com and they all pull each stock data separately, via this Webparser url, here for the symbol .FTSE:
https://www.cnbc.com/quotes/.FTSE

I can confirm this url gives the same data, only in xml format - nicely structured and no overhead like headlines/images etcpp.
https://quote.cnbc.com/quote-html-webservice/quote.htm?partnerId=2&requestMethod=quick&exthrs=1&noform=1&fund=1&%22output=jsonp&symbols=.FTSE&callback=quoteHandler1

And now the best part - it's 100% true, that via this url call you can query multiple stocks at once!
- here: NIKKEI and FTSE
https://quote.cnbc.com/quote-html-webservice/quote.htm?partnerId=2&requestMethod=quick&exthrs=1&noform=1&fund=1&%22output=jsonp&symbols=.FTSE%7C.N225%7C&callback=quoteHandler1

- here: Query of total 30 SYMBOLS, taken from the github example:
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=quoteHandler1

So, absolutely - with this method we can grab all our stock data for at least 30, possibly even more (but if you need even more, I guess you don't use Rainmenter any more) with just one single query! The server reply is super-fast, super-efficient and (hopefully) this removes our issue of potentially getting IP banned via multiple sequential Webparser queries!

I will have a closer look, I think the main "ToDo" is to write a measure which concatenates all symbols for the single query - and then adapt the REGEX measures to grab our data points per stock. This would be a great improvement for Mordasius' skins! Does anybody see a roadblock, shall we follow this or not? Of course we'd rely on the availability of the special query url - but the same holds true for the current method of using the website query... Any thoughts?
Yep, one can build the value of the URL option easily using variables and such, that can again be easily defined by any user either manually before refreshing or if a structure to set them exists in the skin or its configuration counterpart if built (e.g. InputText measures and such).

This is not my skin so I can't tell Mordasius what to do, but I'm sure he's perfectly capable (and probably willing as well, since it would enhance his skin capabilities and ease on the site polling if done) of adjusting his skin to take advantage of the multi-querying possibility. I guess we'll have to wait for him to react on this.

Obviously, if you're in a hurry or he eventually doesn't feel like putting more work than he already did into this, you could try and do it yourself. I'd wait for his reaction on it though, maybe he'll be interested in tackling this. ;-)
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 »

Agreed, let's wait for Mordasius' reaction - he can judge best if this solution has no downsides we might have missed.

As a bonus: I found this Rainmeter XML parser plugin from e2e8 at github. I believe this would make life even easier for grabbing our stock data from the cnbc.com xml feed (easier compared to REGEX). Only this plugin is 5 years old, not sure if it still works with the current Rainmeter release? Just an idea!
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 28th, 2024, 4:23 pm Agreed, let's wait for Mordasius' reaction - he can judge best if this solution has no downsides we might have missed.

As a bonus: I found this Rainmeter XML parser plugin from e2e8 at github. I believe this would make life even easier for grabbing our stock data from the cnbc.com xml feed (easier compared to REGEX). Only this plugin is 5 years old, not sure if it still works with the current Rainmeter release? Just an idea!
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.
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 »

emp00 wrote: January 28th, 2024, 2:15 pm 2.) here: Query of total 30 SYMBOLS, taken from the github example:
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=quoteHandler1

So, absolutely - with this method we can grab all our stock data for at least 30, possibly even more (but if you need even more, I guess you don't use Rainmenter any more) with just one single query!
That query example from github is certainly quite a find and offers a convenient way of getting all the strings you need for multiple stocks/indexes at one time. Yincognito's Financial_1.0.0.rmskin skin above shows how straightforward it could be.
emp00 wrote: January 28th, 2024, 2:15 pm I think the main "ToDo" is to write a measure which concatenates all symbols for the single query - and then adapt the REGEX measures to grab our data points per stock.
Yes you'll certainly need to start there and if I were doing it I'd be tempted to use a lua script to combine all the symbols in a single string which I suspect will make it easier to accommodate varying numbers of stock/index being tracked.

Having started with lua I'd then read the entire .xml file into a script and use a lua function to replace all the calc measures giving the current value of each investment and the change in value since it was purchased.

And then while all the numbers/strings are already in a lua Table why not use string.format in lua to output the strings/values for each stock with a mix of left, right and/or center justification. Along the lines of this example in the Tips & Tricks Thread.

It would probably be quite fun to try things that way, particularly trying to incorporate some Inline Options to set different colours for the values of each stock/index.

Having said that and slightly whetted my appetite I must admit that my first priority for upgrading the MarketPrices and MyPortfolio skins would be to add a front end using InputText to make it easier to add or change the stock names and symbols.

I had both skins running with thirty-six stocks/indexes when I was adding the variable number of stocks/indexes in 2021 and never had any problems with the standard update rate (every ten minutes). My worry is those users who want to use MarketPrices for day trading or the like and want it to show info in "real time" by setting UpdateQuotes=1. Despite my warnings I expect some tried playing around with UpdateQuotes and expect they were likely to have found WebParser falling over itself with errors trying to update before it had finished the previous call.
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 »

Mordasius wrote: January 29th, 2024, 8:04 am My worry is those users who want to use MarketPrices for day trading or the like and want it to show info in "real time" by setting UpdateQuotes=1. Despite my warnings I expect some tried playing around with UpdateQuotes and expect they were likely to have found WebParser falling over itself with errors trying to update before it had finished the previous call.
Yep, that's always a problem - some users really have a bit exaggerated expectations from updating online data, and it goes for the weather one as well. Not sure if I understood this correctly, but right at the bottom of the cnbc site it says that data (retrieval?) is "delayed for at least 15 minutes", so, just like for weather, it's quite likely that it wouldn't make sense to update stuff more frequently than that... :???:

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.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth