Overall Statistics
Total Trades
0
Average Win
0%
Average Loss
0%
Compounding Annual Return
0%
Drawdown
0%
Expectancy
0
Net Profit
0%
Sharpe Ratio
0
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
0
Beta
0
Annual Standard Deviation
0
Annual Variance
0
Information Ratio
0
Tracking Error
0
Treynor Ratio
0
Total Fees
$0.00
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using QuantConnect.Data;
using QuantConnect.Data.Market;
using QuantConnect.Indicators;
using QuantConnect.Orders;
using QuantConnect.Securities;
using QuantConnect.Securities.Option;

namespace QuantConnect.Algorithm.CSharp.Options
{
    public class SellingCoveredCallsAlgorithm : QCAlgorithm
    {
        const string underlyingTicker = "PFE";
        public readonly decimal cash = 20000;

        public readonly int minExpirationDays = 0;
        public readonly int maxExpirationDays = 30;
        public readonly int minStrike = -5;
        public readonly int maxStrike = 5;

        public readonly Symbol underlying = QuantConnect.Symbol.Create(underlyingTicker, SecurityType.Equity, Market.USA);
        public readonly Symbol optionSymbol = QuantConnect.Symbol.Create(underlyingTicker, SecurityType.Option, Market.USA);

        DateTime startDate = new DateTime(2016, 1, 1);
        DateTime endDate = new DateTime(2016, 1, 5);

        public override void Initialize()
        {
            this.SetStartDate(startDate);
            this.SetEndDate(endDate);
            this.SetCash(cash);

            this.AddEquity(underlyingTicker);
            this.SetBenchmark(this.underlying);

            var option = this.AddOption(underlyingTicker);
            option.SetFilter(universe => from symbol in universe.Strikes(minStrike, maxStrike).IncludeWeeklys().Expiration(TimeSpan.FromDays(this.minExpirationDays), TimeSpan.FromDays(this.maxExpirationDays)) select symbol);
        }

        public override void OnData(Slice slice)
        {
            decimal stockPrice = this.Securities[this.underlying].Price;
            this.Log("stockPrice=" + stockPrice);
        }
    }
}