In DolphinDB, the asof join returns the latest record before the given time in the right table. Is there a function that is similar to aj, but returns all previous records before the given date and forms a new table?
I have the following two tables, tb1 and tb2. In tb2, each value in the date column is the first day of a month, and each target (A, B and C) has multiple sources.
My expected process is:
In the tb2, find the records of which the target value matches S_INFO_WINDCODE of tb1 before the corresponding TRADE_DT date;
Join all records with table tb1 to form a new table.
I have simulated some data using the following script:
First, we define a function
fto select all records before TRADE_DT from table tb2. Then generate a new table by joining the results and tb1 withcj (cross join).Use the function
fwith higher-order functionpeachto process all records in parallel: