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

AddLegsAdjustment #34

Closed
tibkiss opened this issue Apr 6, 2023 · 2 comments
Closed

AddLegsAdjustment #34

tibkiss opened this issue Apr 6, 2023 · 2 comments
Labels
enhancement 🚀 New feature or request
Milestone

Comments

@tibkiss
Copy link
Member

tibkiss commented Apr 6, 2023

Add Leg Adjustment enables users to add a Leg after the position is initiated.
The flexibility of adding a leg must be similar to the flexibility present at trade initiation:

  • Expiration should be selected to either match previous legs or target new expirations (support of rolling)
  • Strikes should be selected using the StrikeSelector component
  • AbortConditions should be added so that it is possible to abort entry in unfavorable conditions (e.g. leg price too high)
  • AddLegAdjustment should be combined with a MoveLeg and/or RemoveLeg Adjustment
    "ConditionalAdjustments": {
      "pos_delta > 40": {
        "MoveLegAdjustment": null,
        "RemoveLegAdjustment": null,
        "AddLegAdjustment": {
          "LegName": "to_be_added",
          "Qty": "1",
          "Expiration": {
            "Name": "exp2",
            "DTE": "expiration_exp1_dte",
            "Min": null,
            "Max": null,
            "Roots": null
          },
          "OptionType": "Call",
          "StrikeSelector": {
            "Delta": "12"
          },
          "AbortConditions": [
             "leg_to_be_added_price > 2"
          ]
        }
      }
    },
    "MaxAdjustmentCount": null
  },
@tibkiss tibkiss added this to the Version 2.7 milestone Apr 6, 2023
@tibkiss tibkiss added the enhancement 🚀 New feature or request label Apr 6, 2023
@tibkiss
Copy link
Member Author

tibkiss commented Apr 23, 2023

Delivered with v2.7

@tibkiss tibkiss closed this as completed Apr 23, 2023
@tibkiss tibkiss changed the title AddLegAdjustment AddLegsAdjustment Apr 23, 2023
@tibkiss
Copy link
Member Author

tibkiss commented Apr 23, 2023

The final version's Job Definition allows creating multiple legs and leverages Legs and Expirations structures within AddLegsAdjustment:

 "ConditionalAdjustments": {
      "open_trades_cnt == 1": {
        "MoveLegAdjustment": null,
        "RemoveLegAdjustment": null,
        "AddLegsAdjustment": {
          "Legs": [
            {
              "Name": "pds_short",
              "Qty": "-1",
              "ExpirationName": "exp2",
              "StrikeSelector": {
                "Min": 5,
                "Max": 15,
                "BidPrice": null,
                "AskPrice": null,
                "MidPrice": null,
                "Delta": "10",
                "Gamma": null,
                "Theta": null,
                "Vega": null,
                "WVega": null,
                "Rho": null,
                "IV": null,
                "Statement": null
              },
              "OptionType": "Put"
            },
            {
              "Name": "pds_long",
              "Qty": "1",
              "ExpirationName": "exp2",
              "StrikeSelector": {
                "Min": 10,
                "Max": 20,
                "BidPrice": null,
                "AskPrice": null,
                "MidPrice": null,
                "Delta": "15",
                "Gamma": null,
                "Theta": null,
                "Vega": null,
                "WVega": null,
                "Rho": null,
                "IV": null,
                "Statement": null
              },
              "OptionType": "Put"
            }
          ],
          "Expirations": [
            {
              "Name": "exp2",
              "DTE": "expiration_exp1_dte + 100",
              "Min": null,
              "Max": null,
              "Roots": null
            }
          ],
          "AbortConditions": null
        }
      }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement 🚀 New feature or request
Projects
Status: Done
Development

No branches or pull requests

1 participant