Skip to content

OrderBuilder support for priceOffset #217

@TylerJewell

Description

@TylerJewell

Is your feature request related to a problem? Please describe.
With the Schwab API, it's possible to do a one-triggers-sequence where the child order's limit price is determined as an offset of the parent child's order price, called a priceOffset. This is achieved with priceLink, which OrderBuilder provides, but there is no way to set priceOffset with OrderBuilder.

Describe the solution you'd like
Add method OrderBuilder().set_price_offset(price) which will populate the "priceOffset" field in the REST API.

Describe alternatives you've considered
You can make this work today with a raw_order.

Additional context
This is the JSON of a raw_order that is accepted by Schwab API. This order buys an asset and then immediately triggers a limit sell at $.20 higher than what it was purchased at.

    raw_order = {
                "session": "SEAMLESS",
                "duration": "GOOD_TILL_CANCEL",
                "orderType": "LIMIT",
                "price": 40.0,
                "orderLegCollection": [
                        {
                                "instrument": {
                                        "assetType": "EQUITY",
                                        "symbol": "TQQQ",
                                },
                                "instruction": "BUY",
                                "quantity": 100.0
                        }
                ],
                "orderStrategyType": "TRIGGER",
                "childOrderStrategies": [
                        {
                                "session": "SEAMLESS",
                                "duration": "GOOD_TILL_CANCEL",
                                "orderType": "LIMIT",
                                "priceLinkBasis": "TRIGGER",
                                "priceLinkType": "VALUE",
                                "priceOffset": 0.2,
                                "orderLegCollection": [
                                        {
                                                "instrument": {
                                                    "assetType": "EQUITY",
                                                    "symbol": "TQQQ",
                                                },
                                                "instruction": "SELL",
                                                "quantity": 100.0
                                        }
                                ],
                                "orderStrategyType": "SINGLE",
                        }
                ]
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions