Overall Statistics
Total Orders
8
Average Win
0%
Average Loss
0%
Compounding Annual Return
2.428%
Drawdown
18.200%
Expectancy
0
Start Equity
25000
End Equity
36963.16
Net Profit
47.853%
Sharpe Ratio
0.058
Sortino Ratio
0.075
Probabilistic Sharpe Ratio
0.041%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
0.014
Beta
-0.161
Annual Standard Deviation
0.058
Annual Variance
0.003
Information Ratio
-0.322
Tracking Error
0.199
Treynor Ratio
-0.021
Total Fees
$0.00
Estimated Strategy Capacity
$960000.00
Lowest Capacity Asset
USDJPY 8G
Portfolio Turnover
0.02%
from AlgorithmImports import *
from QuantConnect.DataSource import *

class ForexCarryTradeAlgorithm(QCAlgorithm):

    def initialize(self) -> None:

        self.set_start_date(2008, 1, 1) 
        self.set_cash(25000)
        
        # We will use hard-coded interest rates
        self.rates = {
            "USDAUD": 1.5,    # Australia
            "USDCAD": 0.5,    # Canada
            "USDCNY": 4.35,   # China
            "USDEUR": 0.0,    # Euro Area
            "USDINR": 6.5,    # India
            "USDJPY": -0.1,   # Japan
            "USDMXN": 4.25,   # Mexico
            "USDTRY": 7.5,    # Turkey
            "USDZAR": 7.0     # South Africa
        }
        
        for ticker in self.rates:
            self.add_forex(ticker, Resolution.DAILY, Market.OANDA)
            
        self.month = -1

    def on_data(self, slice: Slice) -> None:
        if self.month == self.time.month:
            return
        
        self.month = self.time.month
        
        sorted_rates = sorted(self.rates.items(), key = lambda x: x[1])
        
        self.set_holdings(sorted_rates[0][0], -0.5)
        self.set_holdings(sorted_rates[-1][0], 0.5)