Skip to content

[Bug]: limit_price optional for LimitOrderRequest #627

@spaceage64

Description

@spaceage64

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

requests.py

In this file, for class LimitOrderRequest, limit_price is set to be an optional attribute (i.e., limit_price (Optional[float]), even though it is required (even though this may seem obvious I have tested this and it really is required). it should be changed to limit_price (float).

Expected Behavior

it should require the attribute limit_price.

SDK Version I encountered this issue in

alpaca-py version: v0.42.1

Steps To Reproduce

1. I cannot share my code because it's customized, but just submit an order using LimitOrderRequest but without the limit_price attribute.
2. You will see something like this:

pydantic_core._pydantic_core.ValidationError: 1 validation error for LimitOrderRequest
  Value error, limit_price is required [type=value_error, input_value={'symbol': 'AAPL', 'qty':...derType.LIMIT: 'limit'>}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.11/v/value_error

3. If you do use limit_price, your order will go through just fine.

Filled out the Steps to Reproduce section?

  • I have entered valid steps to reproduce my issue or have attached a minimally reproducible case in code that shows my issue happening; and understand that without this my issue will be flagged as invalid and closed after 30 days.

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions