Setting up Python algos to run on Ubuntu startup using systemd

If you’re running your trading algorithms on Linux the best way to get them to start on bootup is to use a service called systems. Here are the steps on setting that up.

Go to:

/etc/systemd/system


Then create a new service as root:



sudo nano trading_algo_23.service


Here is a sample of what the file should look like. You can find your account name by using the command whoami in linux



[Unit]
Description=This algo is designed to hedge...



User=your username
WorkingDirectory=/directory/of/algo
ExecStart=/usr/bin/python3  /directory/of/algo/algo_23.py
Restart=always



[Install]
WantedBy=multi-user.target

Now reload systems

sudo systemctl daemon-reload


Enable the service

sudo systemctl enable

Start your script:

sudo systemctl start trading_algo_23.service


Check the status:

sudo systemctl status trading_algo_23.service

Facebook Comments Box

Leave a Reply