Overall Statistics |
Total Orders 8 Average Win 0% Average Loss 0% Compounding Annual Return 2.552% Drawdown 18.200% Expectancy 0 Net Profit 50.435% Sharpe Ratio 0.076 Sortino Ratio 0.099 Probabilistic Sharpe Ratio 0.054% Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 0.016 Beta -0.162 Annual Standard Deviation 0.058 Annual Variance 0.003 Information Ratio -0.322 Tracking Error 0.2 Treynor Ratio -0.027 Total Fees $0.00 Estimated Strategy Capacity $970000.00 Lowest Capacity Asset USDJPY 8G Portfolio Turnover 0.02% |
#region imports using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Globalization; using System.Drawing; using QuantConnect; using System.Text.RegularExpressions; using QuantConnect.Algorithm.Framework; using QuantConnect.Algorithm.Framework.Selection; using QuantConnect.Algorithm.Framework.Alphas; using QuantConnect.Algorithm.Framework.Portfolio; using QuantConnect.Algorithm.Framework.Execution; using QuantConnect.Algorithm.Framework.Risk; using QuantConnect.Algorithm.Selection; using QuantConnect.Parameters; using QuantConnect.Benchmarks; using QuantConnect.Brokerages; using QuantConnect.Util; using QuantConnect.Interfaces; using QuantConnect.Algorithm; using QuantConnect.Indicators; using QuantConnect.Data; using QuantConnect.Data.Consolidators; using QuantConnect.Data.Custom; using QuantConnect.DataSource; using QuantConnect.Data.Fundamental; using QuantConnect.Data.Market; using QuantConnect.Data.UniverseSelection; using QuantConnect.Notifications; using QuantConnect.Orders; using QuantConnect.Orders.Fees; using QuantConnect.Orders.Fills; using QuantConnect.Orders.Slippage; using QuantConnect.Scheduling; using QuantConnect.Securities; using QuantConnect.Securities.Equity; using QuantConnect.Securities.Future; using QuantConnect.Securities.Option; using QuantConnect.Securities.Forex; using QuantConnect.Securities.Crypto; using QuantConnect.Securities.Interfaces; using QuantConnect.Storage; using QCAlgorithmFramework = QuantConnect.Algorithm.QCAlgorithm; using QCAlgorithmFrameworkBridge = QuantConnect.Algorithm.QCAlgorithm; #endregion namespace QuantConnect { public class ForexCarryTradeAlgorithm : QCAlgorithm { private int _month = -1; private Dictionary<string, decimal> _rates; public override void Initialize() { SetStartDate(2008, 1, 1); SetCash(25000); // We will use hard-coded interest rates _rates = new Dictionary<string, decimal>() { {"USDAUD", 1.5m}, // Australia {"USDCAD", 0.5m}, // Canada {"USDCNY", 4.35m}, // China {"USDEUR", 0.0m}, // Euro Area {"USDINR", 6.5m}, // India {"USDJPY", -0.1m}, // Japan {"USDMXN", 4.25m}, // Mexico {"USDTRY", 7.5m}, // Turkey {"USDZAR", 7.0m} // South Africa }; foreach (var ticker in _rates.Keys) { AddForex(ticker, Resolution.Daily, Market.Oanda); } } public override void OnData(Slice slice) { if (_month == Time.Month) return; _month = Time.Month; var sortedRates = (from kvp in _rates orderby kvp.Value ascending select kvp.Key).ToArray(); SetHoldings(sortedRates[0], -0.5); SetHoldings(sortedRates[sortedRates.Length-1], 0.5); } } }