warmupStreamEngine
Syntax
warmupStreamEngine(engine, msgs)
Arguments
engine is the table object returned from creating a stream engine.
msgs is a table indicating the warm-up data.
Details
Ingest warm-up data into a stream engine without outputting calculation results while the intermediate state is preserved. When the next batch of data is ingested, the calculation can be performed based on the intermediate state.
Currently it only supports the reactive state engine, and (daily) time series engine.
Examples
The following example shows the effect on calculation results using
warmupStreamEngine. Create two identical reactive state
engines. The engineA is injected with warm-up data, while the engineB is not.
// simulate data
trade=table(1000:0, `date`sym`price`volume, [DATE, SYMBOL, DOUBLE, INT])
n=3000*100
date=take(2021.03.08, n)
sym=take("A"+string(1..3000), n)
price=round(rand(100.0, n), 2)
volume=rand(100, n)
table1 = table(date, sym, price, volume)
outputTableA = table(n:0, `sym`factor1, [STRING,DOUBLE])
outputTableB = table(n:0, `sym`factor1, [STRING,DOUBLE])
// create stream engines and write data
dropStreamEngine("test1")
dropStreamEngine("test2")
engineA = createReactiveStateEngine("test1", <ema(volume, 40)>, table1, outputTableA, "sym")
engineB = createReactiveStateEngine("test2", <ema(volume, 40)>, table1, outputTableB, "sym")
warmupStreamEngine(engineA, table1) // warm up using warmupStreamEngine
// write new data to both engines
date=take(2021.03.09, n)
sym=take("A"+string(1..3000), n)
price=round(rand(100.0, n), 2)
volume=rand(100, n)
table2 = table(date, sym, price, volume)
engineA.append!(table2)
engineB.append!(table2)
outputTableA:
outputTableB:
By using warmupStreamEngine to ingest warm‑up data into engineA,
subsequent calculations are based on the intermediate state from the warm‑up phase.
Consequently, outputTableA returns non‑null data starting from the first row. Since
the window size is 40, outputTableB returns null for the first 39 groups, and
non‑null data starts from row 11,7001.
