It is currently April 19th, 2024, 11:28 am

Stock Quotes

Get help with creating, editing & fixing problems with skins
dick.fickling
Posts: 5
Joined: May 31st, 2009, 10:04 am

Stock Quotes

Post by dick.fickling »

I'm writing a stock quote ticker (http://www.customize.org/rainmeter/skins/63542), but I keep running into problems with the page, seemingly randomly, not finishing when WebParser loads it.

The log says "Fetching URL" and that's fine, but never shows "Finished URL" and after a while the error "WebParser (792) Unknown error: 12002" appears.

My best guess is that marketwatch.com (where I'm getting quotes from) stops taking connections after a certain number per hour. I've also tried quote.com. Both work for about twenty minutes of testing, but then just stop. This would be fine if the product was finished and only needed to update thrice an hour to keep the stock price up-to-date, but when I'm refreshing every few minutes because of changes, it keeps dying.

Any ideas are greatly appreciated.

- Dick

EDIT:
I'm not sure if I've solved the problem, but it seems that sometimes just restarting rainmeter works. Anyway, I've now got a new problem. If you check out the most recent upload's code, you'll see that it displays the value change for the day as either a + or - in the same location using two different regexp searches; for tickerup and tickerdown in the page source. Logically, this should work, as there is little reason for the change to be both positive and negative in a given day. But overnight or over the weekend, when the after-hours trading causes the price to go up but it had gone down the day before or vice-versa, we get a problem because it finds both tickerup and tickerdown and displays them both, on top of each other.
I'm not sure if any of that makes sense to anyone who hasn't actually written this skin, but maybe it will. If it does, give me some suggestions. If not, let me know what I can clear up.
User avatar
GhostMatrix
Rainmeter Sage
Posts: 141
Joined: April 18th, 2009, 8:26 pm
Location: Montreal, Quebec, Canada 45.5658°N, 73.5898°W UTC -5

Re: Stock Quotes

Post by GhostMatrix »

@ dick.fickling

Hi and :welcome: to this community !

The thing that I can do is to provide you a new Code for your Quote Skin (Rainy Droplet) :P

I have made a default code for CISCO SYS INC at http://www.quote.com/us/stocks/quote.action?s=CSCO

I retrieve every each 20 minutes with only one Measure the following information:

(Index 1) 1 ~ useful to know if the website page is available!

(Index 5) May 31, 2009 2:07:29 PM EDT

(Index 8) CISCO SYS INC (CSCO)

(Index 11) Last Trade

(Index 13) 18.50

(Index 17) Volume

(Index 19) 61,034,747

(Index 22) Change

(Index 24) -0.01

(Index 28) Shares

(Index 30) 5.84B

(Index 32) Change %

(Index 34) -0.05

(Index 37) Today's High

(Index 39) 18.60

(Index 42) Today's Low

(Index 44) 18.09


I will do some monitoring on the skin but I don't anticipate any issue.

Stay tuned ! .....

GM
If at first you don't succeed; call it version 0.1

Image
dick.fickling
Posts: 5
Joined: May 31st, 2009, 10:04 am

Re: Stock Quotes

Post by dick.fickling »

Thanks for the help.
How do you get to indexes past the first three? Could you just post the code I'm meant to use?
Currently my code looks like this:

[InfoStock1]
Measure=Plugin
Plugin=Plugins\WebParser.dll
URL=#Quote1#
StringIndex=2
UpdateRate=#update.Spd#
Debug=1

With Quote1 = http://www.quote.com/us/stocks/quote.action?s=CSCO
I'm not really sure how to use, say, StringIndex=13 because it says not enough substrings.
User avatar
GhostMatrix
Rainmeter Sage
Posts: 141
Joined: April 18th, 2009, 8:26 pm
Location: Montreal, Quebec, Canada 45.5658°N, 73.5898°W UTC -5

Re: Stock Quotes

Post by GhostMatrix »

@ dick.fickling

Sorry for the time delay...

After that I have added the 3 other quote symbols, I stumble on the same negative & positive value issue that you have explained previously, but I didn't understand it the first time because my native language is French!
But I just finish to convert this issue to a feature ...

just go here to download ... :roll:
http://forum.rainmeter.net/viewtopic.php?f=15&t=317

GM
If at first you don't succeed; call it version 0.1

Image
dick.fickling
Posts: 5
Joined: May 31st, 2009, 10:04 am

Re: Stock Quotes

Post by dick.fickling »

I've updated mine because I don't need something as full-featured as yours, but (I hope you don't mind) I used your regexp to rewrite it. Now my question is, can I change the colour of the font on the basis of the string it is applied to? For example, where it shows the change or change%, it is either a negative or a positive number. Can I change the colour to red or green, depending? A simple If, else statement would be my normal approach, but as you can see, that's not fully possible.

Thanks for all your help!
- Dick
User avatar
GhostMatrix
Rainmeter Sage
Posts: 141
Joined: April 18th, 2009, 8:26 pm
Location: Montreal, Quebec, Canada 45.5658°N, 73.5898°W UTC -5

Re: Stock Quotes

Post by GhostMatrix »

@ dick.fickling
I've updated mine because I don't need something as full-featured as yours, but (I hope you don't mind) I used your regexp to rewrite it.
That why I'm making those default Rainy Droplets, It's the Main purpose of them, for allowing peoples to take what they need for their own skin! :roll:

For your question the answer is "yes" it's possible ...

Image


To re-create what you see in the screenshot on the default Droplet ...

Add this in the [Variables] section

ColorRed=255, 0, 0, 200
ColorGreen=0, 193, 19, 200


Add this on the [MeasureStock_8]

IfEqualValue=0
IfEqualAction=!execute [!RainmeterHideMeter LabelStock6_/-][!RainmeterHideMeter LabelStock6_/+][!RainmeterShowMeter LabelStock6_/0]
IfAboveValue=0
IfAboveAction=!execute [!RainmeterHideMeter LabelStock6_/0][!RainmeterHideMeter LabelStock6_/-][!RainmeterShowMeter LabelStock6_/+]
IfBelowValue=0
IfBelowAction=!execute [!RainmeterHideMeter LabelStock6_/0][!RainmeterHideMeter LabelStock6_/+][!RainmeterShowMeter LabelStock6_/-]

And this on the [MeasureStock2_8]

IfEqualValue=0
IfEqualAction=!execute [!RainmeterHideMeter LabelStock6_2/-][!RainmeterHideMeter LabelStock6_2/+][!RainmeterShowMeter LabelStock6_2/0]
IfAboveValue=0
IfAboveAction=!execute [!RainmeterHideMeter LabelStock6_2/0][!RainmeterHideMeter LabelStock6_2/-][!RainmeterShowMeter LabelStock6_2/+]
IfBelowValue=0
IfBelowAction=!execute [!RainmeterHideMeter LabelStock6_2/0][!RainmeterHideMeter LabelStock6_2/+][!RainmeterShowMeter LabelStock6_2/-]


Delete the Meter [LabelStock6] and replace it by those following Meters

[LabelStock6_/0]
MeasureName=MeasureStock_7
MeasureName2=MeasureStock_8
Meter=STRING
X=0r
y=20r
StringStyle=NORMAL
StringAlign=LEFT
FontColor=#Color#
FontSize=#FontHeight#
FontFace=#FontName#
Text="%1: %2"
Antialias=1

[LabelStock6_/-]
MeasureName=MeasureStock_7
MeasureName2=MeasureStock_8
Meter=STRING
X=0r
y=0r
StringStyle=NORMAL
StringAlign=LEFT
FontColor=#ColorRed#
FontSize=#FontHeight#
FontFace=#FontName#
Text="%1: %2"
Antialias=1
Hidden=1

[LabelStock6_/+]
MeasureName=MeasureStock_7
MeasureName2=MeasureStock_8
Meter=STRING
X=0r
y=0r
StringStyle=NORMAL
StringAlign=LEFT
FontColor=#ColorGreen#
FontSize=#FontHeight#
FontFace=#FontName#
Text="%1: %2"
Antialias=1
Hidden=1

Delete the Meter [LabelStock6_2] and replace it by those following Meters

[LabelStock6_2/0]
MeasureName=MeasureStock2_7
MeasureName2=MeasureStock2_8
Meter=STRING
X=0r
y=20r
StringStyle=NORMAL
StringAlign=LEFT
FontColor=#Color#
FontSize=#FontHeight#
FontFace=#FontName#
Text="%1: %2"
Antialias=1

[LabelStock6_2/-]
MeasureName=MeasureStock_7
MeasureName2=MeasureStock_8
Meter=STRING
X=0r
y=0r
StringStyle=NORMAL
StringAlign=LEFT
FontColor=#ColorRed#
FontSize=#FontHeight#
FontFace=#FontName#
Text="%1: %2"
Antialias=1
Hidden=1

[LabelStock6_2/+]
MeasureName=MeasureStock_7
MeasureName2=MeasureStock_8
Meter=STRING
X=0r
y=0r
StringStyle=NORMAL
StringAlign=LEFT
FontColor=#ColorGreen#
FontSize=#FontHeight#
FontFace=#FontName#
Text="%1: %2"
Antialias=1
Hidden=1

Now ...
On the 0 value you will have the default white color text
On negative values you will have the red color text showing
On positive value you will have the green color text showing

;)
GM
If at first you don't succeed; call it version 0.1

Image
ksurfboy222
Posts: 1
Joined: August 13th, 2009, 8:19 am

Re: Stock Quotes

Post by ksurfboy222 »

could you possibly upload the code you used for that? many thanks.
rtaylor
Posts: 1
Joined: July 7th, 2010, 4:37 am

Re: Stock Quotes

Post by rtaylor »

I want to be able to start displaying stock quotes for local companies on my site. I tried a few various tricks published around the net, but none of them worked. And I haven't seen any modules available for this. any ideas?

My idea is just a simple right-side block or module that would show stock information on various companies. From there, it could go to yahoo finance for all I care.

_________________________
Stay In Touch - AFG stock quotes
User avatar
Alex2539
Rainmeter Sage
Posts: 642
Joined: July 19th, 2009, 5:59 am
Location: Montreal, QC, Canada

Re: Stock Quotes

Post by Alex2539 »

Rainmeter is an application for displaying information on your desktop, not on a website. You are looking in the wrong place.
ImageImageImageImage
ElideN
Posts: 4
Joined: December 11th, 2010, 7:38 am

Re: Stock Quotes

Post by ElideN »