2022.03.17 02:50 AM
end:{(neg union/[w[;;0]])@\:(`.u.end;x)}
I know the following:
1) that union/[w[;;0]]) is grabbing the handles as integers picking the ones which are repeated.
2) Neg obviously makes these negative for async.
3) The apply each left then applies that to the list union/[w[;;0]])
4) the x is usually a date?
What is this actually doing, and what is the significance of x as the date?
2022.03.17 03:25 AM - edited 2022.03.17 03:26 AM
Hi,
1-3) Correct.
4) yes this is a date, you will notice end is called from endofday function in tick.q, which is called when the date rolls, checked on the timer.
endofday:{end d;d+:1;if[l;hclose l;l::0(`.u.ld;d)]};
Where d is the current date the tp is running.
.u.end will be an EOD function on the subscriber, commonly an RDB… an example below from r.q:
/ end of day: save, clear, hdb reload
.u.end:{t:tables`.;t@:where `g=attr each t@\:`sym;.Q.hdpf[`$":",.u.x 1;`:.;x;`sym];@[;`sym;`g#] each t;}
Hope that helps.
Patrick
2022.03.22 06:21 PM
Hi,
Here is another example:
/end of day function - triggered by tickerplant at EOD
.u.end:{
hclose LogfileHandle; /close the connection to the old log file
/create the new logfile
logfile::hsym `$"RealTimeTradeWithAsofQuotes_",string .z.D;
.[logfile;();:;()]; /Initialise the new log file
LogfileHandle::hopen logfile;
{delete from x}each tables `.};
Hope this helps.
2022.03.17 03:25 AM - edited 2022.03.17 03:26 AM
Hi,
1-3) Correct.
4) yes this is a date, you will notice end is called from endofday function in tick.q, which is called when the date rolls, checked on the timer.
endofday:{end d;d+:1;if[l;hclose l;l::0(`.u.ld;d)]};
Where d is the current date the tp is running.
.u.end will be an EOD function on the subscriber, commonly an RDB… an example below from r.q:
/ end of day: save, clear, hdb reload
.u.end:{t:tables`.;t@:where `g=attr each t@\:`sym;.Q.hdpf[`$":",.u.x 1;`:.;x;`sym];@[;`sym;`g#] each t;}
Hope that helps.
Patrick
2022.03.22 06:21 PM
Hi,
Here is another example:
/end of day function - triggered by tickerplant at EOD
.u.end:{
hclose LogfileHandle; /close the connection to the old log file
/create the new logfile
logfile::hsym `$"RealTimeTradeWithAsofQuotes_",string .z.D;
.[logfile;();:;()]; /Initialise the new log file
LogfileHandle::hopen logfile;
{delete from x}each tables `.};
Hope this helps.
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.