"message":"Margin currently not available for BTC-USD

Hi!!! I just went live with my first algo trader today (C#).  Newbie to algo trading, novice coding experience.  As a trial run, I'm attempting to trade based on two EMAs using GDAX.  Everything is syncing with GDAX, but I'm receiving the following error when a trade is attempted:  

19:15:00: Brokerage Warning: Order failed, Order Id: 23 timestamp: 1/28/2018 12:15:00 AM quantity: 0.03793578 content: {"message":"Margin currently not available for BTC-USD"} 

First and foremost, I have no clue why it's timestamping 12:15:00 AM when the current time is 19:15:00.  

Here's what I'm using:

using System;
using System.Linq;
using QuantConnect.Indicators;
using QuantConnect.Models;

I've never told it to trade margin (that I'm aware of), thus I'm not sure why I'm getting this error.  Any help would be greatly appreciated!!


Update Backtest

            //Set brokermodel
            SetBrokerageModel(BrokerageName.InteractiveBrokersBrokerage, AccountType.Margin);

I guess you need to add this to the initialize() . Tip: Try to copy some algo's which are in the lean github and then start changing things.

Check this out:


Thanks Quant Trader.  Here is the line of code I was missing:

SetBrokerageModel(BrokerageName.GDAX, AccountType.Cash)

as stated on the last line of the crypto section in the documentation:

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.


This discussion is closed