q)c
`time`sym`src`price`amount`side
q)p:();i:0;.Q.fs[{[x] `p insert $[i=0;1_;::] flip c!"TSSFFS"$flip "," vs' x;i+:1};`:trade.csv]
1494745
q)meta p
c | t f a
------| -----
time | t
sym | s
src | s
price | f
amount| f
side | s
q)
q)count p
40000
q)\wc -l trade.csv
" 40001 trade.csv"
q)
/With error trapping (around the main function) that will exit the routine as soon as it sees an issue without attempting to carry on.
q)p:();i:0;.[.Q.fs;({[x]if[i=10;'`oops]; `p insert $[i=0;1_;::] flip c!"TSSFFS"$flip "," vs' x;i+:1};`:trade.csv);{[x] show "error stopping"}]
"error stopping"
q)count p
346
q)i
10
q)/Note error trapping could be added to the first argument of .Q.fs if you still wished to processes the rest of the file, assuming one chunk had issues.
Regards,
Connor