I'm still trying to learn the QC api, but I get the same or very similar error codes no matter what I change. I'm mostly just trying to build an algo ‘from scratch’ that runs, as opposed to a viable/profitable algo. Thanks
Runtime Error: Trying to dynamically access a method that does not exist throws a TypeError exception. To prevent the exception, ensure each parameter type matches those required by the 'float'>) method. Please checkout the API documentation.
at OnData
marketOrderTicket = self.StopMarketOrder(self.btcbusd in main.py: line 23 (Open Stacktrace)
class RetrospectiveMagentaAlbatross(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2017, 8, 24)
self.SetCash(100000)
self.AddCrypto("BTCBUSD", Resolution.Minute, Market.Binance)
self.SetBrokerageModel(BrokerageName.Binance, AccountType.Margin)
self.rsi = self.RSI("BTCBUSD", 14, MovingAverageType.Simple)
self.btcbusd = self.AddCrypto("BTCBUSD", Resolution.Minute, Market.Binance)
def OnData(self, data):
if not self.rsi is ready:
return
profitTargetPercent = 1.01
stopLossPercent = 0.997
if self.rsi.Current.Value > 72:
self.SetHoldings(self.btcbusd, 0.1)
marketOrderTicket = self.StopMarketOrder(self.btcbusd, -1.0, stopLossPercent)
limitOrderTicket = self.LimitOrder(self.btcbusd, -1.0, profitTargetPercent)
Fred Painchaud
Hi Victoria,
Here is some help:
I did not test it but it should run.
Fred
Victoria Butler
Hmm, I tried running the updated code, but I am still receiving the same error codes.
Fred Painchaud
Oh yes, the stop market order… Sorry. Forgot the .Symbol part.
Here:
I don't think QC has the BTCBUSD data however. It is not in the Data Explorer…
Fred
Fred Painchaud
With BUSD in your portfolio…
For your orders, you will need to get the fill price and multiply by your percentages…
Fred
Vladimir
Victoria Butler,
The following back-test can help you get your base algorithm up and running.
Victoria Butler
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!