2017.02.12 01:55 AM
url:"http://download.finance.yahoo.com/d/quotes.csv?s=FTR+CTL+LVLT+T+VZ&f=sr"
a:.Q.hg`$url
a1:"s,pe\n",a
t:("SS";enlist",")0:a1
q)t
s pe
----------
FTR N/A
CTL 14.43
LVLT 5.58
T 19.70
VZ 15.26
q)url:"http://download.finance.yahoo.com/d/quotes.csv?s=FTR+CTL+LVLT+T+VZ&f=sr"
q)a:.Q.hq`:url
q)a
"\"FTR\",N/A\n\"CTL\",14.43\n\"LVLT\",5.58\n\"T\",19.70\n\"VZ\",15.26\n"
q)b:"\n" vs a / return list of strings (delimited by \n)
q)b
"\"FTR\",N/A"
"\"CTL\",14.43"
"\"LVLT\",5.58"
"\"T\",19.70"
"\"VZ\",15.26"
""
q)c:-1_b / drop the last empty string
q)c
"\"FTR\",N/A"
"\"CTL\",14.43"
"\"LVLT\",5.58"
"\"T\",19.70"
"\"VZ\",15.26"
q)d:{ssr[x;"\"";""]} each c / remove "
q)d
"FTR,N/A"
"CTL,14.43"
"LVLT,5.58"
"T,19.70"
"VZ,15.26"
q)e:{ssr[x;"N/A";"0"]} each d / remove N/A
q)e
"FTR,0"
"CTL,14.43"
"LVLT,5.58"
"T,19.70"
"VZ,15.26
q)f:{"," vs x} each e
q)f
"FTR" ,"0"
"CTL" "14.43"
"LVLT" "5.58"
,"T" "19.70"
"VZ" "15.26"
q)g:{"S"$x} each f
q)g
FTR 0
CTL 14.43
LVLT 5.58
T 19.70
VZ 15.26
q)h:flip g
q)h
FTR CTL LVLT T VZ
0 14.43 5.58 19.70 15.26
q)t:flip `s`pe!(h 0 ; h 1)
q)t
s pe
----------
FTR 0
CTL 14.43
LVLT 5.58
T 19.70
VZ 15.26
2017.02.12 04:43 AM
2017.02.13 01:57 AM
EMEA
Tel: +44 (0)28 3025 2242
AMERICAS
Tel: +1 (212) 447 6700
APAC
Tel: +61 (0)2 9236 5700
KX. All Rights Reserved.
KX and kdb+ are registered trademarks of KX Systems, Inc., a subsidiary of FD Technologies plc.