Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

web address to get stock prices

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

  • web address to get stock prices

    This address and code used to work to get stock prices directly using stock symbols. Worked great for years. The web address service is being discontinued. Anyone have a different address/method to acquire stock prices?
    Code:
     
    link = "http://download.finance.yahoo.com/d/quotes.csv?s="+vsymbol+"&f=sl1d1t1c1ohgv&e=.csv"
    result = http_get(link)
    p.price = word(result.body,2,",")
    stock_data = p
    vc_price_now=convert_type(stock_data.price,"c")
    vn_price_now=val(vc_price_now)
    Mike W
    __________________________
    "I rebel in at least small things to express to the world that I have not completely surrendered"

  • #2
    Re: web address to get stock prices

    Mike have a look at https://www.alphavantage.co/documentation/
    Alex Collier

    "The spread of computers and the Internet will put jobs in two categories. People who tell computers what to do, and people who are told by computers what to do"

    AA Builds from 5221_5152 to Pre-releases >> Deploying to IIS in AWS

    Comment


    • #3
      Re: web address to get stock prices

      Hi Alex,
      Thank you for that. Unfortunately, I can't get any data out from the api return. There is an example of the address to get data:
      https://www.alphavantage.co/query?fu...ll&apikey=demo
      I can use sys_open() for the url and delivered is a CSV file that I can save or open and do manual extractions, but http_get() doesn't return data and I haven't discovered a way to have the return deliver data that I can extract using code.
      Mike W
      __________________________
      "I rebel in at least small things to express to the world that I have not completely surrendered"

      Comment


      • #4
        Re: web address to get stock prices

        Seems to work ok...

        Code:
        function getStocks as c (e as p)
        	
        	debug(1)
        	
        	dim url as c = "https://www.alphavantage.co/query?function=TIME_SERIES_INTRADAY&symbol=MSFT&interval=1min&apikey=demo"
        	dim result as p
        	result = http_get(url)
        	
        end function
        The returned JSON is in result.body.

        You can also do this client-side using the fetch() api... which is cool because fetch() uses promises.

        Code:
        function getStocks(){
        
        	debugger;
        	var stockURL = "https://www.alphavantage.co/query?function=TIME_SERIES_INTRADAY&symbol=MSFT&interval=1min&apikey=demo"
        	
        	fetch(stockURL)
        		.then(function(response) {
        			if (response.status !== 200) {
        				console.log('Looks like there was a problem. Status Code: ' +
        				response.status);
        				return;
        			}
        		
        			// Examine the text in the response
        		      
        			response.json().then(function(data) {
        				console.log(data);
        			});
        		})
        		.catch(function(err) {
        			console.log('Fetch Error :-S', err);
        		});
        
        
        }
        The returned JSON is in the data variable. In this case it's being sent to the console.

        Comment


        • #5
          Re: web address to get stock prices

          mike,
          you originally posted this in the desktop section, so i am assuming you are doing this in the desktop side. also somehow i think you have version 12, that i cannot be certain.
          i have tried http_get, http_fetch several times on my own and also in trying to answer this question. i cannot succeed. there may be problems the way alpha version of http functions work. jerry has indicated to use http_fetch and http_fetch_page in another post, that could be useful or if in fact you have version 12 take a look at curl integration that will definitely work, since i can easily get the json data using curl. i cannot test curl integration since it is not available in version 11 unless i write my own wrapper for it.
          Last edited by GGandhi; 12-15-2017, 09:27 AM.
          thanks for reading

          gandhi

          version 11 3381 - 4096
          mysql backend
          http://www.alphawebprogramming.blogspot.com
          ggandhi344@gmail.com
          Skype:ggandhi344@gmail.com
          1 914 924 5171

          Comment


          • #6
            Re: web address to get stock prices

            http_get() absolutely will work for this, however I see that the service can be quite slow though. The default timeout for http_get() is 8 seconds, so if the service does not respond in that amount of time, you will not get the results. You will be able to verify that this is the problem by looking at the error_text property returned from your http_get() call.

            You can specify a longer timeout as follows:

            Code:
            link = "https://www.alphavantage.co/query?function=TIME_SERIES_INTRADAY&symbol=MSFT&interval=1min&apikey=demo"
            timeout = 30000 '30 seconds (in milliseconds)
            result = http_get(link, "", 443, timeout)
            Last edited by Lenny Forziati; 12-15-2017, 03:51 PM.

            Lenny Forziati
            Vice President, Internet Products and Technical Services
            Alpha Software Corporation

            Comment


            • #7
              Re: web address to get stock prices

              Lenny
              I just want to bring to your attention that mike is able to with yahoo
              That service is going away according to him
              The problem with is with Alphavantage
              Sorry to interject in mike’s thread
              thanks for reading

              gandhi

              version 11 3381 - 4096
              mysql backend
              http://www.alphawebprogramming.blogspot.com
              ggandhi344@gmail.com
              Skype:ggandhi344@gmail.com
              1 914 924 5171

              Comment


              • #8
                Re: web address to get stock prices

                No issues with AlphaAdvantage.co... as posted. AlphaAdvantage may take time to respond so apply Lenny's timeout solution to solve potential timing issues.

                Comment


                • #9
                  Re: web address to get stock prices

                  I've fixed my example to use alphavantage.co. I had tested with it originally, but copied the wrong code to post here. As David reiterated, it works but occasionally (often) takes longer than 8 seconds so will appear to fail if you do not increase the timeout.

                  Lenny Forziati
                  Vice President, Internet Products and Technical Services
                  Alpha Software Corporation

                  Comment


                  • #10
                    Re: web address to get stock prices

                    Hi everyone,
                    I appreciate everyone responding, and please don't take offense, but none of the codes and responses presented show a result actually obtained. Some of the arguments deliver results, like result.header:
                    = HTTP/1.1 301 Moved Permanently
                    Connection: close
                    Server: gunicorn/19.7.0
                    Date: Fri, 15 Dec 2017 23:20:54 GMT
                    Transfer-Encoding: chunked
                    Location: https://www.alphavantage.co/query?fu...in&apikey=demo
                    Content-Type: text/html; charset=utf-8
                    Via: 1.1 vegur
                    However results.body is completely empty. Thanks Ghandi, you are very correct. It may be a source site issue and not a http_get() issue at all! I don't have the expertice to know, except the site clearly produces results via sys_open(), so I would think there would be a method to get those results, right?
                    Mike W
                    __________________________
                    "I rebel in at least small things to express to the world that I have not completely surrendered"

                    Comment


                    • #11
                      Re: web address to get stock prices

                      do you have version 12? i thought you had.
                      thanks for reading

                      gandhi

                      version 11 3381 - 4096
                      mysql backend
                      http://www.alphawebprogramming.blogspot.com
                      ggandhi344@gmail.com
                      Skype:ggandhi344@gmail.com
                      1 914 924 5171

                      Comment


                      • #12
                        Re: web address to get stock prices

                        i can get the data with curl without any problem, so it is not the site. if you ask me.
                        thanks for reading

                        gandhi

                        version 11 3381 - 4096
                        mysql backend
                        http://www.alphawebprogramming.blogspot.com
                        ggandhi344@gmail.com
                        Skype:ggandhi344@gmail.com
                        1 914 924 5171

                        Comment


                        • #13
                          Re: web address to get stock prices

                          Code:
                          link = "https://www.alphavantage.co/query?function=TIME_SERIES_INTRADAY&symbol=MSFT&interval=1min&apikey=demo"
                          timeout = 30000 '30 seconds (in milliseconds)
                          result = http_get(link, "", 443, timeout)
                          ?result
                          = body = 
                          error_code = 1813
                          error_text = Could not connect to server: Secure Sockets Layer OpenSSL Error
                          OpenSSL Description: error:14077438:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert internal error
                          Error occurred in INET::SSLSocket::Connect
                          headers = ""
                          +parsed_headers.
                          this is what I got with the code provided by lenny.
                          so I cannot get any data. remember I am still on version 11
                          thanks for reading

                          gandhi

                          version 11 3381 - 4096
                          mysql backend
                          http://www.alphawebprogramming.blogspot.com
                          ggandhi344@gmail.com
                          Skype:ggandhi344@gmail.com
                          1 914 924 5171

                          Comment


                          • #14
                            Re: web address to get stock prices

                            Originally posted by Mike Wilson View Post
                            Hi everyone,
                            I appreciate everyone responding, and please don't take offense, but none of the codes and responses presented show a result actually obtained. Some of the arguments deliver results, like result.header:

                            However results.body is completely empty. Thanks Ghandi, you are very correct. It may be a source site issue and not a http_get() issue at all! I don't have the expertice to know, except the site clearly produces results via sys_open(), so I would think there would be a method to get those results, right?
                            Mike... you'll have to confirm your Alpha version/build... and post a sample component. Otherwise, it's just a lot of guessing.

                            It's working for me without issue.

                            Comment


                            • #15
                              Re: web address to get stock prices

                              The app is built in v11. It is not destined to be advanced to v12, so whether curl works does not yield a solution. I get the same results in v9, v10, v11 using http_get() FOR THIS AlphaAdvantage site, which is the same results in my hands that Gandhi posted. David, as for the "sample component" , what I have is what I have given. I am needing a site to obtain stock prices. I have been able to use http_get() successfully with the Yahoo site, with the return of the petition using http_get() being a construct that data components can be harvested. With that site being discontinued, I'm needing another source. Maybe this AlphaAdvantage site is not going to work because the return is not a composite resolvable with Alpha.

                              David, you wrote it is working for you without issue. Maybe you might show us a successful return of data in the Interactive Editor using this site and the script(s) we have been discussing, so we can see what you're scripting to achieve success, and the successful results you are obtaining? With which A5 version.

                              BTW, I have no idea how this go into "General Questions" forum. I'd like a moderator to switch this to desktop v11 or Desktop forum.
                              Last edited by Mike Wilson; 12-15-2017, 11:34 PM.
                              Mike W
                              __________________________
                              "I rebel in at least small things to express to the world that I have not completely surrendered"

                              Comment

                              Working...
                              X