Overall Statistics |
Total Trades 8 Average Win 0.33% Average Loss -0.15% Compounding Annual Return 3.555% Drawdown 0.700% Expectancy 0.616 Net Profit 0.563% Sharpe Ratio 2.066 Probabilistic Sharpe Ratio 67.895% Loss Rate 50% Win Rate 50% Profit-Loss Ratio 2.23 Alpha 0.026 Beta 0.062 Annual Standard Deviation 0.012 Annual Variance 0 Information Ratio 0.372 Tracking Error 0.127 Treynor Ratio 0.398 Total Fees $6.00 Estimated Strategy Capacity $990000.00 Lowest Capacity Asset IBM VOBM1Z09FM2U|IBM R735QTJ8XC9X Portfolio Turnover 1.56% |
#region imports using System; using System.Linq; using QuantConnect.Util; using QuantConnect.Data; using QuantConnect.Securities; using QuantConnect.Securities.Option; #endregion namespace QuantConnect.Algorithm.CSharp { public class CoveredCallAlgorithm : QCAlgorithm { private Symbol _call, _symbol; public override void Initialize() { SetStartDate(2014, 1, 1); SetEndDate(2014, 3, 1); SetCash(100000); var option = AddOption("IBM"); _symbol = option.Symbol; option.SetFilter(-3, 3, 0, 31); // use the underlying equity as the benchmark SetBenchmark(_symbol.Underlying); } public override void OnData(Slice slice) { if (_call != null && Portfolio[_call].Invested) return; if (!slice.OptionChains.TryGetValue(_symbol, out var chain)) return; // Find ATM call with the farthest expiry var expiry = chain.Max(x => x.Expiry); var atmCall = chain .Where(x=> x.Right == OptionRight.Call && x.Expiry == expiry) .OrderBy(x => Math.Abs(x.Strike - chain.Underlying.Price)) .FirstOrDefault(); if (atmCall == null) return; var coveredCall = OptionStrategies.CoveredCall(_symbol, atmCall.Strike, expiry); Buy(coveredCall, 1); _call = atmCall.Symbol; } } }