Some verb versions for the other data you were presenting:
Y =: 4 {. each 0&{"1
gB =: (~.@:] i. ]) (,/.) [
YG =: Prices gB Y
MPY =: [: >./"1 YG
minPY =:([: <./ ] #~ 0<])"1@:YG
YK =: [: ".@:>@:~. Y
plot &> (YK;MPY) each ". each stocklist , each 'd' NB. Plots maximum by year
for each ticker
plot &> (YK; minPY) each ". each stocklist , each 'd'NB. Plots minimum by year
for each ticker
----- Original Message -----
From: Pascal Jasmin <[email protected]>
To: "[email protected]" <[email protected]>
Cc:
Sent: Monday, February 17, 2014 6:45:14 PM
Subject: Re: [Jprogramming] J in 5 minutes
An update to the "doall verb"
setVarsandPlot =: 3 : 0 NB. y is a stocklist
y (assign quote) ^: ([: -. isAssign@:]) each y NB. will only download if
variable not already defined
(y ,each 'd') assign each ([: |. }.)@: ". each y
(y ,each 'p') assign each Prices@:". each y ,each 'd'
plot each ". each y ,each 'p'
y ; &> (<./ ; >./) each ". each y ,each 'p'
)
where
isAssign =: _1 < 4!:0@<
The above will avoid redownloading data for those tickers that have already
been defined. So.
setVarsandPlot 'MSFT' ; stocklist
will only download MSFT, but plot all 3. This is useful for both being quicker
and not having yahoo block you :P
----- Original Message -----
From: Pascal Jasmin <[email protected]>
To: "[email protected]" <[email protected]>
Cc:
Sent: Monday, February 17, 2014 5:45:55 PM
Subject: Re: [Jprogramming] J in 5 minutes
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 <[email protected]>
To: "[email protected]" <[email protected]>
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 <[email protected]>
To: "[email protected]" <[email protected]>
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 <[email protected]>
To: [email protected]
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 <[email protected]>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
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm