When using createDailyTimeSeriesEngine it does not align to session begin.
For example, if sessionBegin is 09:15:00 and windowSize is 30 min, first candle time starts from 09:15:00. But in createDailyTimeSeriesEngine time starts from 09:00:00 which is not correct.
In this example code given below, I created a DailyTimeSeriesEngine with 30 min windowSize and sessionBegin at 09:15:00 which outputs first candle at 09:00:00 which is not true.
But when using dailyAlignedBar(ts, 09:15:00, 60*30) it gives correct results.
I am using version 2.00.3 released on 22-11-2021
Please solve this problem as soon as possible.
code:-
share streamTable(1000:0, `ts`sym`volume, [DATETIME, SYMBOL, INT]) as trades
output1 = table(10000:0, `time`sym`sumVolume, [DATETIME, SYMBOL, INT])
agg1 = createDailyTimeSeriesEngine(name="agg1", windowSize=60*30, step=60*30, metrics=<[sum(volume)]>, dummyTable=trades, outputTable=output1, timeColumn=`ts, useSystemTime=false, keyColumn=`sym, garbageSize=50, useWindowStartTime=true, sessionBegin=09:15:00, sessionEnd=15:30:00, mergeSessionEnd=true)
subscribeTable(tableName="trades", actionName="agg1", offset=0, handler=append!{agg1}, msgAsTable=true);
insert into trades values(2018.10.08T09:15:02,`A,26)
insert into trades values(2018.10.08T09:30:02,`A,26)
insert into trades values(2018.10.08T09:30:10,`B,14)
insert into trades values(2018.10.08T11:29:46,`A,30)
insert into trades values(2018.10.08T11:29:50,`B,11)
insert into trades values(2018.10.08T11:30:00,`A,14)
insert into trades values(2018.10.08T11:30:00,`B,4)
insert into trades values(2018.10.08T13:00:10,`A,16)
insert into trades values(2018.10.08T13:00:12,`B,9)
insert into trades values(2018.10.08T14:59:56,`A,20)
insert into trades values(2018.10.08T14:59:58,`B,20)
insert into trades values(2018.10.08T15:00:00,`A,10)
insert into trades values(2018.10.08T15:00:00,`B,29)
select * from output1 //gives incorrect results as time wont align to sessionBegin 09:15:00
select sum(volume) from trades group by sym,dailyAlignedBar(ts, 09:15:00, 60*30) as k30 //gives correct results as time wont align to sessionBegin 09:15:00
Results from DailyTimeSeriesEngine: (As you can see time of first candle is 09:00:00 but it should be start at 09:15:00)
time sym sumVolume
2018.10.08T09:00:00 A 26
2018.10.08T09:30:00 A 26
2018.10.08T09:30:00 B 14
2018.10.08T11:00:00 A 30
2018.10.08T11:00:00 B 11
2018.10.08T11:30:00 A 14
2018.10.08T11:30:00 B 4
2018.10.08T13:00:00 A 16
2018.10.08T13:00:00 B 9
2018.10.08T14:30:00 A 20
2018.10.08T14:30:00 B 20
Results from dailyAlignedBar: (Correct Results. As you can see the first candle starts from 09:15:00 which is correct.)
sym k30 sum_volume
A 2018.10.08T09:15:00 52
B 2018.10.08T09:15:00 14
A 2018.10.08T11:15:00 44
B 2018.10.08T11:15:00 15
A 2018.10.08T12:45:00 16
B 2018.10.08T12:45:00 9
A 2018.10.08T14:45:00 30
B 2018.10.08T14:45:00 49
please refer https://ask.dolphindb.net/question/1140 for updates and / or solutions