Introduction
Carry trade is very common in the foreign exchange market. The strategy systematically sells low-interest rate currencies and buys high-interest rates currencies. The “carry” of an asset is the opportunity cost of holding that asset. Carry trade strategy holds one currency relative to another in order to capture the spread between the rates. We can think of this strategy as borrowing money from one country with a lower interest rate and investing it in another country with a higher interest rate.
Method
Importing Custom Data
The central bank interest rate data is from Nasdaq Data Link. For the trading universe, we choose 9 currencies whose central bank interest rate data is available from Nasdaq Data Link.
rate_symbol_by_ticker = {
"USDEUR": "BCB/17900", # Euro Area
"USDZAR": "BCB/17906", # South Africa
"USDAUD": "BCB/17880", # Australia
"USDJPY": "BCB/17903", # Japan
"USDTRY": "BCB/17907", # Turkey
"USDINR": "BCB/17901", # India
"USDCNY": "BCB/17899", # China
"USDMXN": "BCB/17904", # Mexico
"USDCAD": "BCB/17881" # Canada
}
for ticker, rate_symbol in rate_symbol_by_ticker.items():
forex_symbol = self.add_forex(ticker, Resolution.DAILY, Market.OANDA).symbol
data_symbol = self.add_data(NasdaqDataLink, rate_symbol, Resolution.DAILY, TimeZones.UTC, True).symbol
We save the interest rate symbol and the correspondent Forex asset symbol into a dictionary.
Monthly Rebalance Trading
Next step we sort the Forex symbol by the value of interest rate. The algorithm goes long the currency with the highest interest rates and goes short the currency with the lowest interest rate. The strategy is rebalanced monthly. The Scheduled Event method is used to fire the rebalance event at the first trading day each month.
Jing Wu
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!