Skip to content

Remove the extra contract unit from the assignment exercise estimate - #10233

Merged
quantconnect-kronos[bot] merged 1 commit into
masterfrom
kronos/bug-9942-assignment-contract-unit
Nov 24, 2026
Merged

quantconnect-kronos[bot] merged 1 commit into
masterfrom
kronos/bug-9942-assignment-contract-unit

Conversation

@quantconnect-kronos

Copy link
Copy Markdown
Contributor

Description

DefaultOptionAssignmentModel.EstimateArbitragePnL multiplied the gross exercise proceeds by ContractUnitOfTrade, but the underlying quantity it multiplies already comes from Option.GetExerciseQuantity, which includes that factor. For a standard 100-share contract the exercise side was 100 times too large, so short deep in-the-money American options inside the model's four-day window were assigned even when selling the option was worth more than exercising it.

This removes the extra factor. The option-value terms, fees, settlement handling and the deep-in-the-money and expiry filters are unchanged; contracts with a unit of 1, which the existing tests use, behave as before.

The fix is the commit from #9943 by @Jackmeson1, cherry-picked with its authorship kept.

Related Issue

Closes #9942

Motivation and Context

The model is meant to simulate early assignment only when the option has close to no time value left. With the double-counted unit it assigned nearly every eligible standard equity option.

Requires Documentation Change

No.

How Has This Been Tested?

  • New DefaultOptionAssignmentModelTests.SimulatesAssignmentWithContractUnitOfTrade (8 cases): calls and puts, units 100 and 1, zero fees, three days before expiry, 15% in the money. An option bid above the exercise-and-close value (31.50 vs 29.99) must not be assigned, one below it (29.50) must. The two unit-100 time-value cases fail on master (expected 0, actual 1) and all eight pass with the fix.
  • Full test suite, as CI runs it (TestCategory!=TravisExclude&TestCategory!=ResearchRegressionTests): 39999 passed, 112 skipped, 0 failed.
  • Tested end to end with a backtest holding about 50 short SPY options expiring 2024-03-15, 5–15% in the money, zero fees, 2024-03-12 to 2024-03-14, failing whenever a simulated assignment happened while the option's bid exceeded its exercise value at the underlying bid/ask:
    • master: fails on the first assignment, a 440 call assigned with bid 73.45 above its exercise value 73.44.
    • this change: 527 simulated assignments, all with the bid at or below the exercise value; the shorts with time value left were not assigned.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

DefaultOptionAssignmentModel.EstimateArbitragePnL takes the underlying
quantity from GetExerciseQuantity, which already includes the contract
unit, and then multiplied the exercise proceeds by ContractUnitOfTrade
again. For a 100-share contract this inflated the gross exercise proceeds
100 times, so eligible short options could be assigned early even when
selling was worth more than exercising. Drop the extra factor;
contracts with a unit of 1 are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019TTGAv6fe859ebbCLLfLHP
Signed-off-by: Jackmeson1 <130693642+Jackmeson1@users.noreply.github.com>
@quantconnect-kronos quantconnect-kronos Bot added kronos:develop:working develop: in progress kronos:review Request review labels Nov 24, 2026
@quantconnect-kronos-reviewer quantconnect-kronos-reviewer Bot added kronos:review:queued review: queued kronos:review:working review: in progress and removed kronos:review Request review kronos:review:queued review: queued labels Nov 24, 2026
@quantconnect-kronos-reviewer
quantconnect-kronos-reviewer Bot marked this pull request as ready for review November 24, 2026 21:24

@quantconnect-kronos-reviewer quantconnect-kronos-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. GetExerciseQuantity already multiplies by ContractUnitOfTrade, so dropping the second factor is the right fix. The exercise side now matches the selling side for calls and puts, and contracts with a unit of 1 behave as before.

What I checked:

  • With master's model, the new test's two unit-100 time-value cases fail (expected 0, actual 1). All 10 DefaultOptionAssignmentModelTests pass with the change.
  • I ran my own backtest: 20 short SPY options expiring 2024-03-15, 5–15% in the money, zero fees, 2024-03-12 to 2024-03-14. On master all 20 were assigned at the first check, every one while its bid was above its exercise value (e.g. the 440 call, bid 73.45 vs 73.44). With the change 18 were assigned, none with time value left.

Not covered here, and the same before and after this change: futures options are never assigned early because the exercise side leaves out the future's multiplier. That is now #10234.

I set risk:low: it's a one-line fix that is easy to revert, CI is green, the new tests fail without it, and the end-to-end runs show only the incorrect assignments go away.

@quantconnect-kronos-reviewer quantconnect-kronos-reviewer Bot added risk:low Low risk and removed kronos:review:working review: in progress labels Nov 24, 2026
@quantconnect-kronos quantconnect-kronos Bot added the kronos:review Request review label Nov 24, 2026
@quantconnect-kronos-reviewer quantconnect-kronos-reviewer Bot added kronos:review:queued review: queued and removed kronos:review Request review labels Nov 24, 2026
@quantconnect-kronos-reviewer-2 quantconnect-kronos-reviewer-2 Bot added kronos:review:working review: in progress and removed kronos:review:queued review: queued labels Nov 24, 2026

@quantconnect-kronos-reviewer-2 quantconnect-kronos-reviewer-2 Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. GetExerciseQuantity already includes the contract unit; removing the second multiplication corrects the exercise estimate without changing fees, settlement handling or eligibility filters.

Independent verification:

  • All 100 assignment-model and portfolio-manager tests pass. Substituting master's model makes exactly the two new unit-100 time-value cases fail; restoring this change passes all 10 assignment-model cases.
  • Tested end to end with eight short SPY calls and puts expiring March 15, 2024, over March 12–14, with zero fees. Master assigns a 440 call despite its bid of 73.45 exceeding its exercise value of 73.44. With this change, all seven assignments pass the exercise-value assertion, and 56 assignment checks preserve options with time value.

No blocking findings.

@quantconnect-kronos-reviewer-2 quantconnect-kronos-reviewer-2 Bot removed the kronos:review:working review: in progress label Nov 24, 2026
@quantconnect-kronos
quantconnect-kronos Bot merged commit adac927 into master Nov 24, 2026
8 checks passed
@quantconnect-kronos
quantconnect-kronos Bot deleted the kronos/bug-9942-assignment-contract-unit branch November 24, 2026 21:35
@quantconnect-kronos quantconnect-kronos Bot removed the kronos:develop:working develop: in progress label Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:low Low risk

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DefaultOptionAssignmentModel counts the contract unit twice in the exercise estimate

1 participant