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.


What is the GDAX fee model assumption in backtesting and live paper trading? Is it 0.25% for market orders? Are they different in live vs backtesting?

0

+1  on the eventual adding of Bitfinex.

4

+1 on adding Binance.com

https://github.com/sammchardy/python-binance
4

I've only spent minimal time playing with QC (I live traded with Quantopian, then discovered crypto after Robinhood integration was killed off), but I'd become a paying customer if Binance was added.

2

Another crypto exchange would be great! 

2

During live trading on GDAX my algo will execute both buy and sell orders.  Yet, eventually, I will get this error in the log:

Unable to submit order with id -10 that has zero quantity.

and this log will repeat on every trade attempt until i stop the live trading.  Yet, both the QC platform and GDAX show I'm still holding a long position.  Does anyone know why it's showing zero quantity?  Does liquidate() automatically update my portfolio with zero quantity even if it hasn't actually sold my long position on the exchange? I ask this question because it doesn't make sense to me why it would be submitting zero quantity in the liquidate() command even after the QC dashboard shows I'm holding a position and this is also confirmed in GDAX.  At this point, I'm just grasping at straws, but I'm assuming SetHoldings() and Liquidate() both update the portfolio to it's respective quantity regardless of if the trade was actually executed.  Is this the case?   

I've seen various posts in the QC community to address latency issues, but is there a general concensous on which method works best?  

0

Ted Smith discussed in this thread - 

https://www.quantconnect.com/forum/discussion/2747/crypto-trading-on-quantconnect/p2/comment-8904
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.


Would this: 

SetHoldings(Symbol, 1);

verus:

SetHoldings(Symbol, 1.0);

be the cause of the log error:

Unable to submit order with id -10 that has zero quantity.

0

Is there any progress on adding another exchange? When do you think it will be ready?

0

Hi everyone Im very new to coding, but been in the trading game awhile, I am trying to deploy an algo live on GDAX but the only error im getting is a failure to get cash balance for GDAX brokerage, does anyone have any adivce for me?

0

COBINHOOD, take a look for a possible broker, low volume which is actually good for trade execution, ZERO fees with an extremely similar  API, Please Take A Look 

0

Jared Broad  any plans to add kraken for shorting?

0

Sorry, a noob here at coding.

Could someone explain this code to me

0

Can be in perl?:)

0

 Jared Broad 

Would be nice to see Bitfinex, Binance, Kraken or other crypto exchanges to QuantConnect

Gdax unfortunately has also several country restrictions.

Any plans?

0

Lots of plans Donkey! There are several open-source projects in the works now =) Brokerages are really hard but viliwonka is making some great progress. His team is working on Kraken and Binance. Bitfinex has stagnated after their USDT concerns. The branch could use some work. 

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.


+1 for Binance. They trade a fair bit of volume compared to the other exchanges and they have lots of altcoins. Data for backtesting is crucial. Their Kline API call isn't going to get the job done so someone will likely have to cut a deal with them to get their historical data. Complete order book histories would be very nice....

3

+1 binance, bitfinex and huobi

1

+1 Binance, Bitfinex and Huobi. Maybe as a stretch goal some consideration can be given to Bitmex. It is the largest exchange by volume, has the highest available leverage and supports websocket (for live pricing).

1

Yeah true !!

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