Hello,
I was trying the Forex carry trade strategy that I took from the strategy library.
During backtesting I don't understand where rollover interests are shown. Actually I don't know if they are taken in account at all.
This is very important because a forex carry strategy focuses mainly on earning interests.
Does sombeody know if rollover interest are included in Oanda model? I didn't find anything about that in the documentation.
Thanks.
Daniele
Jack Simonson
Hi Daniele,
Correct, rollover interest is not accounted for in the strategy. To do this, you would need to import custom data containing the interest rates for the currencies that are being traded and then the rollover interest can be calculated using Oanda's guidelines found here. This will better inform your backtests but, if you live trade with Oanda, note that they calculate financing charges/credits on a near-continuous basis and so these gains or losses will be directly reflected in your account balance and need not be accounted for in the code.
Pierre Vidal
Hi Jack,
Daniele raised a very relevant point above.
The idea of the carry trade is to earn interests, while trying to avoid or mitigate losses due to spot prices volatility. With this in mind, not being able to account for the rollover interests in the actual strategy returns and profitability stats is problematic, in an otherwise fantastic platform.
I am not sure how this works with live trading. Is Quantconnect pulling updated unrealized P&L for all positions from Oanda following rollover?...
But not at that stage yet, I am first concerned with backtesting. Could you by any chance think of any workaround to account for the carry interests in the actual strategy results?
Â
Thanks in advance!
Â
Erik Bengtson
Oanda calculates the interest once a day around 5pm ET, you will see in your algo when QC refreshes the cash.
You can use the below code to calculate the interests during backtesting. Starting early next month, Oanda will change significantly the calculation method of interests rates, so this code will have to be adapted.
Carry trades should only be entered near the two year lows/highs for the instrument, otherwise you might loose all the benefits of holding it in long term.
I don't rebalance only based on interest rates, but also on 2 years High/lows.
https://www.quantconnect.com/forum/discussion/5460/calculate-rollover-interest-for-oanda/
Â
By the way, here is the latest version of the code
https://github.com/ebengtso/quant/tree/master/InterestCalculatorÂ
Pierre Vidal
Hi Erik,
Thanks for your additional answer, which made a lot of things much clearer for me!
I was not aware of the AddAmount method to add cash to the cash book during backtesting. I could not find it in the onlne documentation either, but I am really new to Quantconnect.
Â
Thanks anyway!
Alexandre Catarino
Hi Pierre Vidal ,
Cash.AddAmount method is not included in the algorithm reference documentation because the problems that involve increasing the amount of cash should not be handled directly by the algorithm derived from QCAlgorithm but by an "InterestPaymentModel".
We have a GitHub issue to implement it: Model Interest Paid on Leveraged Assets #32.
It is an old issue, but we are looking into moving it forward.
Anyway, feel free to implement what you need and reach out for help if there are further questions.
Pierre Vidal
Hi Alexandre,
Thanks for the update, good to know!
Alejandro Reynoso del Valle
With regards to the FX carry trade tutorial, I see that the pairs are USD___, so when the orders are placed the price is in the pair currency, not the dollar. Therefore, when the backtest is done, how can I be sure that the profit calculations are done in dollars. If I reverse the pairs, to ___USD the result is different. Why is that?
Â
Shile Wen
Hi Alejandro,
Profit calculations are all done in regards to the base currency, which by default is USD.
Best,
Shile Wen
DanieleC87
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!