Using Cron for Scheduling - Printable Version +- Alera Forum (https://aleratrading.com/forum) +-- Forum: Alera Portfolio Manager (https://aleratrading.com/forum/forumdisplay.php?fid=1) +--- Forum: Documentation (https://aleratrading.com/forum/forumdisplay.php?fid=2) +--- Thread: Using Cron for Scheduling (/showthread.php?tid=8) |
Using Cron for Scheduling - admin - 11-09-2018 Cron Scheduling Scheduling your strategies, email notifications, and external programs in APM can be done using the cron (also crontab) syntax. Please refer to this guide for another explanation (and some more advanced uses) of the cron syntax used in APM. You can also find a useful cron converter here. The cron syntax that APM is slightly different than the classic Unix cron syntax: * * * * * * * Some notes about this format:
Special Characters * : means all possible values. For example, putting * for hours would mean every hour. ? : means no value. This is used for conflicting values, such as putting a number for both the day of month and day of week. One of those values must be ? - : is used to specify a range of numbers, i.e. 5-7 for hours would mean at 5,6, and 7am. , : is used to specify a set of numbers, i.e. 5,7 for hours would mean at 5am and at 7am. Here are some example cron schedules: * * * ? * * Runs every second If you are unsure about using cron, we suggest to copy one of the above schedules into APM and modify the second, minute, and/or hour fields to your needs. Note that APM will tell you the schedule your cron string represents if you hover over the Run Strategy text. RE: Using Cron for Scheduling - C0101 - 09-27-2020 Hi, regarding Setting - Strategy - Use External Program and Enable Scheduler, does Alera support sequence setting: first, execute an external program, and then run strategy? if not, how can I use DOS batch file to do it? RE: Using Cron for Scheduling - C0101 - 09-28-2020 further more, could strategy scheduler be trigered by the completion of running exteral program? Work flow: running exteral program - run strategy - running exteral program - run strategy until forever RE: Using Cron for Scheduling - admin - 09-29-2020 (09-28-2020, 11:15 AM)C0101 Wrote: further more, could strategy scheduler be trigered by the completion of running exteral program? Currently, the external program and strategy are run separately. If you know that your external program will take up to 10 minutes to run, then you can set the strategy to run 15 minutes after the external program runs using cron scheduling. If your signals are time sensitive, then I recommend using the Alera API to tell Alera to run the strategy after your external program runs. https://aleratrading.com/forum/showthread.php?tid=89 Once you enable the Alera API, you can add the following to your external program batch file (replace <port> with the Alera API port and <id> with your strategy id) in order to tell Alera to run the strategy curl -X POST -d '' http://localhost:<port>/api/strategies/<id>?cmd=run Note that you may need to tell the batch file to wait for your signal generation exe to complete before telling the Alera API to run your strategy. See https://aleratrading.com/forum/showthread.php?tid=7 Also, if you are using Amibroker, see https://www.systematic-investors.com/sending-your-amibroker-exploration-results-to-alera-apm/ RE: Using Cron for Scheduling - C0101 - 09-29-2020 How to enable API? RE: Using Cron for Scheduling - admin - 09-30-2020 (09-29-2020, 09:56 PM)C0101 Wrote: How to enable API? There is a checkbox in the Account Settings (bottom right of your screen) RE: Using Cron for Scheduling - C0101 - 09-30-2020 it works now. thank you RE: Using Cron for Scheduling - Marcel - 09-16-2021 I found this Cron maker useful at this link here: http://www.cronmaker.com/ RE: Using Cron for Scheduling - Marcel - 12-22-2021 Also I found this website helpful for trying to figure out the correct cron expression: https://www.freeformatter.com/cron-expression-generator-quartz.html I wanted to figure out 06:00 on the 1st day of the month that's a weekday for a monthly system and this works: 0 0 6 1W * ? * RE: Using Cron for Scheduling - admin - 12-27-2021 (12-22-2021, 03:48 PM)Marcel Wrote: Also I found this website helpful for trying to figure out the correct cron expression: Thanks I've added a link to it above. |