I just tried to implement an algorithm based on the new QCAlgorithmFramework.
The exception: "These models are currently unsuitable for Cash Modeled brokerages" informed me that I cannot use it yet for my cash account.
Is support for cash accounts coming in the next few weeks? I'm asking, because I need to decide whether I want to wait or implement my idea "the old way".
PS: I love the idea of the new framework btw! :-)
Jared Broad
Thanks Fabian! I recommend for crypto for now you write custom models or use the old system. We had to disable crypto as it was nearly impossible to automatically execute with the current accounting system we're using. No traditional brokerages use cash-settled-fx so its been a bit of a learning curve for us.
We're doing some research into how we can model and account for crypto portfolios in a way which meshes with the existing portfolio systems of LEAN. This is a "hard problem" which we can't rush and will take more than a few weeks.
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.
Fabian Kulman
Hi Jared, thanks for the info! I'll stay with the old system for the moment.
Jake Mitchell
Is there any headway on this? I'm new to QC and I only have a cash account at IB - am I wasting my time developing on this platform?
Jared Broad
Hi Jake, cash accounts work fine just not crypto which doesnt follow same portfolio modeling patterns.
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.
Jake Mitchell
Is there something I need to code for in my scripts? I'm getting this error when the only security I've specified is "CRON".
Â
Successfully sent backtest request for 'Crawling Brown Zebra', (Compile Id: c5da803d81965a481889f452f46b2a3c-460f2daf1fe02f4f0a76a83c72905885) 164 | 23:46:49: These models are currently unsuitable for Cash Modeled brokerages (e.g. GDAX) and may result in unexpected trades. To prevent possible user error we've restricted them to Margin trading. You can select margin account types with SetBrokerage( ... AccountType.Margin)
Â
Jack Simonson
Hi Jake,
CRON isn't a currency supported by either GDAX or Bitfinex, which are our two data vendors for crypto. The error you are receiving, however, doesn't stem from using an unsupported symbol but rather that GDAX doesn't support margin trading, and so you need to specify AccountType.Cash in the SetBrokerageModel call in the Initialize method (you can see more information on this in this community forum post). Bitfinex, however, does support margin trading and so you can use this brokerage instead if you want to trade using margin.
Jake Mitchell
My problem is the opposite of what you mention; but along the same lines I suppose? My account with IB is a Cash account. So originally I had set:
self.SetBrokerageModel(BrokerageName.InteractiveBrokersBrokerage, AccountType.Cash)
Which resulted in:
"These models are currently unsuitable for Cash Modeled brokerages (e.g. GDAX) and may result in unexpected trades. To prevent possible user error we've restricted them to Margin trading"
(opposite of what you said are the restrictions)
So I had to change it to the following in order to keep developing my algo:
self.SetBrokerageModel(BrokerageName.InteractiveBrokersBrokerage, AccountType.Margin)
Which is not my real account status. By setting it this way I'm able to view CRON (though it's the US market and not Canada. But I suppose my IB account can pass my Canadian market data to QC, no?). I don't quite understand the reason for the restriction on Cash trading however.
Jack Simonson
The restriction on Cash trading is done on our end, and only specifically for Framework Algorithms, which you can see here. Cash modeling poses several unique problems with respect to the algorithm framework. One constant issue is that our primary cash brokerage, GDAX, doesn't support the concept of virtual positions (this is GDAX specific since they don't support margin trading, but we've applied the restriction across all brokerages, including IB). Another issue is the very concept of a virtual position. In cash modeling, there are no virtual positions, just currencies. In this model, an issue is how do we phrase portfolio targets. For example, if I emit a target of 10 BTC/USD but don't own USD, what does that mean? I might have millions of dollars of LTC, but since I don't own any USD I won't be able to execute on BTC/USD. A smart algorithm might sell some LTC for BTC instead. At this point, we're getting into the nitty-gritty of an individual algorithm and how that algorithm might transition between various currencies. The framework absolutely supports these types of things, but it requires agreement between the portfolio construction model and the execution model as to exactly what a target is describing.
Cash Account support for Framework Algorithms is something we're looking into but we can't provide a timeline of when this might be implemented. In the meantime, you can mimic using a cash account in backtesting by setting security leverage to 1. This can be done by adding a line in the security initialization function in StandardAlgorithm.py
def SetSecurities(self, security):
security.SetDataNormalizationMode(DataNormalizationMode.Raw)
security.SetLeverage(1)
We don't support any equities in Canadian markets right now, i.e. CRON on the Toronto exchange, and so I can't tell you for certain whether or not IB would be able to accommodate this if you tried their ticker for CRON in Toronto (I think it would be CRON.TO or something similar).
Def returns
Is it possible to use the framework for cash accounts by implementing the leverage=1 fix in live trading? What I mean is telling the algo that your account is margin (even though it's cash), and then only using 1x margin.Â
Lucas
Hey Tomas
I have tried with IB, and this works fine, as long as the algo does not try to take leverage
Lucas
Louis Szeto
Hi Tomes
You may set the leverage as 1 by a custom security initializer while using the framework models and margin account setting for backtesting:
Best
Louis
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.
George Riley
In live trading on Binance, the API refuses the Margin AccountType setting when your account is not a margin account. In many european countries, Binance doesn't allow margin accounts anymore, only Cash Accounts. So the workaround above doesn't help. This seems critical to me. Is there any other workaround to still use the Framework on a Cash Account?
Louis Szeto
Hi GeorgeÂ
LEAN now accepts framework implementation for cash account type also.🚀
Best
Louis
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.
Fabian Kulman
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!