LEAN is the open source
algorithmic trading engine powering QuantConnect. Founded in 2013 LEAN has been built by a
global community of 80+ engineers and powers more than a dozen hedge funds today.
Alpha League Competition: $1,000 Weekly Prize Pool
Qualifying Alpha Streams Reentered Weekly Learn
more
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?
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.
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.
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:
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).
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.
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 ;).
Coinbase has turned off market-stop orders since 03/23/2019. But it seems stop-limit orders still not supported by QC. Is there any method to control the risk?
Currently, stop-limit GDAX orders are not supported in LEAN yet but we hope will be added soon. Please subscribe to this Github Issue for updates or if you'd like to contribute a pull-request for the feature.
Â
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.
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...
To unlock posting to the community forums please complete at least 30% of Boot Camp. You can
continue your Boot Camp training progress from the
terminal. We hope to see you in the community soon!
You do not have enough QC Credit to send this award, get a QC Credit Pack
here.
Award Sent Successfully
Thank you for giving back to the community.
Processing...
Choose a Credit Pack
Payment Confirmation
QuantConnect Credit (QCC) can be applied to your cloud-invoices or
gifted to others in the community with Community Awards in recognition of their contributions.
Community Awards highlight the awesome work your fellow community members are doing and inspires
high quality algorithm contributions to the community. Select an option below to add
QuantConnect Credit to your account:
$5
500 Credit Points
 
$10
1,000 Credit Points
 
$18
2,000 Credit Points
10% bonus
$45
5,000 Credit Points
10% bonus
03/23XXXX XXXX XXXX 0592
We will charge your default organization credit card on file, click
here to update.