Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing Automatic Exercise #8152

Open
4 tasks done
AlexCatarino opened this issue Jul 5, 2024 · 0 comments
Open
4 tasks done

Missing Automatic Exercise #8152

AlexCatarino opened this issue Jul 5, 2024 · 0 comments
Labels

Comments

@AlexCatarino
Copy link
Member

Expected Behavior

LEAN provides an order event for every expiration.

Actual Behavior

When a leg of Bull Put Spread is assigned earlier, we don't get the assignment/exercise of the other leg because of buying power.

Potential Solution

N/A

Reproducing the Problem

namespace QuantConnect.Algorithm.CSharp {    
    public class LogicalBlueLemur : QCAlgorithm {
        private Symbol _spxw;

        private bool _done;

        public override void Initialize() {
            SetStartDate(2022, 1, 21);
            SetEndDate(2022, 1, 26);
            SetCash(10000);
            var option = AddIndexOption(AddIndex("SPX").Symbol, "SPXW");
            option.SetFilter((x) => x.IncludeWeeklys().Strikes(-5, 5).Expiration(1, 4));
            _spxw = option.Symbol;
        }

        public override void OnData(Slice slice) {            
            if (_done) return;
            Buy(OptionStrategies.BullPutSpread(_spxw, 4490, 4485, new DateTime(2022, 1, 24)), 1);
            _done = true;
        }
    }
}

When we replace the starting cash from 10,000 to 20,000, the 4th order is recorded.

Checklist

  • I have completely filled out this template
  • I have confirmed that this issue exists on the current master branch
  • I have confirmed that this is not a duplicate issue by searching issues
  • I have provided detailed steps to reproduce the issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant