In my algorithm trading equities on interactive brokers is able to recognize my stocks in my poortfolio and list them correctly when the algo restarts..
However, when using GDAX, If I restart the algorithm on the main information page where it shows my algorithm holdings, it lists everything as zero. My algorithm then rebalanced and now it says I’ve got negative of some coins. I don’t have negative and you can’t short so this is clearly wrong. I’m concerned how it might affect the code going forward too.
Derek Melchin
Hi David,
The crypto pairs (BTCUSD, ETHUSD, etc) are virtual positions, so they aren't saved between deployments. Refer to this related thread.
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.
David E
Is there a way to fix this? My algorithm runs on determining if the portfolio is invested or not. It’s sold bitcoin on this last dump but when it rebounded he didn’t buy back into it and I missed the run up. There’s something inherently wrong about this here. The algorithm knew I wasn’t in bitcoin but still couldn’t recognize that I wasn’t portfolio invested. Not sure what’s going on here. Is there anyway to instruct the algorithm if I am portfolio invested in bitcoin or not?
Emilio Freire
Hi David Eldringhoff
That is an issue with Cash accounts in GDAX and Bitfinex. If you want the algo to be able to restore the state of the Portfolio after stopping and re-deploying, you need to use a Bitfinex Margin account. This type of account will send the state back to QC when connecting and you will then be able to use Portfolio.Invested, Holdings, and all those as normal.
Thanks,
Emilio
David E
I have just been too busy to delve into Dereks link. Just looked into it and I think that should fix the problem just fine. Issue with Bitfinex is I'm in the USA and they dont allow USA accounts.
David E
Well that isn't working either. I tried the following in OnData and neither worked. The backtest runs without errors. Just no trading occurs. Not even with the other coins that should be working fine:
David E
Actually I cant even get working algorithms to backtest correctly right now. Even cutting and pasting the code from a successfully run backtest and running a new back test shows no trading on a previously working algo. Is there an issue with the back testing right now? or are there being changes made on the fly right now that is causing this issue?
Varad Kabade
Hi David Eldringhoff,
Can you share a backtest highlighting the error? Note that When trading crypto, we should manually calculate the order quantity. This technique is demonstrated in the BasicTemplateCryptoAlgorithm.
Best,
Varad Kabade
David E
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!