cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
uday_guntupalli
Level VIII

Use JSL to get data from the web

Hello All,

         After looking at this discussion (Use JSL to Scrape Data From the Web and Predict Football Wins!) -  I got very excited about the # of data sets available online to enhance my JSL skills. However - I haven't had much success after trying the code provided in this post. I tried to write to the author and am still waiting to hear back. If some one has done this before - can someone - please show how to get data from the web .

Lets say For E.g. I want to get the stock price for Twitter , its 52 - week low , 52-week high and current price - how can I do that in JSL .

Any inputs are appreciated. 

Best

uday

Best
Uday
1 ACCEPTED SOLUTION

Accepted Solutions
msharp
Super User (Alumni)

Re: Use JSL to get data from the web

There are many methods to get data from the web.  The best method depends on the data source.  In the example you posted, the user is simply using an Open() command and tells it which data table in the HTML to pull.  This is by far the easiest, but not always possible.  Some sites, like Twitter have set up API's.  This method is slightly more complicated but extremely more powerful.

Have you done your research?  Do you know where you want to get the stock price information?  What's the data source?

View solution in original post

17 REPLIES 17
msharp
Super User (Alumni)

Re: Use JSL to get data from the web

There are many methods to get data from the web.  The best method depends on the data source.  In the example you posted, the user is simply using an Open() command and tells it which data table in the HTML to pull.  This is by far the easiest, but not always possible.  Some sites, like Twitter have set up API's.  This method is slightly more complicated but extremely more powerful.

Have you done your research?  Do you know where you want to get the stock price information?  What's the data source?

uday_guntupalli
Level VIII

Re: Use JSL to get data from the web

msharp​,

             I have a couple of options that I have looked at :

1. Bar Chart .com

2. Yahoo Finance

3. Google Finance

            But I dont know if we need to ping the api's of these websites or if they are accessible as HTML tables.

Best
uday

Best
Uday
Jeff_Perkinson
Community Manager Community Manager

Re: Use JSL to get data from the web

The Yahoo Finance Fetcher​ JMP Add-in would be a good place to start.

-Jeff

-Jeff
uday_guntupalli
Level VIII

Re: Use JSL to get data from the web

Hello Jeff ,

        Thank you . I have already downloaded the addin. my objective is to be able to learn and understand how to do it in JSL and I dont know how to tap in to the code behind the addin . Also - the addin just seems to open the stock information in a browser against importing the data into JMP (which is what I would like to do) . I wish to import the data from these public repositories to further my analytical skills and coding skills in JSL .

Best

Uday

Best
Uday
msharp
Super User (Alumni)

Re: Use JSL to get data from the web

To access the code behind an Add-in go to View>>Add-Ins...>> Select the Add-in of choice, then select the link next to Home Folder.  This will take you to the folder where all the add-in scripts and files are stored on your local hard drive.

Edit: I may have beat Jeff to the punch, but he has a sweet picture that helps clarify.

Jeff_Perkinson
Community Manager Community Manager

Re: Use JSL to get data from the web

You can get to the JSL for the add-in by going to View->Add-Ins... and then select the Yahoo Fetcher add-in and click on the Home Folder link.

It will open the folder in Explorer (or the Finder if you're on a Mac). Then you can examine the .JSL file that the add-in runs.

-Jeff

Edited to add: msharp​ beat me to it.

-Jeff
msharp
Super User (Alumni)

Re: Use JSL to get data from the web

So,  using yahoo finance as an example I show you the two general methods.  If you go to any website you can just use the open command and specify the HTML table.  This requires the data to be stored in an HTML table.

Below that, I show you the yahoo finance table.csv api.  Adding s=TWTR to the end will create a CSV file for all the twitter data you could then play with in JMP.  If you want to know more about the api, this page is helpful.

Yahoo Finance (hidden) API | Ido Green

//Just browsing the web, was able to get these tables

open("http://finance.yahoo.com/echarts?s=TWTR#{\!"allowChartStacking\!":true}", HTML Table(2));

open("http://finance.yahoo.com/q;_ylt=AwrXgiOYWBFXxGUAYiiTmYlQ;_ylu=X3oDMTE0bWJta2VyBGNvbG8DZ3ExBHBvcwMxBH...", HTML Table(2));

open("http://finance.yahoo.com/q;_ylt=AwrXgiOYWBFXxGUAYiiTmYlQ;_ylu=X3oDMTE0bWJta2VyBGNvbG8DZ3ExBHBvcwMxBH...", HTML Table(3));

//This is the yahoo finance api interface

open("http://ichart.finance.yahoo.com/table.csv?s=TWTR");

uday_guntupalli
Level VIII

Re: Use JSL to get data from the web

@msharp:

         I seem to get the same error as I did when I tried to use the Open command earlier. Does this have anything to do with the settings ?

11359_Log.PNG

Best
Uday
msharp
Super User (Alumni)

Re: Use JSL to get data from the web

I can't say what your problem is, but all those commands worked for me.  I would start with basic troubleshooting steps.  Are you connected to internet? Try copying and pasting the website into the browser, does it bring up a page? (note: I would try the second page, I had to escape quotation marks in the first web address.)

What version of JMP are you running? If it's an older version, does it not support the functionality?  Are you on a mac or windows?