I have an arbitrage strategy buying the stablecoin DAI below $1 and selling it above $1. However the limit orders are not working for some reason. I need these limit orders to be the “maker” to get 0 fees and get proper fill prices for it to work.
Does anyone have an idea???? Thanks
Mak K
Hi Christian,
Could you please elaborate on what you mean by “the limit orders are not working”
Thanks!
Christian Olsen
Limit orders are not being accepted by QC. When I use SetHoldings, then It works.
Here's a backtest with the same Algo using SetHoldings method instead of Limitorder.
Mak K
Hi Christian,
While I haven't worked a lot with limit orders myself (mainly using insight's to do buying and selling), I did look into it and your algorithm a bit and found this documentation;
Then I implemented that into your algo but it still was not working, saw an error message in the log
“Backtest Handled Error: Order Error: id: 968, Insufficient buying power to complete order (Value:-10), Reason: Your portfolio holds 210 DAI, 210 DAI of which are reserved for open orders, but your Sell order is for 10 DAI. Cash Modeling trading does not permit short holdings so ensure you only sell what you have, including any additional open orders.”
I'm not sure what is meant by "reserved for open orders" but it did give me the idea that you need to enable margin trading for it to work,
so I found this on how to enable margin trading for crypto;
I then went into your code and made all the appropriate changes and it seems to be doing what it is supposed to, buying and selling at exactly 1$ price.
I've attached my backtest and code below, let me know if that solved your problem or if you need additional help, thanks!
Christian Olsen
Thank you so much!!!! Merry Christmas !
Christian Olsen
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.
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!