question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug]: 1 validation error for Order legs -> 0 -> status

See original GitHub issue

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

When I try to submit an OTO order, the order is submitted, but I get an error.

The code I use to submit the OTO order:

stock ='AAPL'
LO = LimitOrderRequest(symbol=stock, limit_price=188, qty=1, side=OrderSide.BUY, time_in_force=TimeInForce.GTC, order_class=OrderClass.OTO, take_profit=dict(limit_price=189) )
api.submit_order(order_data=LO)

The error I get when the OTO order is submitted:

1 validation error for Order
legs -> 0 -> status
  value is not a valid enumeration member; permitted: 'new', 'partially_filled', 'filled', 'done_for_day', 'canceled', 'expired', 'replaced', 'pending_cancel', 'pending_replace', 'accepted', 'pending_new', 'accepted_for_bidding', 'stopped', 'rejected', 'suspended', 'calculated' (type=type_error.enum; enum_values=[<OrderStatus.NEW: 'new'>, <OrderStatus.PARTIALLY_FILLED: 'partially_filled'>, <OrderStatus.FILLED: 'filled'>, <OrderStatus.DONE_FOR_DAY: 'done_for_day'>, <OrderStatus.CANCELED: 'canceled'>, <OrderStatus.EXPIRED: 'expired'>, <OrderStatus.REPLACED: 'replaced'>, <OrderStatus.PENDING_CANCEL: 'pending_cancel'>, <OrderStatus.PENDING_REPLACE: 'pending_replace'>, <OrderStatus.ACCEPTED: 'accepted'>, <OrderStatus.PENDING_NEW: 'pending_new'>, <OrderStatus.ACCEPTED_FOR_BIDDING: 'accepted_for_bidding'>, <OrderStatus.STOPPED: 'stopped'>, <OrderStatus.REJECTED: 'rejected'>, <OrderStatus.SUSPENDED: 'suspended'>, <OrderStatus.CALCULATED: 'calculated'>])

Expected Behavior

The order should be submitted without any error.

SDK Version I encountered this issue in

alpaca-py 0.5.4

Steps To Reproduce

Try to submit an OTO order with alpaca-py 0.5.4

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?

Adding order_status=OrderStatus.NEW does not solve the problem

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:13 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
haxddscommented, Oct 20, 2022

@impredicative @sshcli

Unfortunately, there’s been a lack of maintenance and it’s partly due to being spread kind of thin across a few projects. There will be an additional person starting to help maintain this repo so that should help a bit.

Thank you @sshcli for testing the latest release! Any open source contributions would be very much appreciated. If you would like to join the Alpaca team, the best bet might be to reach out to Hitoshi Harada or through the Alpaca careers site.

1reaction
yohay13commented, Oct 20, 2022

I will test it too

Read more comments on GitHub >

github_iconTop Results From Across the Web

alpaca-py StopOrderRequest bug related to status of bracket ...
I spoke to Alpaca support. It turns out that the leg orders (take profit and stop loss) generate a status of 'held,' which...
Read more >
APIKit validation error "Underlying error while parsing YAML ...
This looks to me like a bug in the APIKit validation implementation, to me both inputs should return the first error shown.
Read more >
Order validation error: The value provided for attribute Bill-to ...
Symptoms. Order validation error: The value provided for attribute Bill-to Location assigned to set <Reference Data Set name> does not belong ...
Read more >
Change Sets Error Message - Salesforce Developer Community
1. Create change set in Full Copy sb, moving to Prod. ... The first validation error encountered was "Package member already ... Argh....
Read more >
Field Notice: FN - 63942 - Wireless Lightweight Access Points ...
Notice. THIS FIELD NOTICE IS PROVIDED ON AN "AS IS" BASIS AND DOES NOT IMPLY ANY KIND OF GUARANTEE OR WARRANTY, INCLUDING THE...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found