Reading and Displaying Stock Data with EMT

I am not sure if I ever posted about this here. It is possible to read stock data in EMT from Yahoo. The code for this is contained in the utility file „getstock.e“.

>load getstock;
>v=getstock("AlV.DE",day(2012,1,1)); // AlV.DE = German Allianz AG
>t=v'[1]; c=v'[2]; p=polyfit(t,c,1);

It will display the following plot.


If you study the variable v, it contains the Julian dates in the first column and the stock data in the second. The days can be converted to years, and this is done in showstock(). For the regression line, we use polyfit() and add this to the stock plot. By the way, the annual growth is contained in p[2] and is about 20.6 Euro per year.

In the examples, you find a notebook that does a lot more than this.

This posting is the one from an ongoing series of posts to show things that can be done with EMT. I hope to make EMT more popular this way.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht.

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.