Announcement

Collapse
No announcement yet.

Stock script

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Stock script

    Does anyone have a good script for pulling individual stock?
    Unfortunately the scripts in the archive no longer work.

    Thanks

    #2
    I *just* posted one moments ago in the Script Library forum here.

    Enjoy!

    Regards,

    Rick Tinker
    HomeSeer Technologies

    Regards,

    Rick Tinker (a.k.a. "Tink")

    Comment


      #3
      Very welcome script, Rick! Voice pacing is excellent!

      Unfortunately, all stock prices are the same as Cisco. I'm not familiar enough with arrays to spot the problem though. The company name increments, but all other values are the same.

      Hope its an easy fix.

      Comment


        #4
        Hi Rick,

        I setup a new event to run the script you just posted (stock_quote_speak.txt) when triggered by X-10 C16 ON. I didn't modify the script at all and I am using HS version 1.6.119 on a Win2K machine. This was the result:

        10/29/2003 9:47:36 PM~!~X10 Received~!~C16 (?) C On
        10/29/2003 9:47:36 PM~!~Event Trigger~!~X10 Trigger (UnNamed)
        10/29/2003 9:47:37 PM~!~Speak~!~cisco
        10/29/2003 9:47:38 PM~!~Speak~!~cisco is at <Context ID="Currency">$20.82</Context> which is down <Context ID="Currency">$0.08</Context> or 0.38%
        10/29/2003 9:47:57 PM~!~Speak~!~cisco opened at <Context ID="Currency">$20.89</Context> with a high of <Context ID="Currency">$20.94</Context> and a low of <Context ID="Currency">$20.64</Context>
        10/29/2003 9:48:26 PM~!~Speak~!~This quote is from <Context ID="Time">6:30 PM</Context>
        10/29/2003 9:48:34 PM~!~Speak~!~microsoft
        10/29/2003 9:48:36 PM~!~Speak~!~microsoft is at <Context ID="Currency">$20.82</Context> which is <Context ID="Currency">$0.08</Context> or 0.38%
        10/29/2003 9:48:55 PM~!~Speak~!~microsoft opened at <Context ID="Currency">$20.89</Context> with a high of <Context ID="Currency">$20.94</Context> and a low of <Context ID="Currency">$20.64</Context>
        10/29/2003 9:49:24 PM~!~Speak~!~This quote is from <Context ID="Time">6:30 PM</Context>
        10/29/2003 9:49:33 PM~!~Speak~!~I B M
        10/29/2003 9:49:34 PM~!~Speak~!~I B M is at <Context ID="Currency">$20.82</Context> which is <Context ID="Currency">$0.08</Context> or 0.38%
        10/29/2003 9:49:54 PM~!~Speak~!~I B M opened at <Context ID="Currency">$20.89</Context> with a high of <Context ID="Currency">$20.94</Context> and a low of <Context ID="Currency">$20.64</Context>
        10/29/2003 9:50:23 PM~!~Speak~!~This quote is from <Context ID="Time">6:30 PM</Context>
        10/29/2003 9:50:31 PM~!~Speak~!~General Electric
        10/29/2003 9:50:33 PM~!~Speak~!~General Electric is at <Context ID="Currency">$20.82</Context> which is <Context ID="Currency">$0.08</Context> or 0.38%
        10/29/2003 9:50:52 PM~!~Speak~!~General Electric opened at <Context ID="Currency">$20.89</Context> with a high of <Context ID="Currency">$20.94</Context> and a low of <Context ID="Currency">$20.64</Context>
        10/29/2003 9:51:21 PM~!~Speak~!~This quote is from <Context ID="Time">6:30 PM</Context>
        10/29/2003 9:51:30 PM~!~Speak~!~Hewlett Packard
        10/29/2003 9:51:32 PM~!~Speak~!~Hewlett Packard is at <Context ID="Currency">$20.82</Context> which is <Context ID="Currency">$0.08</Context> or 0.38%
        10/29/2003 9:51:52 PM~!~Speak~!~Hewlett Packard opened at <Context ID="Currency">$20.89</Context> with a high of <Context ID="Currency">$20.94</Context> and a low of <Context ID="Currency">$20.64</Context>
        10/29/2003 9:52:21 PM~!~Speak~!~This quote is from <Context ID="Time">6:30 PM</Context>
        10/29/2003 9:52:29 PM~!~Speak~!~all done, no more quotes

        Joe
        HomeSeer Rocks!

        Comment


          #5
          Hi Rick,

          I hope I'm not breaking protocol as I'm posting a revised version of the stock quote script. I didn't change the spirit of the script at all, just made a couple of minor tweaks to fix a couple of problems.

          The reason why every quote came back with the same numbers is because the variables amount, chgamt, chgpct, qtime, vol, qopen, qhigh, and glow were not being reset so I did so at the top of the main loop.

          I also got rid of all the <Context> stuff. Not sure why it was there.

          Here is the result now when this script gets run:

          10/29/2003 11:56:43 PM~!~X10 Received~!~C16 (?) C On
          10/29/2003 11:56:43 PM~!~Event Trigger~!~X10 Trigger (UnNamed)
          10/29/2003 11:56:43 PM~!~Speak~!~cisco
          10/29/2003 11:56:48 PM~!~Speak~!~cisco is at $20.82 which is down $0.08 or 0.38%
          10/29/2003 11:56:54 PM~!~Speak~!~cisco opened at $20.89 with a high of $20.94 and a low of $20.64
          10/29/2003 11:57:04 PM~!~Speak~!~This quote is from 6:30 PM
          10/29/2003 11:57:06 PM~!~Speak~!~microsoft
          10/29/2003 11:57:08 PM~!~Speak~!~microsoft is at $26.74 which is down $0.46 or 1.69%
          10/29/2003 11:57:15 PM~!~Speak~!~microsoft opened at $27.16 with a high of $27.25 and a low of $26.66
          10/29/2003 11:57:26 PM~!~Speak~!~This quote is from 6:30 PM
          10/29/2003 11:57:29 PM~!~Speak~!~I B M
          10/29/2003 11:57:30 PM~!~Speak~!~I B M is at $89.34 which is down $0.56 or 0.62%
          10/29/2003 11:57:37 PM~!~Speak~!~I B M opened at $89.60 with a high of $89.94 and a low of $89.15
          10/29/2003 11:57:47 PM~!~Speak~!~This quote is from 7:20 PM
          10/29/2003 11:57:50 PM~!~Speak~!~General Electric
          10/29/2003 11:57:52 PM~!~Speak~!~General Electric is at $28.83 which is up $0.31 or 1.09%
          10/29/2003 11:57:59 PM~!~Speak~!~General Electric opened at $28.52 with a high of $29.15 and a low of $28.42
          10/29/2003 11:58:10 PM~!~Speak~!~This quote is from 6:19 PM
          10/29/2003 11:58:12 PM~!~Speak~!~Hewlett Packard
          10/29/2003 11:58:14 PM~!~Speak~!~Hewlett Packard is at $21.82 which is up $0.17 or 0.79%
          10/29/2003 11:58:21 PM~!~Speak~!~Hewlett Packard opened at $21.65 with a high of $21.94 and a low of $21.45
          10/29/2003 11:58:32 PM~!~Speak~!~This quote is from 5:29 PM
          10/29/2003 11:58:35 PM~!~Speak~!~all done, no more quotes


          Awesome script! Now if I only had some stocks so I could make use of it. Then again with the market as it is...

          Joe
          HomeSeer Rocks!
          Attached Files

          Comment


            #6
            Joe, thanks for correcting the script, since I was the one who originally asked Rick T. (thanks again, Rick! ) for revising his first version, but was unable to correct it.

            Glen

            Comment


              #7
              Joe, one other thing, is it possible to save any/all quotes to a single line in a text file?

              I'm trying to send the quotes to my Beta Brite Sign, and it's a whole lot easier if I had the info on one line.

              Dan (explosiv) gave me hand with the CNN script, and would appreciate any help you can give me since scripting it still a foreign language to me.

              Thanks.

              Glen

              Comment


                #8
                Here's a modified script that writes what is spoken to a text file named TextFile.txt. This file is written to the HS/temp folder.

                The script is currently setup to append to that text file. If you do not want it to append change the 8 in this line to a 2

                <pre class="ip-ubbcode-code-pre">
                ' Open the File For Writing ...
                Set objFile = objFSO.opentextfile(strNewTextFile, 8, True)
                </pre>

                -Rupp
                Isn't Disney World a people trap operated by a mouse?
                Attached Files
                💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

                Comment


                  #9
                  Joe,

                  I don't mind you posting a fixed version at all, but you should know about the usage of the context tags.

                  First of all, my apologies for the stupid mistake. I made the changes quick and late at night... You were correct that I forgot to reset the variables.

                  The context tags are SAPI 5 specific tags that tell the TTS engine the context of what it is speaking. This helps clear up mispronounciations or the TTS engine using the wrong context for something.

                  For example, if you have HomeSeer speak the time and it is AM, it will pronounce it as "am" as in "I am what I am.". If you put <Context="Time"> before the time and <\Context> after it, then it knows it is speaking the time and will pronounce AM as "A" "M".

                  The context tags I used were to make it pronounce the numbers using a currancy context so it would speak $1.98 as "One dollar and 98 cents" instead of "dollar one point ninety eight" or however else it might decide to speak it.

                  You would "hear" the context tags only if you are not using a SAPI 5 TTS voice, which must be the case in your situation!


                  So here is what I did. I re-posted my version in the script library forum under the first one, and I made the correction for resetting the variables, but I also changed the extension on the file to ".VBS" instead of ".TXT" so that people with the SAPI 5 TTS engine can use my version, and people not using SAPI 5 can use yours and they can both reside on the same system. The VBS file can be edited with the same editor as .TXT files.


                  As for using this script, the only thing you will want to change is the Array statement at the top where it lists the companies (spelled how you want them pronounced) and their ticker symbols.


                  Regards,

                  Rick Tinker
                  HomeSeer Technologies

                  Regards,

                  Rick Tinker (a.k.a. "Tink")

                  Comment


                    #10
                    Fantastic! This is just what I was looking for.

                    I am trying to figure out how to go to the next level and do the following:

                    1)Make it like the horoscope script, where I could say "Get stock quote for Cisco" and would only bring back the Cisco quote. I know I could set-up individual events, but I was hoping for one script to handle it.

                    2) I was hoping to find a way where I could enter my purchase price in the script and it could read me my profit or loss based on the current selling price. It would be cool if it could give me a total profit or loss for all stocks at the end.

                    Thanks again for the excellent script!! I am adding a bunch of stocks right now!

                    Comment


                      #11
                      Rupp-

                      Everything is working just fine except for a few things.

                      (I've attached my version so you can see what I'm talking about...it just may not speak well since I'm only using it for the data)

                      1. After running the script I would like the quotes to be more spaced when the data is saved to the text file, and I'm not sure where I need to put the command. (Note: I changed the name to stockquotes.txt)

                      2. What command would I use to pull this line and use it in another script?

                      If you're curious as to why I'm doing this, it's so that I have a ticker running on my Beta Brite Sign!

                      And Rupp, I really appreciate your help on this, since not only am I still learning how to script, but the funny this is, I was able to understand the changes you made!

                      Hanfseer-Do you have a working horoscope script? If you do, would you mind posting it?

                      And as for your idea of calculating profit/loss for any stock you own, I do like the idea but unsure if it's possible. I like the idea, though.

                      Rick T.-Sorry for not clarifying my intentions of using the script when I asked you for your help, since I'm sure it would have made it easier on you. However, I'm glad your work is helping out others by gaining a nice addition to the script's library.

                      Glen
                      Attached Files

                      Comment


                        #12
                        Rupp-

                        I just figured out #1, but still having an issue with #2.

                        Possibly, is there a way to save this to an ini file, instead? Or does it even matter?

                        Thanks again, Rupp.

                        Boy, I know one thing, I'm going to learn how script sooner or later, whether I like it or not!

                        Glen

                        Comment


                          #13
                          <pre class="ip-ubbcode-code-pre">

                          ' Create the File System Object to be used for file manipulation ...
                          Set objFSO = CreateObject("Scripting.FileSystemObject")

                          ' Set the directory where the file is located ...
                          TempBackupLogPath = "c:\Program Files\Homeseer\temp\"

                          ' What file to open...
                          strNewTextFile = TempBackupLogPath & "TextFile.txt"

                          ' Open the File For reading...
                          Set objFile = objFSO.opentextfile(strNewTextFile, 1)

                          ' read the data from the file ...
                          data = objFile.readline

                          MsgBox (data)
                          ' Close the file ...
                          objFile.Close
                          </pre>

                          Just get rid of the message box and use the variable data in the script where you need it.

                          -Rupp
                          Isn't Disney World a people trap operated by a mouse?
                          💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

                          Comment


                            #14
                            It works like a charm!

                            btw, when I first asked Rick T. to see if he could modify the stock script for me, I had seen you (as well as others) had been looking for one a while back, and mentioned that other users would benefit from it as well.

                            Why I said that? Well, I have noticed there are members, like yourself, who go out of there way to help newbies (like me! ) by posting to this board, and wanted to somehow return the favor. I've learned a great deal by reading, reading, and more reading, but it all wouldn't have been possible unless people like you were there assisting others.

                            To be honest Rupp, there aren't many people in this world that go out of there way to help others, and you definately have shown to this board you are one of them!

                            Once I have more time to learn how it all works, I hope to be returning the favor as well.

                            Glen

                            LET THE TICKER BEGIN!!

                            Comment


                              #15
                              Haven't had a chance to play w/ it yet. Hoping I can have it check periodcally (dial up) and play back on request.

                              Did notice it was telling me it got the data at midnight when it was just after 1PM est.

                              THANKS AGAIN!

                              (yelling)

                              Brad

                              Comment

                              Working...
                              X