self.Portfolio.GetBuyingPower("USD") does not work for Coinbase Pro. How do I update my dollar value after an order? My starting cash is self.SetCash(1000). It keeps trying to put through buy orders even after one has been filled, I'm guessing because it can't see my updated cash amount or I'm using the incorrect statement. I get the "Insufficient buying power" error. Here is my if statement (( if rsi_value <= 30 and self.Portfolio.Cash > 200: )) Thanks in advance.
Wesley
Also is it possible for me to make it trade once per day and wait until the next day to trade again?
Xin Wei
Hi Wesley,
Thank you for the questions.
For your first question, it's hard for us to reproduce the issue without a full algorithm. Since it's a live trading algorithm, please send your question with a backtest or a complete code snippet through support tab in QC Terminal.
For the follow-up question, it's possible to put a flag to control the trading frequency. You could start with the code snippet as below:
def Initialize(self): self.lastTradeDay = -1 def OnData(self, data): if self.Time.day == self.lastTradeDay: return # insert trading logic # ... # if (trading condition is met): # trade # self.lastTradeDay = self.Time.day
I hope this helps.
Xin
Wesley
Thanks, I'll try out that code and see how it works. I found another thread and used code that keeps up to date on the USD amount. So it is no longer putting through too many orders.
Wesley
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!