Results 1 to 8 of 8

Thread: I have a question...

  1. #1

    Thread Starter
    Frenzied Member RudyL's Avatar
    Join Date
    Mar 2001
    Location
    Chicago
    Posts
    1,519

    Question I have a question...

    I have a simple timer - like - question..

    Right now I have this program to monitor the stock market. It currently has a loop to do all the stuff... example:

    VB Code:
    1. for a = 0 to 10 ' 11 different tickers
    2.     call get_stockstuff(a0
    3. 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".

  2. #2
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    11 different tickers.... did you mean 11 different stocks (probably didn't)... you need tickers for different stock markets... right?

    Regardless, stock tickers that aren't real-time streaming, are delayed 20 mins from the opening bell for the NYSE, Nasdaq...

    And I can't remember the last time they changed the time of the opening bell (9:30 AM EST, closing at 4PM EST).

    So set the timer at 20 mins

  3. #3

    Thread Starter
    Frenzied Member RudyL's Avatar
    Join Date
    Mar 2001
    Location
    Chicago
    Posts
    1,519
    nemaroller - thanks for replying..

    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".

  4. #4

    Thread Starter
    Frenzied Member RudyL's Avatar
    Join Date
    Mar 2001
    Location
    Chicago
    Posts
    1,519
    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".

  5. #5
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    Well as far as the previous 4 points....

    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:
    1. Public Sub dome()
    2. Dim a As Integer
    3. Randomize
    4. a = 0
    5. For i = 0 To Int((30000 - 0 + 1) * Rnd + 0)
    6. a = a + 1
    7. If a > 0 Then a = a - 1
    8. Next
    9. End Sub
    10.  
    11. Private Sub Timer1_Timer()
    12. Debug.Print ("timer1")
    13. dome
    14. End Sub
    15.  
    16. Private Sub Timer2_Timer()
    17. Debug.Print ("timer2")
    18. dome
    19.  
    20. End Sub
    21.  
    22. Private Sub Timer3_Timer()
    23. Debug.Print ("timer3")
    24. dome
    25.  
    26. End Sub
    27.  
    28. Private Sub Timer4_Timer()
    29. Debug.Print ("timer4")
    30. dome
    31.  
    32. End Sub
    33.  
    34. Private Sub Timer5_Timer()
    35. Debug.Print ("timer5")
    36. dome
    37. End Sub
    Last edited by nemaroller; May 27th, 2003 at 02:08 PM.

  6. #6
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    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...

  7. #7
    Junior Member
    Join Date
    Feb 2003
    Posts
    17
    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

  8. #8

    Thread Starter
    Frenzied Member RudyL's Avatar
    Join Date
    Mar 2001
    Location
    Chicago
    Posts
    1,519
    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
    Attached Files Attached Files
    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".

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width