Hello,
Can anyone assist understanding why the Portfolio goes to negative when trying to trade some crypto coins with Data of 2018? I have pinpointed one date to April 11. I've seen it happen on several days in 2018 and several coins (including BTC and ETH). Depending on the ammount it can crash the Algorithm Manager if it goes negative but there is always a suden drop in Equity at those days.
This is a Cash account as it's not possible for the value of the account to go to -50.000 (when I only had 10.000)
2018-04-01 00:00:00 : Launching analysis for 14ead841b83ddf5dbedd4644903d64aa with LEAN Engine v2.5.0.0.11340
2018-04-11 06:00:00 : AlgorithmManager.Run(): Portfolio value is less than or equal to zero, stopping algorithm.
2018-04-11 06:00:00 : Algorithm finished, Equity: -43820.24693854894
2018-04-11 06:00:00 : Holdings8950.612288934579
2018-04-11 06:00:00 : Remaining:1022.5000000010655
2018-04-11 06:00:00 : Amount:44842.74693855Price:0.1996Value:8950.61228893458Unrealized:-53712.642282995184
2018-04-11 06:00:00 : Algorithm Id:(14ead841b83ddf5dbedd4644903d64aa) completed in 0.38 seconds at 3k data points per second. Processing total of 1,041 data points.
I believe it could be some curruption on the Data that would be giving a negative Price for the asset but after printing the Price of the Security at the end of the algorithm it's positive and normal, only the Unrealized goes to -50.000
When livetrading with Paper account I have my equity going from 2.500 USD to 1.5 Million on the next bar, then back to 2500. (With similar algorithm, a few days ago, in 2021)
If this would happen to the negative side I guess the Algorithm would fail on the live trade?
I'm not sure if this is a bug that could affect the live trading or not.
Thank you in advance
Derek Melchin
Hi Tiago,
The error is a result of incorrect BTC data. See the attached notebook for reference. We've created a Data Issue to have this resolved. Subscribe to our progress here.
Best,
Derek Melchin
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.
Tiago Silva
Hi Derek,
Backtest posted was using "BATUSD" as example.
There are several crypto that are showing incorrect values for multiple dates, mainly from January 2018 to Feb 2019.
Some of them:
2018: Feb 14; Mar 20; Apr 11; June 5th
2019: Feb 9
All the coins I test go to zero (or -1 even) on the same days.
2019-02-09 04:00:00 : AlgorithmManager.Run(): Portfolio value is less than or equal to zero, stopping algorithm. 2019-02-09 04:00:00 : Algorithm finished, Equity: -32567.870205703504 2019-02-09 04:00:00 : Holdings5270.039222680894 2019-02-09 04:00:00 : Remaining:1651.8680765864979 2019-02-09 04:00:00 : Remaing LTCUSDAmount:12.84631913Price:46.225Value:593.82110178425Unrealized:-477.47106053616 2019-02-09 04:00:00 : Remaing NEOUSDAmount:46.42772613Price:7.7207Value:358.454545131891Unrealized:-415.570711680107 2019-02-09 04:00:00 : Remaing UNIUSDAmount:0.0Price:0.0Value:0.0Unrealized:0.0 2019-02-09 04:00:00 : Remaing MKRUSDAmount:0.85500071Price:445.49Value:380.8942662979Unrealized:-371.97115723127996 2019-02-09 04:00:00 : Remaing XLMUSDAmount:2707.02751978Price:0.081024Value:219.33419776265472Unrealized:-2971.881791287817 2019-02-09 04:00:00 : Remaing OMGUSDAmount:210.60442971Price:1.1665Value:245.67006725671501Unrealized:-482.91142036884696 2019-02-09 04:00:00 : Remaing FILUSDAmount:0.0Price:0.0Value:0.0Unrealized:0.0 2019-02-09 04:00:00 : Remaing ETCUSDAmount:80.26924418Price:4.1857Value:335.982975364226Unrealized:-449.360359390814 2019-02-09 04:00:00 : Remaing DOTUSDAmount:0.0Price:0.0Value:0.0Unrealized:0.0 2019-02-09 04:00:00 : Remaing ZRXUSDAmount:1244.85127649Price:0.25374Value:315.8685628965726Unrealized:-1587.462393617701 2019-02-09 04:00:00 : Remaing EOSUSDAmount:127.88533761Price:2.7754Value:354.932966002794Unrealized:-453.40846702548697 2019-02-09 04:00:00 : Remaing XTZUSDAmount:623.00798639Price:0.38987Value:242.8921236538693Unrealized:-899.8707750439403 2019-02-09 04:00:00 : Remaing ADAUSDAmount:0.0Price:0.0Value:0.0Unrealized:0.0 2019-02-09 04:00:00 : Remaing BATUSDAmount:2115.81827235Price:0.12Value:253.89819268199997Unrealized:-2379.6281156467803 2019-02-09 04:00:00 : Remaing ETHUSDAmount:3.12849754Price:121.00741051Value:378.57138610230515Unrealized:-411.49619493081997 2019-02-09 04:00:00 : Remaing XMRUSDAmount:4.15787957Price:49.264Value:204.83377913648002Unrealized:-200.53011706614 2019-02-09 04:00:00 : Remaing BTCUSDAmount:0.03077477Price:3719.4Value:114.46367953800001Unrealized:-120.24655910946001 2019-02-09 04:00:00 : Remaing TRXUSDAmount:26038.76974494Price:0.027455Value:714.8944233473277Unrealized:-26652.541940160037 2019-02-09 04:00:00 : Remaing XRPUSDAmount:980.49538243Price:0.31588Value:309.71888140198837Unrealized:-1302.5606526136485 2019-02-09 04:00:00 : Remaing BTGUSDAmount:23.56289056Price:10.432Value:245.80807432192Unrealized:-296.52461885793394 2019-02-09 04:00:00 : Algorithm Id:(7295f1f08452090366fef3f9d4baf06d) completed in 34.66 seconds at 1k data points per second. Processing total of 30,565 data points.
Is there a way to ignore the Data if it's corrupted?Or a way to not have the algorithm stop if Equity is negative? What about the live trading? Two days ago my paper trading account show 1.5 Million equity when I only have 2.500. Can this happen on a real money account?
Thank you again
Derek Melchin
Hi Tiago,
We updated the data issue above to reference BATUSD instead of BTCUSD.
There is not currently a way to ignore the TradeBars passed to the algorithm if their prices seem suspicious. The algorithm is supposed to stop the backtest whenever the portfolio equity is negative at the end of a day. When live trading, the QuantConnect data-feed provider should filter out negative crypto-currency prices.
Please submit a data issue for the cryptos above and we'll fix them as soon as possible.
Best,
Derek Melchin
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.
Tiago Silva
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!