Re: data scraping with Yahoo Finance/ StockWatch

Forums > Java > data scraping with Yahoo Finance/ StockWatch
Dec 11 2012 | 10:30 am

Let me explain what I do exactly: I took the original Stockwatch object and altered a fw things in the code to get more datapoints. These alterations are:
1) Change the classname into DataScapR
2) change the URL features (more info here on how I did that:
3) change the static final int (adding the new datapooints in this list): For example static final int CHANGEREALTIME = 17 ;
4) Equally expand the atomList until 60 (as there are 60 different datapoints I want to dowload each time): Atom.newAtom(nfo[ 32 ]),
5) As I have 60 datapoints the index counts until 61: if(idx >= 61) break;
6) as well as in the addquotes section: _syms.put(sym, new String[61]);

Now, When I lookup Apple (AAPL) or Amzon (AMZN) I have no problems. Looking up Umicore (UMI.BR) I get errors but after a minute he gets the data. Looking up Coal India (COALINDIA.BO) I get the following errors:

Exception in thread "Thread-19" java.lang.NullPointerException
at com.cycling74.max.Atom$StringAtom.(
at com.cycling74.max.Atom$StringAtom.
at com.cycling74.max.Atom.newAtom(

Strangely enough, on the original StockWatch patch, I do not have this problem but I cannot see what I am doing wrong

I am adding my class and the altered StockWatch patch so you can have a look. To use it: Clear all quotes using the clear message, then add a quote (UMI.BR, AAPL and COALINDIA.BO) are included and you should only selct one of those, if you want to change clear the slot first to avoid errors. If everything goes ok, you get to see the data in the Max window and the scroller, otherwise you see errors and the scroller freezes.


Subscribe to the Cycling ’74 Weekly Newsletter

Let us tell you about notable Max projects, obscure facts, and creative media artists of all kinds.

* indicates required