Back

FAQ: Trading Crypto on QuantConnect

Hello,

We have a number of people trading crypto running into the same issues and I'd like to address them here in this thread. We'll try add comments to the bottom when new common FAQ's come up. Ultimately the API Documentation can't cover all of these things as many are simply educational.

Each comment below will be a FAQ from the community - enjoy! 

Update Backtest






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.



Q: Why can't I trade BTCEUR? 

A: You can trade BTCEUR - but you must understand how the cashbook works and how to set your starting EUR balance.

When you place a trade for 1 BTCEUR you are buying 1-BTC in Euro's, QuantConnect SetCash method is setting USD by default. If you want to place trades to pay for things in Euro you need to make sure your portfolio has EUR in its Cashbook.

GDAX is a cash-only exchange and is not planning on offering clients leverage or borrowing anytime soon. As such you cannot "go short" - so we must have the currency in your account in order to trade it. Set this in your Initialize() method:

C#: Portfolio.SetCash("EUR", 100000m, 1.1m);
Py: self.Portfolio.SetCash("EUR", 100000, Decimal(1.1))

In live trading this is fetched from your GDAX exchange-account. The "1.1" on the end there is the starting conversion rate from USD. We'll need this to start off the value of your portfolio. Try and set it to a reasonable number or you'll have a massive gap at the start of your backtest.

0

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.


Q: When I redeploy my live algorithm it doesn't remember that I have an active BTCUSD position open?

A: Crypto exchanges, unlike traditional retail brokerages, don't maintain state between deployments of your positions so its impossible for QuantConnect to reliably reconstruct your previous deployments. You will need to manage them with your Cashbook.

The currency pair BTCUSD is called a virtual position - it doesn't actually exist. It is a record of a historical trade of exchanging BTC and USD currencies. In reality they are still separate currencies in your account.

The exchange saves your holdings as a series of separate currencies. I like to think of them as physical coins. Imagine you have $10,000 USD coins on a table; $5,000 EUR coins on a table; 5.12-BTC "coins"; 321-LTC coins, and 12 ETH coins. On launching your algorithm QuantConnect simply gets a note saying you have these physical coins this in your cashbook. With those coins do you have BTCUSD, ETHUSD, LTCUSD, LTCEUR, LTCETH? Who knows! 

To get the virtual pairs is possible but we have to reconstruct the entire trade history of your account; every time we deployed an algorithm; starting from when you first opened an account. This is a risky process as many people trade hundreds of times per day so we elected to do the safe and robust thing and simply populate your account with the cashbook.

So to access these currencies you need to use the cashbook:

C#: Portfolio.CashBook["BTC"].Amount
Py: self.Portfolio.CashBook["BTC"].Amount
0

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.


Update Backtest





0

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.


Loading...

This discussion is closed