I am currently trying to write a crypto triangle arbitrage algorithm (testing out ETH/USD - BTC/USD here), and I cannot seem to get the order flow to work properly.
My logic is to check the imbalance between ETHUSD and its synthetic (BTCUSD*ETHBTC), and to attempt to arbitrage the imbalance when it exists. For these trades to work, the trades from ETHUSD -> ETHBTC -> BTCUSD have to be executed sequentially as quickly as possible.
I tried a couple of different ways of doing this, none of them worked very well. I am currently trying to leverage the OnOrderEvent method to create a waterfall of sorts. i.e. when the previous order gets 'filled', the next order executes, and so on.
What I'm seeing is that the initial order for ETHUSD is filled, but the subsequent order to 'sell' is never triggered. I'm out of logs right now, so maybe there is something I can't see that is going on.
Shile Wen
Hi Christopher,
To increase the robustness of the order logic, I'd suggest checking the Symbol in the OrderEvent (orderEvent.Symbol) as well as the direction of the OrderEvent (orderEvent.Direction). See here for the full list of OrderEvent fields.
Furthermore, we don't advise using SetHoldings with crypto-currencies. Please check out the forum post:
"BTCUSD" - What are Virtual Positions? #3178
and check out BasicTemplateCryptoAlgorithm of how orders should be managed in algorithms that trade crypto.
Best,
Shile Wen
Shner
Hi Shile, I'm trying to click on this link you've provided, but its not working.
Is there anywhere else I can read about all the fields available for the method ? Thanks.
Louis Szeto
Hi Shner
Sorry, the old link isn't working since we're in the progress of updating our docs. Please refer to this link for OrderEvent attributes.
Best
Louis
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.
Karamazov
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!