Right now I have this program to monitor the stock market. It currently has a loop to do all the stuff... example:
VB Code:
for a = 0 to 10 ' 11 different tickers
call get_stockstuff(a0
next a
Not exact, but you get he jist of it... The problemis that is can be slow.. What i was thinking of doing is have 11 different timers and have each one go out and get the data individually. I forsee a few probles,
1) Each timer will be calling the same routines.. is this ok or will it crash??
2) Can I even have that many timers and run efficiently?
3) is it wise to have that many timers or is it better the way I allready have it?
4) I could have an external prgm. that can be shelled out to ge the values and return them.. thoughts on this please..
thanks for you thoughts,
Rudy
10 different ways to skin a cat and amazingly enough each and every one has the same result, the cat gets skinned! The same can be applied to code, so be nice and accept each others "preferences".
Yes, 11 different stock ticker values (ie: AOL, MSFT, A, HP, ect..) and I know that "MOST" of them are delayed to 20 minutes.. But many are not, of course you pay for this, but those are other details..
Another thing, eventhough everyone knows it is delayed, they still want it to be refreshed as fast as possible... If they can click the refresh button on I.E. every second, than this should refresh every 1/2 second.. It's a mind thing I guess, but I have had many requests to make is faster... Currently I have a 1 second refresh rate option, but when you start to add tickers the time between refreshes grows exponantly..1, 2, 3, 4, 5 ect.. depending on how many tickers are entered in the chart..
What I am looking for is to be able to update the screen at the fastest rate possible.. So I was thinking of using a separate timer for each ticker (stock ticker). But I am concerned about the 4 points I mentioned previously..
Rudy
10 different ways to skin a cat and amazingly enough each and every one has the same result, the cat gets skinned! The same can be applied to code, so be nice and accept each others "preferences".
10 different ways to skin a cat and amazingly enough each and every one has the same result, the cat gets skinned! The same can be applied to code, so be nice and accept each others "preferences".
I put five timers on a form all set to the same interval... and had them print to debug window when they hit their interval, and this was the result:
timer1
timer2
timer3
timer4
timer5
timer5
timer4
timer3
timer2
timer1
timer1
timer2
timer3
timer4
timer5
timer5
timer4
timer3
timer2
timer1
timer1
timer2
timer3
timer4
timer5
timer5
timer4
timer3
timer2
timer1
As you can see, some timers were called twice, yet it kinda stabalized itself... but if you had more code behind each sub... I'm not entirely sure it would work well (as in not all the timers events may be captured)...
VB Code:
Public Sub dome()
Dim a As Integer
Randomize
a = 0
For i = 0 To Int((30000 - 0 + 1) * Rnd + 0)
a = a + 1
If a > 0 Then a = a - 1
Next
End Sub
Private Sub Timer1_Timer()
Debug.Print ("timer1")
dome
End Sub
Private Sub Timer2_Timer()
Debug.Print ("timer2")
dome
End Sub
Private Sub Timer3_Timer()
Debug.Print ("timer3")
dome
End Sub
Private Sub Timer4_Timer()
Debug.Print ("timer4")
dome
End Sub
Private Sub Timer5_Timer()
Debug.Print ("timer5")
dome
End Sub
Last edited by nemaroller; May 27th, 2003 at 02:08 PM.
I would use one timer and use Boolean flags to indicate which tickets to fetch the data for... or some variable to indicate how much time has elapsed since a certain ticker has been updated, and the ticker with the largest elapsed time gets priority...
Originally posted by nemaroller I would use one timer and use Boolean flags to indicate which tickets to fetch the data for... or some variable to indicate how much time has elapsed since a certain ticker has been updated, and the ticker with the largest elapsed time gets priority...
Exactly - Just keep using If statements in the timer. 11 timers would be extremely slow
That was kind of what I saw.. I have attached my project, please take a look and see if you can see a way to make it more efficient..
I used for pretty common websites, listed in the source module..
I did have to add a different inet control for each timer event.. Any thoughts on that? This is sounding very inefficient.. What do you guys think?
Thanks again!
Rudy
10 different ways to skin a cat and amazingly enough each and every one has the same result, the cat gets skinned! The same can be applied to code, so be nice and accept each others "preferences".