I have a code in python that needs to be run after every one minute so how do i apply cron job to it in ubuntu?....this code contain kite pakages ....so while setting cron job on local system will i need to install the packages or it will be installed automatically?
You need to install the package else when cron would run your code, you code would just fail
Prefer using virtualenv or conda, instead of directly pip installing
In cron cd into the folder of your program && source activate the environment && then run your program
for per minute and only for weekdays */1 * 1-5 * *
At the same time let me tell you if I were to run something every 1 minute, I would not have run it through cron, instead would have scheduled the function inside the program. So while i answered what you asked, am pretty sure, you are heading in the wrong direction
You can use scheduler module of python. You can schedule from market start hours to market end hour. Cron should inly be used for starting this script daily. Obviously to run the scripts you need to pip install the required dependencies either directly or in virtual environment (venv, conda etc.). But running algo trading scripts rarely use complex nested dependencies so, installing dependencies directly should be good enough.
Prefer using virtualenv or conda, instead of directly pip installing
In cron cd into the folder of your program && source activate the environment && then run your program
for per minute and only for weekdays
*/1 * 1-5 * *
At the same time let me tell you if I were to run something every 1 minute, I would not have run it through cron, instead would have scheduled the function inside the program. So while i answered what you asked, am pretty sure, you are heading in the wrong direction
Obviously to run the scripts you need to pip install the required dependencies either directly or in virtual environment (venv, conda etc.). But running algo trading scripts rarely use complex nested dependencies so, installing dependencies directly should be good enough.