Overall Statistics
Total Orders
3
Average Win
0.56%
Average Loss
0%
Compounding Annual Return
0.636%
Drawdown
0.600%
Expectancy
0
Start Equity
100000
End Equity
100102
Net Profit
0.102%
Sharpe Ratio
-0.194
Sortino Ratio
-0.329
Probabilistic Sharpe Ratio
36.612%
Loss Rate
0%
Win Rate
100%
Profit-Loss Ratio
0
Alpha
-0.006
Beta
-0.093
Annual Standard Deviation
0.015
Annual Variance
0
Information Ratio
0.183
Tracking Error
0.148
Treynor Ratio
0.032
Total Fees
$2.00
Estimated Strategy Capacity
$28000.00
Lowest Capacity Asset
IBM VNWUCLACI1RA|IBM R735QTJ8XC9X
Portfolio Turnover
0.01%
#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 NakedCallAlgorithm : 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(universe => universe.IncludeWeeklys().NakedCall(30, 0));

            // 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 nakedCall = OptionStrategies.NakedCall(_symbol, atmCall.Strike, expiry);
            Buy(nakedCall, 1);

            _call = atmCall.Symbol;
        }
    }
}