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

fix: Set position_intent optional #541

Merged
merged 1 commit into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions alpaca/trading/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ class Order(ModelWithID):
trail_percent (Optional[str]): The percent value away from the high water mark for trailing stop orders.
trail_price (Optional[str]): The dollar value away from the high water mark for trailing stop orders.
hwm (Optional[str]): The highest (lowest) market price seen since the trailing stop order was submitted.
position_intent (PositionIntent): Represents the desired position strategy.
position_intent (Optional[PositionIntent]): Represents the desired position strategy.
"""

client_order_id: str
Expand Down Expand Up @@ -239,7 +239,7 @@ class Order(ModelWithID):
trail_percent: Optional[str] = None
trail_price: Optional[str] = None
hwm: Optional[str] = None
position_intent: PositionIntent
position_intent: Optional[PositionIntent] = None

def __init__(self, **data: Any) -> None:
if "order_class" not in data or data["order_class"] == "":
Expand Down
3 changes: 1 addition & 2 deletions tests/trading/trading_client/test_order_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,7 @@ def test_get_orders(reqmock, trading_client: TradingClient):
"extended_hours": true,
"trail_percent": null,
"trail_price": null,
"hwm": "string",
"position_intent": "buy_to_open"
"hwm": "string"
}
]
""",
Expand Down
Loading