Some algos work time can be limited with duration parameters which are listed in the table below:
Name |
Tag number |
Format |
Comment |
StartTime |
8151 |
Time after which the algo will begin execution. No slices will be released before this time. Replaced with ‘Now’ acquired by CQG Algo Engine when this parameter is in the past or not present. Unless stated otherwise, can be updated to different value before algo execution has started; value change is ignored after algo start. Default – Now. | |
EndTime |
8152 |
Time that, when set, represents the Computed End Time. Cannot be specified together with MaxDurationInMinutes. Automatically replaced with order’s symbol specific end of trading day when set to time after trading day end. Default: symbol specific end of trading day. | |
MaxDurationInMinutes |
9030 |
Float |
If set, this value is added to StartTime to yield the Computed End Time. At the Computed End Time, all slices in the market will be paid up. Non-working size will be cancelled. MaxDurationInMinutes cannot be specified together with End Time. If neither this value, nor End Time are set, the Computed End Time will default to order’s symbol specific end of trading day. Computed End Time will be set to order’s symbol specific end of trading day the when StartTime + MaxDurationInMinutes is after trading day end. |
When none of duration parameters are specified CQG Algo Engine will start algo execution immediately with order execution end time set to symbol specific trading day end.
By the algo end time all working slices will be paid up. Non-working size will be cancelled.
There is a 15 second allowance period for algo order to complete execution of all paid up slices. After that period is elapsed all non-executed working slices will be cancelled.
Algos which have duration parameters:
After algo duration rules is applied on algo order initialization CQG Algo Engine tries to apply trading session schedule to algo's start and end time. In result algo start and end times may change additionally and algo orders will be launching children only when session is open.
By ‘session gap’ below a pause between two current trading day’s sessions is meant. CBOT-G Corn is an example of commodity which has session gaps.
Start and end time adjustment to a session schedule follows next rules:
• If start/end time belong to trading times of single or multiple current trading day sessions from a schedule they are not changed.
If algo needs to work until particular moment of time End Time parameter shall be used instead of Max Duration In Minutes.
• If Start Time equals to session close time or falls into a session gap it is moved to the start of next session if end time allows it.
• If End Time is equal to some session open time or falls into a session gap before next session open end time is moved to the end of previous session - <some additional delta> if Start Time allows it.
• If Start Time is adjusted and algo End Time was specified with Max Duration In Minutes, new End Time will be calculated from the adjusted Start Time and that End Time will be adjusted according to session schedule - in this case algo starts execution later and works for its Max Duration On Minutes.
<some additional delta> from above is CQG Algo Engine specific value which is 500 milliseconds by default. This delta allows to reduce probability to send child order close to algo End Time which may result in reject from destination Exchange because child order reaches it after trading session close.
Let’s consider an example.
All times will be in UTC time zone.
An order is placed on ZCE Futures (CBOT-G Corn in CQG Symbology) at some point during Globex Night session with duration which covers the rest of night session and takes a part of day session.
For example, let it be a CQG TWAP order placed with time part of Start Time set to 12:30:00 and End Time to 13:45:00 or with same start time but with 75 minutes of Max Duration In Minutes. Order is expected to be executed like this: order works until session gap, then takes a pause for the duration of gap, then continues to execute when gap is over and new session opens.