Hi there,
I got an error when uploading a function (saved in a q file) with the code below to my instance on the remote server.
code to load my function:
\l /home/xygai/filter.q
the error i got from Qpad output window:
(Roundtrip: 093ms)
ERROR: '{
(opening { without matching closing } )
However, it works fine if I select all the code of the function and run it, after which my function show up under the function tree in the Namespace window.
the code below is my function saved in a q file.
getdates:{[T0;T1;product;t_open;bm_close;other_close;minutes;mult]
t0: select open: first price% mult by sym, date from trade where date within (T0;T1), sym in 1_ product, utc_datetime.time>=t_open;
t00: select close: last price% mult by sym, date from trade where date within (T0;T1), sym in 1_ product, utc_datetime.time<other_close ;
t000: select px: first price% mult by sym, date from trade where date within (T0;T1), sym in 1_ product, utc_datetime.time>=t_open+ minutes* “t”$60*1e3;
t1: t0 lj t00 lj t000;
tb0: select open: first price% mult by sym, date from trade where date within (T0;T1), sym = first product, utc_datetime.time>=t_open;
tb00: select close: last price% mult by sym, date from trade where date within (T0;T1), sym = first product, utc_datetime.time<bm_close ;
tb000: select px: first price% mult by sym, date from trade where date within (T0;T1), sym =first product, utc_datetime.time>=t_open+ minutes* “t”$60*1e3;
tb1: tb0 lj tb00 lj tb000;
t2: tb1 upsert t1;
t3: update pre_close: -1_(0N,close) by sym from t2;
t4: update gap: open - pre_close, pct_gap: (open - pre_close)%pre_close, px_open: px-open, pt_px_open:(px-open)%open from t3 ;
t5: delete from t4 where null gap;
dt: exec date from t5 where sym = first product, (abs pct_gap)<0.006;
t6: delete from t5 where date in dt;
final:(date,
sym,2_ cols t6) xcols 0! `date xasc t6};
I believe it is something related with format, as I could call it and get proper result. Could someone explain to me why this happen and how could I solve it? Any help or advice is sincerely appreciated!
Thanks,
Xinyu