Tactical
Daily Telegram status for a Python bot
You should not log into the exchange to see if the process is still alive. A dull 08:00 ping is enough. A green percent is not the product.
This is a health ping. It is not a P&L dashboard and not financial advice. Paper-trade has no real profit. Trading can lose money.
What the message should look like
openclaw 08:00 UTC dry_run=true halt=absent loss 0.00 / 10.00 last scan 07:55 71 markets open orders: 0 unit=active errors since midnight: 0
If dry_run flipped, halt appeared, unit is dead, or open orders do not match what you think you have — that is the ping that matters. Not “Daily PnL: +2.5%.”
What to collect
- systemctl is-active openclaw (or equivalent).
- DRY_RUN from the same env the service uses.
- HALT file exists or not.
- Daily loss vs limit (your kill-switch counters).
- Last successful scan line from the log or an in-process timestamp.
- Count of open orders on the venue (empty + a position = problem).
Optional later: fill count and fees if you are live. Put that last. Never as the title or the thumbnail.
Send the ping
import os, json, urllib.request, urllib.parse
def telegram(text: str) -> None:
token = os.environ["TELEGRAM_BOT_TOKEN"]
chat = os.environ["TELEGRAM_CHAT_ID"]
url = f"https://api.telegram.org/bot{token}/sendMessage"
body = urllib.parse.urlencode({"chat_id": chat, "text": text}).encode()
urllib.request.urlopen(url, data=body, timeout=15)
Same token and chat as your fill/fail alerts. If this curl fails, fix Telegram first — do not add a timer on a silent bot.
Trigger: systemd timer, not while True
Do not start a second infinite loop. The bot already has a scan loop. A timer unit runs the status script at 08:00 UTC and exits.
# /etc/systemd/system/openclaw-status.service [Unit] Description=OpenClaw morning status After=network-online.target [Service] Type=oneshot User=YOURUSER WorkingDirectory=/home/YOURUSER/bots/openclaw EnvironmentFile=/home/YOURUSER/bots/openclaw/.env ExecStart=/home/YOURUSER/bots/openclaw/.venv/bin/python status.py # /etc/systemd/system/openclaw-status.timer [Unit] Description=OpenClaw morning status timer [Timer] OnCalendar=*-*-* 08:00:00 Persistent=true Unit=openclaw-status.service [Install] WantedBy=timers.target
sudo systemctl daemon-reload sudo systemctl enable --now openclaw-status.timer systemctl list-timers | grep openclaw
Optional: /status on demand
If you already poll getUpdates, reply to /status with the same payload as 08:00. Do not add a webhook and a second process until the timer ping is boring for a week.
Do not
- Lead with a daily percent.
- Alert every scan interval — you will mute the chat.
- Query the exchange from your phone app instead of this ping (that is extra login surface).
- Enable live orders because a status ping looks “healthy.”
If Telegram is silent, fix that first: /guides/telegram-not-sending. systemd itself: /guides/systemd-journalctl.
Get the full walkthrough
The paid guide includes the source, config template, and deploy script. 50% off: $19.99 (was $39.99). One-time.
Get the ebook — $19.99Educational product. Trading can lose money. Not financial advice.