I wrote a simple algo for crypto trading using GDAX. I used ImmediateExecutionModel() and wrote my own PortfolioConstructionModel. However, I found that there was NO commission charged in each transaction. To get the commission calculated correctly, I SetBrokerageModel to BrokerageName.GDAX. But when I chose the AccountType to be Cash, it gave me the following runtime error:
Runtime Error: Non null IExecutionModel and IPortfolioConstructionModel 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). Or please set them to NullExecutionModel, NullPortfolioConstructionModel
And when I set the AccountType to be Margin, I got the following error:During the algorithm initialization, the following exception has occurred: The GDAX brokerage does not currently support Margin trading.
Parameter name: accountType
Seems like I'm caught in a Catch-22 situation. Any suggestions?
Ke Shen
I have answers to my own questions now.
1. SetBrokerageModel is in conflict with IExecutionModel and IPortfolioConstructionModel for GDAX issue. There is an old question related to this.
https://www.quantconnect.com/forum/discussion/5715/algorithm-framework-compatibility-with-alpaca-cash-account-typeThere is no solution for this yet.
2. Regarding to get GDAX commissions calculated, I have to do
security.FeeModel = new GDAXFeeModel();
in OnSecuritiesChanged() for each added cryto pairs.
Ke Shen
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!