Live Trading

Notifications

Introduction

Set up some live trading notifications so that you are notified of market events and your algorithm's performance. We support email, SMS, webhooks, and Telegram notifications. If you set up notifications in the deployment wizard, we will notify you when your algorithm places orders or emits insights. To be notified at other moments in your algorithm, create notifications in your code files with the NotificationManager. Lean ignores notifications during backtests.

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. These notifications are rate-limited to 20 messages per hour. If you exceed the limit, each additional email notification costs 10 QuantConnect Credit (QCC).

Set Up in the Deployment Wizard

Follow these steps to set up email notifications in the deployment wizard:

  1. On the Deploy Live page, enable at least one of the notification types.
  2. The following table shows the supported notification types:

    Notification TypeDescription
    Order EventsNotifications for when the algorithm receives OrderEvent objects
    InsightsNotifications for when the algorithm emits Insight objects
  3. Click Email.
  4. Enter an email address.
  5. Enter a subject.
  6. Click Add.
  7. To add more email notifications, click Add Notification and then continue from step 2.

Send In Your Code Files

To send email notifications in your code files, run:

Notify.Email(emailAddress, subject, body, attachment, headers);
self.Notify.Email(email_address, subject, body, attachment, headers)

SMS

SMS notifications are the only type of notification that you don't need an internet connection to receive. These notifications are rate-limited to 20 messages per hour. If you exceed the limit, each additional SMS notification costs 5 QCC.

Set Up in the Deployment Wizard

Follow these steps to set up SMS notifications in the deployment wizard:

  1. On the Deploy Live page, enable at least one of the notification types.
  2. The following table shows the supported notification types:

    Notification TypeDescription
    Order EventsNotifications for when the algorithm receives OrderEvent objects
    InsightsNotifications for when the algorithm emits Insight objects
  3. Click SMS.
  4. Enter a phone number.
  5. Click Add.
  6. To add more SMS notifications, click Add Notification and then continue from step 2.

Send In Your Code Files

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. These notifications are rate-limited to 20 requests per hour. If you exceed the limit, each additional webhook notification costs 5 QCC.

Set Up in the Deployment Wizard

Follow these steps to set up webhook notifications in the deployment wizard:

  1. On the Deploy Live page, enable at least one of the notification types.
  2. The following table shows the supported notification types:

    Notification TypeDescription
    Order EventsNotifications for when the algorithm receives OrderEvent objects
    InsightsNotifications for when the algorithm emits Insight objects
  3. Click Webhook.
  4. Enter a URL.
  5. If you want to add header information, click Add Header and then enter a key and value.
  6. Repeat this step to add multiple header keys and values.

  7. Click Add.
  8. To add more webhook notifications, click Add Notification and then continue from step 2.

Send In Your Code Files

To send webhook notifications in your code files, run:

Notify.Web(url, payload, headers);
self.Notify.Web(url, payload, headers)

Telegram

Telegram notifications are automated messages to a Telegram group. These notifications are rate-limited to 20 requests per 30 minutes. If you exceed the limit, each additional Telegram notification costs 5 QCC.

Set Up in the Deployment Wizard

Follow these steps to set up Telegram notifications in the deployment wizard:

  1. On the Deploy Live page, enable at least one of the notification types.
  2. The following table shows the supported notification types:

    Notification TypeDescription
    Order EventsNotifications for when the algorithm receives OrderEvent objects
    InsightsNotifications for when the algorithm emits Insight objects
  3. Create a new Telegram group.
  4. Add a bot to your Telegram group.
  5. If you want to use our bot, the username is @quantconnect_notifications_bot.

  6. On the live deployment wizard, click Telegram.
  7. Enter your user Id or group Id.
  8. 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.

  9. If you are not using our notification bot, enter the token of your bot.
  10. Click Add.
  11. To add more Telegram notifications, click Add Notification and then continue from step 2.

Send In Your Code Files

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 user Id or 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.

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: