Overall Statistics |
Total Trades 47 Average Win 0.90% Average Loss -0.12% Compounding Annual Return 4.383% Drawdown 16.500% Expectancy 2.912 Net Profit 89.717% Sharpe Ratio 0.51 Probabilistic Sharpe Ratio 0.973% Loss Rate 55% Win Rate 45% Profit-Loss Ratio 7.61 Alpha 0.047 Beta -0.185 Annual Standard Deviation 0.063 Annual Variance 0.004 Information Ratio -0.221 Tracking Error 0.209 Treynor Ratio -0.173 Total Fees $0.00 Estimated Strategy Capacity $980000.00 Lowest Capacity Asset USDTRY 8G |
# 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)