cancel
Showing results for 
Search instead for 
Did you mean: 

What exactly does .u.end do?

Mannix
New Contributor III
New Contributor III

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?

2 ACCEPTED SOLUTIONS

pmallon
New Contributor III
New Contributor III

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

View solution in original post

ghe
New Contributor
New Contributor

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.

View solution in original post

2 REPLIES 2

pmallon
New Contributor III
New Contributor III

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

ghe
New Contributor
New Contributor

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.