Live Trading

Notifications

Introduction

Set up some live trading notifications so that you are notified of market events and your algorithm's performance. QuantConnect Cloud supports email, SMS, webhooks, and Telegram notifications for live trading algorithms. If you run local algorithm with LEAN or the LEAN CLI, the notification services aren't available. To view the number of notification you can send for free in QuantConnect Cloud, see the Live Trading Notification Quotas.

Email

Email notifications can include up to 10KB of text content in the message body. These notifications can be slow since they go through your email provider. If you don't receive an email notification that you're expecting, check your junk folders.

To send email notifications in your code files, run:

Notify.Email(emailAddress, subject, body);
self.notify.email(email_address, subject, body)

You can include an attachment and set its name.

var attachment = "2023-07-13T12:20:00.2033226Z,EURUSD,1.11853,89187,Market,Filled,99758.33511";
var headers = new Dictionary<string, string> { { "filename", "trades.csv" } };
Notify.Email(emailAddress, subject, body, attachment, headers);
attachment = "2023-07-13T12:20:00.2033226Z,EURUSD,1.11853,89187,Market,Filled,99758.33511"
headers = { "filename": "trades.csv" }
self.notify.email(email_address, subject, body, attachment, headers)

If you don't provide headers, the attachment name is attachment.txt.

SMS

SMS notifications are the only type of notification that you don't need an internet connection to receive.

To send SMS notifications in your code files, run:

Notify.Sms(phoneNumber, message);
self.notify.sms(phone_number, message)

Webhooks

Webhook notifications are an HTTP-POST request to a URL you provide. The request is sent with a timeout of 300s. You can process these notifications on your web server however you want. For instance, you can inject the content of the notifications into your server's database or use it to create other notifications on your own server.

To send webhook notifications in your code files, run:

Notify.Web(url, data, headers);
self.notify.web(url, data, headers)

Telegram

Telegram notifications are automated messages to a Telegram group.

To send Telegram notifications in your code files, run:

Notify.Telegram(id, message, token);
self.notify.telegram(id, message, token)

The id argument is your Telegram group Id. Your group Id is in the URL when you open your group chat in the Telegram web interface. For example, the group Id of web.telegram.org/z/#-503016366 is -503016366.

The token optional argument is a token of a bot you must add to your Telegram group. To create a bot, chat with @BotFather and follow its instructions. If you want to use our bot, the username is @quantconnect_notifications_bot.

To add emoticons to your message, convert the emoticon character to UTF-32 with the Unicode Converter on the Branah website. For example, the rocket emoji is 0001f680 in UTF-32 format, so use \U001f680 in your message.

Terms of Use

The notification system can't be used for data distribution.

You can also see our Videos. You can also get in touch with us via Discord.

Did you find this page helpful?

Contribute to the documentation: