Back

Crypto Trading on QuantConnect

Hey QC community,

We are excited to announce the launch of cryptocurreny backtesting and live trading on QuantConnect! We’ve partnered with GDAX to support their cryptocurrency exchange.  Using your GDAX account, your algorithms can now trade BTC, LTC and ETH currency pairs. Huge thanks to our community members who helped make Lean ready for crypto. In this post, I’ll demonstrate backtesting a cryptocurrency trading algorithm using python and describe how you can get started live trading cryptocurrencies with GDAX.

Attached is a simple backtest that demonstrates subscribing to BTCUSD hourly data and placing an BTCUSD market order. Initially, QuantConnect is offering a limited set of GDAX quote data for BTCUSD for backtesting, however, users can expect our crypto data library to grow soon. Clone the backtest below to start building your crypto trading algorithms.

In order to get your algorithm live trading, sign up for a GDAX account here: https://www.gdax.com/ . To live trade, you’ll need an api key, api secret and api passcode.  To get this information, login to your GDAX account and click API from the menu in the top right corner. Create a new API key that has permissions to ‘view’ and ‘trade’ and be sure to record the api key, api secret and api passcode. You now have all the information needed to launch your live crypto-trading algorithm! Simply click ‘Go Live’ from your algorithm and follow the wizard. Be sure to select Gdax as your brokerage.

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.


Andrew Hart Is it possible to add a C# example?

0

CryptoKing - Sure thing

2


This is amazing! Kudos for adding this functionality to Quantconnect.

1

MovingAverageCrossAlgorithm example using BTC starting in 2016 with $10,000.

3


Hi Andrew,

I have been experimenting with the crypto securities, and have been unable to do backtesting on Litecoin or Etherium, while Bitcoin works. Am I reading the article above correctly, in that backtest data is available for BTC, but not ETH or LTC, but the algo may actually trade ETH and LTC on GDAX? Also, where can I confirm the ticker symbols for ETH and LT. I havent been able to locate them in the Quantconnect data library? Thank you.

0

@LA Awesome; you've posted the first community crypto algorithm! =)

Re ETH etc: Correct; We're working on the other asset types for backtesting though and will post the bew assets here in the next day or two.

Data is one of the big problems with backtesting crypto; if you have good sources for historical data on GDAX for the other symbols please let us know.

1

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.


Thank you Jared. Any suggestions on what could be improved (or where to look for info) in order for this to be made into a Live Trade algo?

As an alternative, I am interested in what Quantconnect has to offer compared to other platforms that have recently discontinued their Live Trade functionality. I hope to learn much from this community, and give back what I can.

1

Jared Broad

Jared Broad  Yes definitely there is a source for historical crypto data ... it's not free but it's available

https://www.coinigy.com/bitcoin-data/
0

Jared Broad how about this: api.bitcoincharts.com/v1/csv/ 

0

Any advice on FeeModel ? Exchanges charge percentage of order per transaction. It looks like QuantConnect FeeModel is based around fixed fee. Any way to calculate fee "on the fly" or based on percentage?

0

Is paper trading available for Cryptos? I can backtest successfully but receive errors when deploying to paper trading.

Added data warmup to CryptoWarmupMovingAverageCross (py). See attached backtest.

1


Bitcoin charts doesnt have other currencies just btc. Coingy doesnt have

spread/quotes.
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.


Is paper trading functional with Cryptos? Or can we only run live on GDAX? I've been able to complete backtests, but receive errors on deploying to paper trading.

0

Phew insane day sorry for delay; yes paper trading is supported for cryptos. Its best of course is to use the live exchange data as its filled with real depth there. We are working on a maintenance this afternoon and will look into the algorithm you shared above.

Generally speaking its best to share suspected bugs to support@quantconnect.com -- we like to keep the forums focused on algorithm development sharing.

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.


I'm confused about how we may create a crypto algorithm for other timings for example 10 or 15 minutes or 3-hour .. I have done some reading and see that via consolidaters it seems that TimeSpan minutes can be combined using TradeBarConsolidator but all the examples I've seen of this use Ondata(TradeBars data) and all the examples of crypto algos use Ondata(Slice data). 

How can I create a simple C# algorithm that trades on 3 hour time frames?

1

I've been trading crypto for a while and have experience with both python and nodeJS based automated trading engines.  I'm finding it a little unusual to only have Trading resolutions of Second, Minute, Hour, or Daily,  It's not atypical at all to have resolutions of 2min, 5min, 15min, 30min within Crypto, not sure if the same is true with regular markets or Forex, etc.  

Can someone point me to any documentation or direction that will help?

0

https://www.quantconnect.com/docs#Consolidating-Data

Jay Stevens  Consolidators

1

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.


 Jared Broad  Thanks for that link I had read through various docs but never come across that. It definitely points the path on how to use indicators for specific increments. However what if I wanted to do some custom calculations. I would assume that I would need to do them inside of the OnData (Slice data) or am I thinking about that also the wrong way?

 

Say I wanted to do a calculation and decide to manually sell or buy in one of the secific increments (consolidators) like 15m. Your link does not really help point to a solution for that. Any advice?

0

Did the crypto implementation change something needed in the Research notebooks?

ExceptionTraceback (most recent call last)
<ipython-input-3-984adb1d8e6f> in <module>()
17
18 # Create an instance
---> 19 qb = QuantBook()

Exception: QuantBook.Main(): System.ArgumentException: Requested value 'crypto' was not found.
1

 

@Liquidgenius -  your paper trading crypto algorithm was failing because of how we handle history requests. We have debugged the issue and it should be fixed within 24 hours

0

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