I have two lists:
data:
dt sym bid ask
2017.01.01D05:00:09.140745000 AAPL 101.20 101.30
2017.01.01D05:00:09.284281800 GOOG 801.00 802.00
2017.01.02D05:00:09.824847299 AAPL 101.30 101.40
info:
date sym shares divisor
2017.01.01 AAPL 500 2
2017.01.01 GOOG 100 1
2017.01.02 AAPL 200 2
I need to append from "info" the shares and divisor values for each ticker based on the date. How can I achieve this? Below is an example:
result:
dt sym bid ask shares divisor
2017.01.01D05:00:09.140745000 AAPL 101.20 101.30 500 2
2017.01.01D05:00:09.284281800 GOOG 801.00 802.00 100 1
2017.01.02D05:00:09.824847299 AAPL 101.30 101.40 200 2
It might be useful for you to use the stepped attribute [ http://code.kx.com/q/cookbook/temporal-data/#stepped-attribute ]
This will allow you to have e.g. missing dates from the
info
table and use the "most recent" date instead (so you don't have to have data for every sym every day). For example, without stepped attribute:Note the nulls for
GOOG
on2017.01.02
. With stepped attribute:Here,
GOOG
gets the values for2017.01.01
as there is no new value on2017.01.02
If matching based on an exact date match then you can use
lj
. For this to work you will need to create a date column in thedata
table and keyinfo
bydate
andsym
. Like so:You can then delete the
date
column from this output.Could possibly use an aj as well.