Here is the code:

NB. retrieve stock prices from yahoo and do some graphing
load 'web/gethttp'
load 'tables/csv'
load 'plot'

URL=:'http://ichart.finance.yahoo.com/table.csv?s='

quote=: 3 : 'fixcsv gethttp URL,y'

Quotes=: quote each 'DAL';'UAL'

'DAL UAL'=:Quotes

DALd =: |. }. DAL

Prices=: > ". each 4{"1 DALd
plot Prices

MaxPrice=: >./ Prices

plotPrices =: 3 : 0
 pd (i. # y);(|. ,> y)
)

plotTickers =: 3 : 0
 Tickers=.y
 pd 'reset'
 pd 'key',(, > ' '&, each Tickers)
 Quotes=.quote each Tickers
 AllPrices=. ". each > }. each 4{"1 each Quotes
 plotPrices"1 AllPrices
 pd 'show'
)
plotTickers 'UAL';'DAL';'JBLU'

Years=. 4 {. each 0{"1 DALd
groupBy=: 4 : '(((~.y) i. y)) ,/. x'
YearGroups=:Prices groupBy Year
MaxPricePerYear =: >. /"1 YearGroups
]YearKeys=: ". > ~. Year
plot YearKeys;MaxPerYear





On Mon, Feb 17, 2014 at 12:49 PM, Joe Bogner <[email protected]> wrote:

> This is a continuation of this thread:
> http://jsoftware.com/pipermail/programming/2014-February/035222.html but
> moved to chat.
>
> I posted a video http://www.youtube.com/watch?v=qXFpgYvbogw with the
> intent of showing some of J's capabilities.
>
> I would be happy to hear any feedback on the video.
>
> Looking back at it, I wish I bumped up the font size. It's best viewed
> full screen.
>
> I tried to flip through things pretty quickly to fit in as much as
> possible.  I probably unnecessarily explained things in a few cases. I
> still need to practice using the right term for the operations too.
>
> In terms of my examples, I would like to know if I could put dates somehow
> on on X-axis.
>
> I also worked up an example that used a secondary axis with % change, but
> I haven't recorded it yet. That might be a continuation. Plotting on a
> secondary axis is something that J's plot does real easily compared to R.
>
> Thanks for any feedback
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to