User avatar
mosleyh
Intermediate
Intermediate
Posts: 414
Joined: Tue Jul 12, 2005 12:55 pm
Location: Charlotte, NC
Contact: Send private message

rotating stock quotes

Sat Dec 23, 2006 4:52 pm

I've come up with a way to put rotating stock quotes on my home screen. The method is based on one I've used to get rotating headlines, which appear just above "Stocks of Interest" on my home screen, below. It basically goes through the stocks that you have set up in MLStockInfo and displays them one at a time in round-robin order. I find it more convenient that a stocks page, and since AirPanel 110s have limited screen space to play with, it helps there too.

Due to the fact that the MLStockinfo_value_xxx variable is share price x number of shares, to make this work as a "ticker", number of shares must be set to 1 for all.

That said, if anyone is interested, I'll document the process and post it.
Attachments
home screen.jpg
home screen.jpg (132.18 KiB) Viewed 3306 times

kirkfrey
Expert
Expert
Posts: 759
Joined: Wed Jan 12, 2005 10:55 am
Contact: Send private message

Tue Dec 26, 2006 6:52 pm

I'd be interested.
Kirk

Just trying to figure it out...

mbluhm
Newbie
Newbie
Posts: 18
Joined: Thu Feb 06, 2003 5:44 pm
Location: Cottage Grove, MN
Contact: Send private message

Tue Dec 26, 2006 7:35 pm

I'd be interested as well.

User avatar
cborod
Is there life beyond myServer?
Is there life beyond myServer?
Posts: 1212
Joined: Fri Oct 07, 2005 6:26 pm
Location: Mount Gretna, PA
Contact: Send private message

Tue Dec 26, 2006 9:44 pm

loved the headlines stuff you did! This has to be cool!
ChrisB


___________________________________
"Round up the usual suspects."

User avatar
mosleyh
Intermediate
Intermediate
Posts: 414
Joined: Tue Jul 12, 2005 12:55 pm
Location: Charlotte, NC
Contact: Send private message

Tue Dec 26, 2006 10:52 pm

Look for it this weekend. . .

ccharmatz
Intermediate
Intermediate
Posts: 344
Joined: Wed Oct 15, 2003 1:51 pm
Location: Clearwater Florida
Contact: Send private message

Wed Dec 27, 2006 11:52 pm

Looking forwards to it. Thank you.

cc-

User avatar
mosleyh
Intermediate
Intermediate
Posts: 414
Joined: Tue Jul 12, 2005 12:55 pm
Location: Charlotte, NC
Contact: Send private message

Fri Dec 29, 2006 11:38 pm

As promised, here's how to do it (the fine print explains the macros in case anyone's interested):


