When I send myself an email using sell.Notify.Email, the entire email appears as a single line email even though I have separated the lines using \r\n. The same text appears fine in a log file. Here is an example:
Here is how it appears in my email:
Canceling all open orders if any as it is time for fresh calculations bull signal bearish = False bond signal up = True latestVIX 17.02 9 day VIX SMA 16.64857142857143 5 day VIX SMA 16.353333333333335 high vola True high vola adjustments are applicable total_margin_use 1.5 bull_market_exposure 1.5 bear_market_exposure 0 total market exposure 1.5 liquidating because it is no longer a part of the universe: SPXU liquidating because it is no longer a part of the universe: TBT liquidating because it is no longer a part of the universe: UPRO liquidating because it is no longer a part of the universe: TTT liquidating because it is no longer a part of the universe: TMV liquidating because it is no longer a part of the universe: UBT Balancing/fresh orders for TQQQ with target weight of 0.0, current Quantity: -3908.0 needed
Here is how it appears in the log file:
Canceling all open orders if any as it is time for fresh calculations
bull signal bearish = False
bond signal up = True
latestVIX 17.89
9 day VIX SMA 17.31714285714286
5 day VIX SMA 17.12666666666667
high vola True
high vola adjustments are applicable
total_margin_use 0.8333333333333333
bull_market_exposure 1.5
bear_market_exposure 0
total market exposure 1.5
Balancing/fresh orders for VTV with target weight of 0.25, current Quantity: 0.0 needed Quantity(estimated): 177
---
The emails were formatted correctly but after I made some updates, it started ignoring the line breaks. I have following questions:
- Any thoughts/tips on why it is happening?
- Is there a way to test it without deploying it in a live environment? I believe the API does not take any action during backtesting.
- Is there any support for formatting the email using HTML?
- Can I create a CSV file and email it as an attachment?
Varad Kabade
Hi Manoj Agarwala,
The notification system only works in live mode.We would suggest replacing \r\n for <br> or creating a full HTML document.Alternatively, we can use the following method
The 4th string passed to the method above is parsed into a .txt file and attached to the email.
Best,
Varad Kabade
Manoj Agarwala
Thanks!
Manoj Agarwala
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!