appendForPrediction
Syntax
appendForPrediction(engine, data)
Arguments
engine is a string indicating the name of the yield curve engine or the engine
object returned by createYieldCurveEngine
.
data is a table object containing data to be predicted. Its schema must match
the predictDummyTable parameter specified in
createYieldCurveEngine
.
Details
Append data to the predictDummyTable of a yield curve engine
(createYieldCurveEngine
) for prediction.
Examples
Create a yield curve engine.
dummyTable = table(1:0, `symbol`sendingtime`askDirtyPrice1`bidDirtyPrice1`midDirtyPirce1`askyield1`bidyield1`midyield1`timetoMaturity`assetType`datasource`clearRate,
[SYMBOL, TIMESTAMP,DECIMAL32(3),DECIMAL32(3),DECIMAL32(3),DECIMAL32(3),DECIMAL32(3),DECIMAL32(3),DOUBLE,INT,INT,STRING])
assetType=[0,1,2]
fitMethod=[<piecewiseLinFit(timetoMaturity, midyield1, 10)>,
<nss(timetoMaturity,bidyield1,"ns")>,
<piecewiseLinFit(timetoMaturity, askyield1, 5)>]
modelOutput=table(1:0, `time`assetType`dataSource`clearRate`model,
[TIMESTAMP,INT,INT,SYMBOL,BLOB])
predictOutput=table(1:0, `time`assetType`dataSource`clearRate`x`y,[TIMESTAMP,INT,INT,SYMBOL,DOUBLE,DOUBLE])
engine = createYieldCurveEngine(name="test", dummyTable=dummyTable,assetType=assetType,fitMethod=fitMethod,
keyColumn=`assetType`dataSource`clearRate, modelOutput=modelOutput,
frequency=10,predictInputColumn=`timetoMaturity,predictTimeColumn=`sendingtime,
predictOutput=predictOutput,fitAfterPredict=false)
data = table(take(`a`b`c, 30) as symbol, take(now(), 30) as time, decimal32(rand(10.0, 30),3) as p1, decimal32(rand(10.0, 30),3) as p2, decimal32(rand(10.0, 30),3) as p3, decimal32(rand(10.0, 30),3) as p4, decimal32(rand(10.0, 30),3) as p5, decimal32(rand(10.0, 30),3) as p6, (rand(10.0, 30)+10).sort() as timetoMaturity, take(0 1 2, 30) as assetType, take([1], 30) as datasource, take("1", 30) as clearRate)
engine.append!(data)
Use the appendForPrediction
function to add data to the
predictOutput table and retrieve the prediction results.
data = table(take(`a`b`c, 30) as symbol, take(now(), 30) as time, decimal32(rand(10.0, 30),3) as p1, decimal32(rand(10.0, 30),3) as p2, decimal32(rand(10.0, 30),3) as p3, decimal32(rand(10.0, 30),3) as p4, decimal32(rand(10.0, 30),3) as p5, decimal32(rand(10.0, 30),3) as p6, (rand(10.0, 30)+10).sort() as timetoMaturity, take(0 1 2, 30) as assetType, take([1], 30) as datasource, take("1", 30) as clearRate)
appendForPrediction(engine, data)
//Output: 30
Related Function: createYieldCurveEngine