Back

GDAX stop limit order: "BrokerageModel declared unable to submit order"

Dear all,

My issue is the following: "BrokerageModel declared unable to submit order" for StopLimit sell orders on GDAX. I attached the backtest to this post.

I see two possibilities for that:

1) The BrokerageModel implemented by QC does not follow GDAX order model, as I know that there is the possibility to place stop limit orders using GDAX user interface. Furthermore, I think that GDAX API also allows stop limit orders: .https://docs.gdax.com/#place-a-new-order.

2) There is some kind of mishandling of the stop limit order from my side.

If 1), how can I simulate a stop limit order using: stop orders, limit orders, order event monitoring and price data monitoring?

Thank you. Cordially, Benjamin.

Update Backtest








Looks like they've added Stop Limits' to their API; but there isn't any documentation on it yet. Once they have some API documentation we can try adding it:

https://github.com/coinbase/gdax-node/issues/164

 Take a guess at how to simulate it! Post your first attempt and we'll help :)

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.


Thank you Jared for confirming that stop limit orders are not available on GDAX yet due to their lack of documentation.

I have modified the strategy so as to simulate stop limit orders. I attached the backtest to this post. If words can provide a better understanding than code, I will try to describe how I simulate stop limit orders using sell limit orders and price monitoring:

  1. Initialize variables:

    • Keep track of the price at the time of the previous execution: self.previousPrice.

    • Keep track of the stop price at the time of the previous execution: self.previousTrigger.

    • Keep track of the existence of open orders: self.buyTicket, self.sellTicket, self.stopTicket with two states: None or Orders.OrderTicket.

    • Keep track of whether or not we are currently monitoring the data relative to self.previousTrigger. This is the fundamental part for the stop limit order simulation: self.stopMonitor with two states True or False. This variable is set to True after a buy order is filled, and to False when a sell order is filled (either a strategically planned sell order, or a simulated stop limit order).

  2. At each execution of OnData():

    • Update the stop limit order: If we are long, then we are monitoring a stop price. If the price increased since the previous execution, we also increase the stop price according to some rule. If for some reason a stop limit order (simulated) was open, we cancel it. If the price went under the stop price, then we place a sell limit order, which constitute the simulated stop limit order.

    • According to some rule (here moving averages), we go long if we had no previous holdings in the security.

    • According to some rule (here moving averages) and if there is no stop limit order open, we go short if we had holdings in the security.

  3. When we receive an order event via the OnOrderEvent() method:

    • If buy order: check if it was filled. If the buy order is filled, define a stop price and tell our program to monitor the price relative to the stop price by setting self.stopMonitor to True.

    • If sell order: check it was filled. If the sell order is filled, stop the stop price monitoring and cancel any stop limit order open.

    • If stop limit order: check if it was filled. If the stop limit order is filled, stop the stop price monitoring and cancel any sell order open.

If you have any comments on that, I would be glad to hear it. If you happen to have a more efficient and/or programmatically nicer way to do that, I will be even more glad ;).

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