Hi,
is there a way to backtest on BTCEUR and then trade on GDAX?
If I try running a backtest I receive the following error message
Failed to initialize algorithm: Initialize(): Python.Runtime.PythonException: Exception : The GDAX brokerage does not currently support Margin trading.
It does nevertheless work on BTCUSD, so that is why I was wondering.
Thanks for the help!
Benjamin Stirrup
Hi,
From what I've heard, margin trading on GDAX is either:
1) Only enabled for BTCUSD.
2) Only enabled for institutions (i.e. really big investors).
3) Disabled for everybody until further notice.
In any case, if you do not intend to trade with a margin acccount, be sure to initialize your algorithm by precizing that you are using a cash account, using the following snippet:
self.AddCrypto("BTCEUR", Resolution.Daily, Market.GDAX) # pair to trade
self.SetBrokerageModel(BrokerageName.GDAX, AccountType.Cash) # crypto brokerage
If you still run into a problem, attach your py file/notebook to your comment. Thank you. Cordially,
Benjamin.
Philip Oedi
Hi Benjamin,
many thanks for the answer! Adding self.SetBrokerageModel(BrokerageName.GDAX, AccountType.Cash) solved the error from above.d the error from above. I now nonetheless run into the problem that no orders are trigger.
I believe that the reason for this is that the account currency and thus the starting cash is set to USD and not to EUR. Is there any way to change this to EUR?
Best,
Philip
Benjamin Stirrup
Hi Philip,
Try this to add 1000 EUR to your account. You will notice that you have to set USD to 0 in addition to adding the EUR, otherwise QC adds 100,000 USD by default:
def Initialize(self): ... self.Portfolio.SetCash(0) # Set USD to 0 since we only have EUR in our account self.Portfolio.SetCash("EUR", 1000, 1.23) # Set EUR strategy cash with current # EURUSD conversion rate self.Debug("{0} USD in account".format(self.Portfolio.CashBook["USD"].Amount)) self.Debug("{0} EUR in account".format(self.Portfolio.CashBook["EUR"].Amount)) ...
However, the backtesting results will all be displayed in USD (using the conversion rate you provide), including the fees. The fact that the conversion rate is not dynamic is rather annoying and leads to fairly inaccurate results (since in reality it changes over time). Also, it would be safe to test if QC API automatically detects that you have EUR on GDAX when you live trade.
I believe this to be a big drawback for European investors wishing to use QC (imagine having to show backtest results in USD to some European clients and trying to justify that...), especially since a very big chunk of the new QC users (or people who could have been new QC users) must be European interested to use QC to systematically trade crypto assets (let's not kid ourselves).
If you can wait a bit, I will try to share a full strategy using MA crossover on one of the crypto asset market having the base security as the EUR.
Jared Broad
we cannot give an ETA at this time.
Some users work around it with the comments above.
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.
Philip Oedi
I definitley agree on the point you're making that this is a big drawback.
The work around works, but is not an optimal solution and hope that this will be available soon.
Sharing a strategy using EUR as a base security would be helpful to see anyway.
Benjamin Stirrup
See the follwing link for a start of a MA crossover strategy:
Philip Oedi
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!