1

我有一张交易表Trades

TradeID Stock   Timestamp
1       GOOG    2014.03.03 09:13:59.054
2       GOOG    2014.03.03 09:28:12.003
3       GOOG    2014.03.03 09:28:18.199
4       GOOG    2014.03.03 09:52:03.628
5       GOOG    2014.03.03 11:18:52.629
...

还有一个价格变动数据表Prices

Stock   Timestamp               Bid         Ask
GOOG    2014.03.03 08:02:34.297 102.21      102.41
GOOG    2014.03.03 08:02:40.118 102.32      102.42
GOOG    2014.03.03 08:02:44.090 102.33      102.43
GOOG    2014.03.03 08:03:20.197 102.34      102.44
GOOG    2014.03.03 08:05:09.325 102.35      102.45
...

当我进行asof加入时...

aj[
    `Stock`Timestamp;
    Trades;
    update TimestampPrice:Timestamp from Prices  / let's me track which price gets joined
]

...我得到错误的结果:

TradeID Stock   Timestamp                TimestampPrice             Bid     Ask
1       GOOG    2014.03.03 09:13:59.054  2014.03.03 08:05:09.325    102.35  102.45
2       GOOG    2014.03.03 09:28:12.003  2014.03.03 08:05:09.325    102.35  102.45
3       GOOG    2014.03.03 09:28:18.199  2014.03.03 08:05:09.325    102.35  102.45
4       GOOG    2014.03.03 09:52:03.628  2014.03.03 08:05:09.325    102.35  102.45
5       GOOG    2014.03.03 11:18:52.629  2014.03.03 10:31:45.043    102.24  102.35
6       GOOG    2014.03.03 11:33:52.021  2014.03.03 10:31:45.043    102.24  102.35

Timestamp显示交易时间,同时TimestampPrice显示加入的价格数据的时间戳。尽管价格数据大约每 30 秒跳动一次,但连接价格的结果aj距离实际交易还有几个小时!例如,TradeID=1交易价格为 ,09:13:59但加入价格为08:05:09

TimestampPrice另外,join突然从08:05:09to跳转,我觉得很奇怪10:31:45

我已经手动检查了数据中没有可以解释这一点的空白。

可能出了什么问题?

4

1 回答 1

0

In addition, also make sure the Timestamp column is sorted as aj assumes it is

– user2393012 Apr 9 at 8:47

于 2014-04-17T06:56:19.733 回答