我有两张桌子,
FILLORDERACK
NBBO_20181001
.
FILLORDERACK
BIDPX, OFFERPX, TRANSACTTIME, TRADEDATE, SYMBOL
NBBO_20181001
包含以下列:
BID, ASK, SYMBOL, TS
中的数据
是以毫秒为间隔的数百万个股票买卖价格记录。
我的查询目前做什么?它使用一个符号并计算交易后1000毫秒的价格标记:
FILLORDERACK
TS
从…起
NBBO_20181001
t2.symbol = 'F'
.
我不确定如何将我的查询附加到
F
从…起
select (((t2.BIDPX + t2.OFFERPX) / 2) / ((t1.BID + t1.ASK) / 2)) - 1, t2.TRANSACTTIME
from NBBO_20181001 t1, FILLORDERACK t2
where t2.symbol = 'F' and t1.symbol = t2.symbol and t2.TRADEDATE = '20181001'
and t1.TS between t2.TRANSACTTIME and TIMESTAMPADD(SQL_TSI_ms, 1000, (t2.TRANSACTTIME))
order by t1.TS desc limit 1