having fun with this:

   stocklist ; &> (<./ ; >./)  each ". each stocklist ,each 'p'
┌───┬────┬─────┐
│DAL│3.93│32.84│
├───┼────┼─────┤
│UAL│3.13│51.49│
└───┴────┴─────┘

a better last line to the setVarsandPlot verb. (min and max)


----- Original Message -----
From: Pascal Jasmin <godspiral2...@yahoo.ca>
To: "programm...@jsoftware.com" <programm...@jsoftware.com>
Cc: 
Sent: Monday, February 17, 2014 5:21:20 PM
Subject: Re: [Jprogramming] J in 5 minutes

this verb combines all of the fancy side effect stuff into one

NB. gets data from internet and plots it.  Keeps data as global vars for 
further analysis
setVarsandPlot =: 3 : 0 NB. y is a stocklist (list of boxed ticker symbols)
y assign each quote each y
(y ,each 'd') assign each ([: |. }.)@: ". each y
(y ,each 'p') assign each Prices@:". each y ,each 'd'
plot &> ". each y ,each 'p'  NB. sideffect
y ; each (>./)  each ". each y ,each 'p' NB. returns maxprice with formatting

)

Once tickers are downloaded, you can shorten a stocklist either by edititing 
the stocklist variable or creating a new one.



----- Original Message -----
From: Pascal Jasmin <godspiral2...@yahoo.ca>
To: "programm...@jsoftware.com" <programm...@jsoftware.com>
Cc: 
Sent: Monday, February 17, 2014 4:16:24 PM
Subject: Re: [Jprogramming] J in 5 minutes

here is one wow verb

assign =: 4 : '(x) =: y'




stocklist =: 'DAL';'UAL' (NB. can do in console.  later edit variable to 
increase stocks).  Can be used to add headers/titles too.

stocklist assign each quote each stocklist  NB. only have to edit stocklist 
once, and you will get new variable names.

DAL  NB. assigned in previous statement

maybe a bit too much, but:

". each stocklist  NB. will "run" the names of the variables previously assigned


  (stocklist ,each 'd') assign each ([: |. }.)@: ". each stocklist NB. assigns 
DALd and UALd


UALd

   # UAL
2022
   # UALd
2021

Prices=: [: ". &> 4&{"1
   plot Prices UALd
   plot Prices DALd


MaxPrice=: >./ @: Prices


   MaxPrice each ". each stocklist
┌─────┬─────┐
│32.84│51.49│
└─────┴─────┘
   stocklist,. MaxPrice each ". each stocklist  NB. prettier display and 
showing which ticker is which price



could reuse trick above:

(stocklist ,each 'p') assign each Prices@:". each stocklist ,each 'd' NB. UALp 
and DALp are assigned



plot each ". each stocklist ,each 'p'  NB. would repeat above 2 plots, and 
simpler below (but this line works for any number of items in stocklist)


  plot each UALp ; DALp



The wow punchline is that only stocklist need be changed to get specific whole 
new variables, and stocklist can be very long.

----- Original Message -----
From: Joe Bogner <joebog...@gmail.com>
To: programm...@jsoftware.com
Cc: 
Sent: Monday, February 17, 2014 3:25:39 PM
Subject: Re: [Jprogramming] J in 5 minutes

On Mon, Feb 17, 2014 at 3:21 PM, Pascal Jasmin <godspiral2...@yahoo.ca>wrote:

> If you post your script file, I'd be happy to suggest lines for the
> console.
>
>
Hi Pascal, I posted it to chat:
http://jsoftware.com/pipermail/chat/2014-February/005702.html

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm


----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to