Overall Statistics |
Total Orders 2 Average Win 0% Average Loss 0% Compounding Annual Return 0.533% Drawdown 13.400% Expectancy 0 Start Equity 25000 End Equity 27063.82 Net Profit 8.255% Sharpe Ratio -0.244 Sortino Ratio -0.315 Probabilistic Sharpe Ratio 0.003% Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha -0.004 Beta -0.057 Annual Standard Deviation 0.031 Annual Variance 0.001 Information Ratio -0.406 Tracking Error 0.182 Treynor Ratio 0.132 Total Fees $0.00 Estimated Strategy Capacity $1100000.00 Lowest Capacity Asset USDEUR 8G Portfolio Turnover 0.02% |
# region imports from AlgorithmImports import * # endregion class ForexCarryTradeAlgorithm(QCAlgorithm): def Initialize(self): self.SetStartDate(2008, 1, 1) self.SetEndDate(2022, 12, 1) self.SetCash(25000) 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 } self.symbols = {} for ticker, rate_symbol in rate_symbol_by_ticker.items(): forex_symbol = self.AddForex(ticker, Resolution.Daily, Market.Oanda).Symbol data_symbol = self.AddData(NasdaqDataLink, rate_symbol, Resolution.Daily, TimeZones.Utc, True).Symbol self.symbols[str(forex_symbol)] = data_symbol self.Schedule.On(self.DateRules.MonthStart("USDEUR"), self.TimeRules.BeforeMarketClose("USDEUR"), self.Rebalance) def Rebalance(self): top_symbols = sorted(self.symbols, key = lambda x: self.Securities[self.symbols[x]].Price) self.SetHoldings(top_symbols[0], -0.5) self.SetHoldings(top_symbols[-1], 0.5)