QuantConnect / Lean

Lean Algorithmic Trading Engine by QuantConnect (Python, C#)
https://lean.io
Apache License 2.0
9.47k stars 3.21k forks source link

Penny Pilot Program for Options Pricing #8191

Open Romazes opened 2 months ago

Romazes commented 2 months ago

Expected Behavior

The Lean Algorithm should support the Penny Pilot Program, allowing options on eligible securities to be quoted and traded in $0.01 increments for quotes below $3.00 and $0.05 increments for quotes at or above $3.00.

Actual Behavior

Currently, when attempting to update an order on an option such as AAPL with an expiration date of 2024/07/19 and a strike price of 215 (Right: Call), the system throws an error indicating that the price is not rounded to a valid increment. For example, attempting to place an order at a price of 18.12 results in an error like "18.12000000 not rounded to a valid price increment [0.05]".

Potential Solution

  1. Identify Eligible Securities: Update the symbol and market data handling to identify securities included in the Penny Pilot Program.
  2. Modify Price Increment Logic: Adjust the order processing logic to allow $0.01 increments for options priced below $3.00 and maintain $0.05 increments for options priced at or above $3.00.
  3. Validation Updates: Ensure the order validation process supports the new price increment rules for eligible options.
  4. Testing and Verification: Implement unit and integration tests to ensure that options eligible under the Penny Pilot Program are correctly handled and that price increments are properly validated.

Reproducing the Problem

  1. Create a new algorithm in the Lean.
  2. Use the following code to define an option contract:
    var AAPLOption = Symbol.CreateOption(Symbols.AAPL, Market.USA, OptionStyle.American, OptionRight.Call, 215m, new DateTime(2024, 7, 19));
  3. Attempt to update an order for the AAPL option with a price increment of $0.01, such as 18.12
  4. Observe the error indicating that the price is not rounded to a valid increment:
    18.12000000 not rounded to a valid price increment [0.05]

    Please ensure that the Lean Algorithm Framework is updated to handle the Penny Pilot Program pricing increments correctly.

System Information

OS: Windows 10 x64 test: run on x64 CPU IDE: Visual Studio 2022

Additional Sources

Checklist

Martin-Molinero commented 1 month ago

IB does not enforce this behavior, TradeStation does, so we have IndexOptionSymbolProperties which is dynamic based on price, we feed prices in, maybe we could have OptionSymbolProperties.PennyProgramEnabled { set; } which TS brokerage model set to true, we update it with market price and it dynamically changes the options SPDB kind of like the index one, just that enabled only for TS