Requires MLStockInfo 3.0.218 or later (Available from Cinemar) and wscVBSEvaluate (Available on bhiga's website here: http://www.tygatech.com/mainlobby/) remember to enable WSC plugins in your MLS options


Instructions for creating cycling stock quotes:

1. Set up your stocks in MLStockInfo. The stocks that are used for this setup must be set to #Shares = 1.

2. Check the update setting in MLDateTime. This setting will govern how quickly the stocks cycle. (Default is 15 seconds)

3. Set up the following macros :

macro.stocks.stockquoteinit

Code: Select all

MLServeCmd.Macro|Macro|SetVariable|SQindex~001!SetVariable|SQboundary~12
Here's what it does:

MLServeCmd.Macro|SetVariable|SQindex~001 sets the number of the first stock in the rotation (in this case, mlstockinfo_symbol_001)

MLServeCmd.SetVariable|SQboundary~12 sets the number of stocks that will be displayed. once the counter SQindex reaches this boundary, it's reset to the starting number by macro.stocks.stockquote REMEMBER to set this number to the number of stocks that YOU want to display


macro.stocks.stockquote

Code: Select all

MLServeCmd.Macro|SetVariable|stockquote~{{SQindex}}!MLMath|ADD~SQindex~{{SQindex}}~1!wscVBSEvaluate|Len("{{SQindex}}") = 1~SQlen!MLConditional|IsEqual##{{SQlen}}##True##SetVariable|stockquote~00{{SQindex}}##SetVariable|stockquote~0{{SQindex}}!MLConditional|IsEqual##{{SQindex}}##{{SQboundary}}##SetVariable|SQindex~001##
Here's what it does:

MLServeCmd.SetVariable|stockquote~{{SQindex}} sets the variable {{stockquote}} to the same value as SQindex

MLServeCmd.MLMath|ADD~SQindex~{{SQindex}}~1 increments the value of SQindex by 1

MLServeCmd.wscVBSEvaluate|Len("{{SQindex}}") = 1~SQlen sets the variable {{SQlen}} to "True" if SQindex is one digit long

MLServeCmd.MLConditional|IsEqual##{{SQlen}}##True##SetVariable|stockquote~00{{SQindex}}##SetVariable|stockquote~0{{SQindex}} appends two leading zeros to SQindex if SQlen is "True" and one leading zero if it is "False" (this is a workaround to keep SQindex as a 3-digit number to match the MLStockInfo variables)

MLServeCmd.MLConditional|IsEqual##{{SQindex}}##{{SQboundary}}##SetVariable|SQindex~001## Resets SQindex to 001 when it equals SQboundary


4. Set up the following server rule:

Code: Select all

Whenever currentsecond changes value then macro.stocks.stockquote
5. Add to MLStartup:

Code: Select all

macro.stocks.stockquoteinit
6. Last but not least, put the following code in the label of a text button where you want the stocks displayed:

Code: Select all

{{mlstockinfo_symbol_{{stockquote}}}} {{mlstockinfo_description_{{stockquote}}}} {{mlstockinfo_value_{{stockquote}}}} {{mlstockinfo_change_{{stockquote}}}}
Food for thought: you could have a group of stocks set up for this purpose with #Shares = 1 and still have others set up for other uses with #Shares set to anything you wanted. If, for example, you had stocks 015 through 030 set up for this, then the first macro would become:

MLServeCmd.Macro|Macro|SetVariable|SQindex~015!SetVariable|SQboundary~30

and the second one would set SQindex back to 015 instead of 001


Enjoy! :D

User avatar
mosleyh
Intermediate
Intermediate
Posts: 414
Joined: Tue Jul 12, 2005 12:55 pm
Location: Charlotte, NC
Contact: Send private message

Sat Dec 30, 2006 5:33 am

I almost (well, I did) forgot -

You have to run macro.stocks.stockquoteinit once manually, or restart the server to get things going. After that, the variables are created by the MLStartup entry whenever the server is restarted. . .

And, for anyone that skipped the fine print, in that same macro, change "12" to the number of stocks you want to see in the rotation.

User avatar
jmantas
Senior Member
Senior Member
Posts: 132
Joined: Sat May 20, 2006 7:53 pm
Contact: Send private message

Sat Dec 30, 2006 3:48 pm

Thanks..... I am going to give it a try. Could I ask for one more thing? would you mind posting your overlay jpg or swf with the modified headings?

User avatar
mosleyh
Intermediate
Intermediate
Posts: 414
Joined: Tue Jul 12, 2005 12:55 pm
Location: Charlotte, NC
Contact: Send private message

Sat Dec 30, 2006 3:52 pm

It's scaled a bit differently to accomodate the buttons I'm using, which are skinnier that the standard 0019.

The headings are just a matter of copy, paste, slide down (with the arrow keys) and edit the existing headings.

That said, if you still want it, I'll post it.

User avatar
mosleyh
Intermediate
Intermediate
Posts: 414
Joined: Tue Jul 12, 2005 12:55 pm
Location: Charlotte, NC
Contact: Send private message

Thu Jan 04, 2007 6:08 pm

The docs must have scared everyone away. . . :shock: :wink:

Funboy
Intermediate
Intermediate
Posts: 294
Joined: Sat Mar 01, 2003 9:54 pm
Contact: Send private message

Sat Jan 27, 2007 11:48 am

mosleyh,

This is great stuff.

There is a slight problem with the code.

>MLServeCmd.Macro|SetVariable|SQindex~001

Here you are setting the SQindex variable to 001

>MLServeCmd.MLConditional|IsEqual##{{SQlen}}##True##SetVariable|stockquote~00{{SQindex}}##SetVariable|stockquote~0{{SQindex}}

Here you are testing to see if SQindex is a single digit and pre-appending 00 to it. However if it's not a single digit, you are pre-appending a 0 to it. The problem with this is that the wscEvaluate|Len reports back that 001 is not a single digit and therefore you end up pre-appending a single 0 to it, which results in a stockquote of 0001.

By modifying this: ##SetVariable|stockquote~0{{SQindex}}
to: ##SetVariable|stockquote~{{SQindex}}

It worked for me.

Thanks for the detailed docs.
- Funboy

Funboy
Intermediate
Intermediate
Posts: 294
Joined: Sat Mar 01, 2003 9:54 pm
Contact: Send private message

One more problem

Sat Jan 27, 2007 12:24 pm

There is one more problem that I didn't notice at first - too many stocks loaded.

The first stock in your list will always be ignored because your incrementing the value of SQIndex before the MLConditional, where you assign stockquote to SQIndex.

For example. If you start off the macro with SQindex=001 and stockquote=001, your immediately incrementing SQindex by 1, so that make is 002. And then when you do the appending of the 0's, your assigning stockquote to SQindex again -and that this point SQindex has already incremented to 002.

There is any easy fix:
Do the increment (MLMath!ADD...) right before the MLConditional checking for SQboundary.

However, since MLConditional does not support a IsGreater, you need to increment the boundary by 1.
Last edited by Funboy on Sat Jan 27, 2007 12:46 pm, edited 1 time in total.
- Funboy

User avatar
mosleyh
Intermediate
Intermediate
Posts: 414
Joined: Tue Jul 12, 2005 12:55 pm
Location: Charlotte, NC
Contact: Send private message

Sat Jan 27, 2007 12:44 pm

Good catches. That's what I get for doing this stuff in the wee hours. . .

How about this for a fix for both issues:

Set SQBoundary to "13" instead of "12" (one more than the last stock in the rotation)

Set up the macro "macro.stocks.reset" as follows:

Code: Select all

MLServeCmd.Macro|SetVariable|SQindex~001!SetVariable|stockquote~001
and change the last line in macro.stocks.stockquote to:

Code: Select all

MLServeCmd.MLConditional|IsEqual##{{SQindex}}##{{SQboundary}}##macro.stocks.reset##
BTW, thanks for your interest!

Funboy
Intermediate
Intermediate
Posts: 294
Joined: Sat Mar 01, 2003 9:54 pm
Contact: Send private message

That's it

Sat Jan 27, 2007 1:05 pm

That works great!!

Now how about that news headlines ticker?

What plugin are you using for new headlines?
- Funboy

Return to “MLStockInfo”

Who is online

Users browsing this forum: No registered users and 1 guest