- ago
First of all - WL8 is much faster and responsive. With WL7, SM processing was taking 2-3 secs per intraday bar. Now with WL8, its around 700-900ms. It's great. It has also reduced the time order is placed on TDA side as well.

However, SM still takes 3-4 secs at the 1st bar of the market open. After 1st bar the runtime is back to under 1 sec.


Is there something that could be done to improve runtime for 1st bar? Is it strategy code issue or overall handling of the 1st bar? In the strategy there is no extra code that is executed for 1st bar to cause 3x larger runtime.
CODE:
if (bars.DateTimes[bar].Hour == 9 && bars.DateTimes[bar].Minute == 31) { // reset variables } else { // do something }
0
517
1 Replies

Reply

Bookmark

Sort
Cone8
 ( 25.44% )
- ago
#1
Code-wise, there's no explanation for it. The first run isn't processed in a different way than any other. Probably the difference is a combination of other real time processing on the machine - especially if you're monitoring streams, like in the Quotes tool.

In my run today, you could say I duplicated the observation as my first Run Time was about twice the others, but only about 1 second.

CODE:
4/22/2022 14:08:03: NextRun set to 4/22/2022 14:31 4/22/2022 14:08:03: Status = Idle 4/22/2022 14:31:00: Status = Processing 4/22/2022 14:31:06: Ran Strategy on ZYXI,CELH,GRWG,SNDL,GOOGL,NVDA,MAXR,EGAN,SO,PD,XOM,FSLY,BB: 0 Signals, Run Time=1.04sec 4/22/2022 14:31:50: NextRun set to 4/22/2022 14:32 4/22/2022 14:31:50: Status = Incomplete 4/22/2022 14:31:50: 3 Symbols not Processed: MHTX,IDN,MTBC 4/22/2022 14:32:00: Status = Processing 4/22/2022 14:32:06: Ran Strategy on ZYXI,CELH,GRWG,MTBC,SNDL,GOOGL,MAXR,SO,PD,XOM,FSLY,BB: 0 Signals, Run Time=508ms 4/22/2022 14:32:50: NextRun set to 4/22/2022 14:33 4/22/2022 14:32:50: Status = Incomplete 4/22/2022 14:32:50: 4 Symbols not Processed: MHTX,IDN,EGAN 4/22/2022 14:33:00: Status = Processing 4/22/2022 14:33:06: Ran Strategy on ZYXI,CELH,GRWG,SNDL,GOOGL,NVDA,MAXR,SO,PD,XOM,FSLY,BB: 0 Signals, Run Time=476ms 4/22/2022 14:33:50: NextRun set to 4/22/2022 14:34


The script I test with writes the last bar's data and records the local time. Generally speaking, the TD Ameritrade streaming bar updates about 5 to 7 seconds after the end of interval. I think this trade off for accurate charts (versus Streaming, which will build bars that differ somewhat from historical charts due to conflation) is discussed in the User Guide.
0

Reply

Bookmark

Sort