Hello, I still have more work to do on this bot, but I am looking for an explanation of the losses shown.
There are a few levels of functionality to secure very small profit at a time in this algo.
- I make a calculation to make sure that order executions only occur if the the action of [buying BTC with USD, buying ETH with BTC, and then completing the loop by selling ETH for USD] returns a profit.
- Referring to the functionality above, to make sure that the profit is greater than 0.9% to cover Gdax fees (0.3% per trade).
- Slippage could also roll me into a non profitable execution, so I check for bid/ask sizes per trade, convert them into a USD amount, and use the smallest of those to engage in a market order.
- To be even safer, since there are plenty of other buyers and sellers who might get to an order first, I limit the max trade amount to a 100 USD equivalent if the smallest bid/ask size is larger than 100 USD equivalent.
Even then. I still have negative turnout. What is odd is that I manually calculate the profit using the data in the "Orders" section of the back test, and it shows a positiv overall return.
Xin Wei
Hi Ian,
It seems that the commissions and bid-ask spread make the strategy unprofitable. If you check the statistics of your backtest, it shows a net profit of -7.821%. This number should be consistent with the result of the "Orders" section.
Good luck with your strategy!
Ian Grey
I see that I should not reference the open prices, but rather the Ask and Bid prices. I tried this but I could not seem to find a way to cast the type QuoteBar to float. How can I access the bid and ask prices as floats? If this is not possible in backtesting, is it possible in live trading?
If not an option at all, could you point me in the right direction towards estimating those in a dynamic way?
Douglas Stridsberg
Hi Ian - is this section on bid/asks in the documentation what you're looking for perhaps?
Ian Grey
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!