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

Normalize Combo Limit Price #7996

Closed
4 tasks done
AlexCatarino opened this issue May 3, 2024 · 0 comments · Fixed by #8024
Closed
4 tasks done

Normalize Combo Limit Price #7996

AlexCatarino opened this issue May 3, 2024 · 0 comments · Fixed by #8024
Assignees
Labels

Comments

@AlexCatarino
Copy link
Member

Expected Behavior

The limit price of combo orders obeys the minimum price variation.

Actual Behavior

The limit price is not rounded down.

Potential Solution

Add rounding rule to RoundOrderPrices method.

Reproducing the Problem

private List<Leg> _legs;

public override void Initialize() {
    SetStartDate(2013, 10, 07);

    var index = AddIndex("SPX").Symbol;
    Symbol getSymbol(decimal strike) => QuantConnect.Symbol.CreateOption(index, "SPXW", Market.USA, OptionStyle.European, OptionRight.Put, strike, DateTime.Today);

    _legs = new() { Leg.Create(getSymbol(5150), 1), Leg.Create(getSymbol(5200), -1) };
    foreach(var leg in _legs)
    {
        AddIndexOptionContract(leg.Symbol).SetMarketPrice(new Tick(DateTime.UtcNow, leg.Symbol, 1.35m, 1.30m, 1.40m));
    } 
}

public override void OnWarmupFinished() {
    if (_legs.Any(x=> !Portfolio[x.Symbol].Invested)) {
        ComboLimitOrder(_legs, 1, -0.123456789m);   // <---
    }
}

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

Successfully merging a pull request may close this issue.

2 participants