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.


We have included more cryptocurrency pairs for trading in both live and paper trading. The following are the cryptocurrency pairs that are now available. Remember that depending on your location, not all pairs may be avialable for live trading, however, all pairs should be available for paper trading.

BTC/USD
BTC/EUR
BTC/GBP
ETH/USD
ETH/BTC
ETH/EUR
LTC/USD
LTC/BTC
LTC/EUR

1

class BasicTemplateAlgorithm(QCAlgorithm):

def Initialize(self):

self.SetStartDate(2017, 10, 01)
self.SetEndDate(2017, 10, 23)
self.SetCash(10000)
self.SetBrokerageModel(BrokerageName.GDAX, AccountType.Cash)

self.AddCrypto("BTCETH", Resolution.Daily)
self.Log(format(self.Securities["BTCETH"].Price))


def OnData(self, data):

self.Log(format(self.Securities["BTCETH"].Price))

Hello Andrew !For some reason I am not able to acees LTC or ETH markets... Only GDAX

0

Hi!

When using the resesarch notebook I got this error when trying to call 

Quantbook.AddCrypto()

AttributeError: 'QuantBook' object has no attribute 'AddCrypto'

Is this expected?

3

Yes, it is expected, since we haven't included support for crypto-currencies in quantbook yet.

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.


Coming later today Ali Badr !

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.


Still having issues with Consolidators (Trying to consolidate to 3 hour) and a simple SMA strategy ..  Anyone?

0


Big thanks to Jared and Andrew for you work on cryptos. Jared, thanks for taking a look at my first crypto algo and providing feedback.

3

All available gdax cryptocurrency pairs are now available for backtesting at tick, second, minute, hour and daily resolutions. Here are the listing dates for each pair available: 

BTCEUR: 20150423
BTCGDP: 20161001
BTCUSD: 20141201
ETHBTC: 20160518
ETHEUR: 20170810
ETHUSD: 20160518
LTCBTC: 20161001
LTCEUR: 20170810
LTCUSD: 20161001

1

CryptoKing I just swapped out for minute data and its fine. Also note I used the SMA helper methods not the class names. If you want to use the classes you also need to "Register" the indicator object otherwise it'll never get any data. We're going to fix the hour issue today.

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.


Jared Broad  Thanks that was helpful so primarily the issue was that the "Hourly" Resolution for GDAX was not working?

Appreciate the help there.

Also tried going live with an algo today but says GDAX brokerage is under maintenance. If I were to have a live algo what happens to it while brokerages are under maintenance? Also is there anywhere we can see status of brokerages (for example so I can know when I can and cannot "go live") ?

0

There were 2 issues; hourly data and the SimpleMovingAverage class. Please see the documentation for examples of how to use indicators. There's effectively no difference to using Minute data other than backtest load time but for such a short backtest its basically the same.

You can go live on all brokekrages; not sure where you saw the maintenance notice? Do you mind sending an email with that to support@quantconnect.com -- thanks.

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.


Did anyone try using the RSI indicator on ETHBTC markets? all the outputs are 0. I feel like this has to do something with the face that prices are between 0 and 1 for example 0.67

0

Actually, same situation with ETHUSD. RSI gives value of 0 

0

Please attach an example if seeking assistance. RSI is always 0 until IsReady is true. See the indicator algorithms in Documentation for examples.

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.


class BasicTemplateAlgorithm(QCAlgorithm):

def Initialize(self):

self.SetStartDate(2017, 10, 01)
self.SetEndDate(2017, 10, 20)
self.SetCash(10000)

self.SetBrokerageModel(BrokerageName.GDAX, AccountType.Cash)
self.security = self.AddCrypto("ETHUSD", Resolution.Hour)

self.rsi = self.RSI("ETHUSD",12,MovingAverageType.Simple)


def OnData(self, data):
self.Log(format(self.rsi.Current.Value))
0

Hey Ali Badr - Thanks for reporting this to us. There was a problem with indicators for crypto securities that has been fixed. 

We have also added the quote data for all the crypto pairs we currently support

0

Hi All, 
Andrew Hart mentioned there are quote data available for crypto pairs, does this mean that "all" limit order book data is accessible from withi QC? (or maybe at the best bid/ask?) If yes, how can I access volume at different price levels? (or best bid/ask)

Thanks

0

Farshid Zoghalchi - we only pump through the "NBBO" top of book. I understand the desire for the full book but we currently only use it for spread modelling. We're working on a backtesting L2 quotes feature but its still a few months out as there is limited data availability.

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.


Thanks @Jared Broad,

If I am not wrong, one can also use their own data in backtesting. Does

this mean, I can use my own L2 data to backtest strategy?
1

Having trouble downloading the crypto data for use offline, is it possible?

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