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 systemd. 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

Leave a Reply

Continue reading

More from the archive

Article Dec 3, 2024 1 min read

YouTube Videos to MP3 and Transcription

I find myself listening to videos on YouTube quite frequently where it would be nice to dump them into an MP3 and take them on the road. This…

Article Sep 24, 2024 40 min read

Analyzing Any Polymarket User’s Trades Using Polygon

Polymarket.com, a prediction market platform, operates on the Ethereum blockchain through the Polygon network, making it possible to analyze user transactions directly from the blockchain. By accessing a…

error

Follow for updates!