'Failed to retrieve now() from the output table of DolphinDB asof join engine
I'm using the following code to obtain now() from an asof join output table.
share streamTable(70000:0, `datatime`symbol`inserttime`spread`bidasksum`posneg`ma3, [NANOTIMESTAMP, SYMBOL, NANOTIMESTAMP, LONG, STRING, LONG]) as result
result_aje = createAsofJoinEngine(name="aje", leftTable=res_quotes, right_table=res_ohlc, outputTable = result, metrics = <[now(), spread, bidasksum, posneg, ma3]>, matchingColumn=`symbol, timeColumn=`datetime, delayedTime=1)
subscribeTable(tableName="res_quotes", actionName="joinLeft", offset=0, handler=appendForJoin{result_aje, true}, msgAsTable=true)
subscribeTable(tableName="res_ohlc", actionName="joinRight", offset=0, handler=appendForJoin{result_aje, false}, msgAsTable=true)
I got the following error, which I am confused about:
Usage: createAsofJoinEngine(name, leftTable, rightTable, outputTavle, metrics, matchingColumn, [timeColumn], [useSystemTime=false], [delayedTime], [garbageSize]). aggregate metric is not supported.
Can anyone share some insight on this? Thank you!
Solution 1:[1]
You can try adding a handler. For example:
def addRecvTimestamp(mutable msg)
{
msg[`recvTimestamp] = take(now(), size(msg))
tbl.append!(msg)
}
subscribeTable(tableName="tbl", actionName="addRecvTimestamp", offset=-1, handler=addRecvTimestamp, msgAsTable=true)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | damie |
