alpacahq / alpaca-py

The Official Python SDK for Alpaca API
https://alpaca.markets/sdks/python/getting_started.html
Apache License 2.0
491 stars 122 forks source link

[Bug]: TradeAccount validation error #436

Closed gageorsburn closed 3 months ago

gageorsburn commented 3 months ago

Is there an existing issue for this?

Current Behavior

Alpaca's API was updated to send a new response that the client isn't able to validate for the TradeAccount resource.

ValidationError

1 validation error for TradeAccount
clearing_broker
  Input should be 'APEX', 'ETC', 'IC', 'VELOX', 'VISION' or 'SELF' [type=enum, input_value='ALPACA_APCA', input_type=str]

Expected Behavior

I expect the client to be able to validate this resource.

SDK Version I encountered this issue in

v0.20.1

Steps To Reproduce

Fetch any TradeAccount using the SDK:

broker_client.get_trade_account_by_id("<id>")


### Filled out the Steps to Reproduce section?

- [X] 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?

I've submitted and fixed a number of these issues that have popped up over a year or so. Maybe it's worth looking into how you can keep the client and the api versions more in sync with automation rather than relying on me or others in the community to flag and fix them.
hiohiohio commented 3 months ago

@gageorsburn Thank you for the report. Could you please try to use latest version of alpaca-py? This issue is fixed in v0.20.2. PR: https://github.com/alpacahq/alpaca-py/pull/434

gageorsburn commented 3 months ago

Whoops sorry I didn't see the issue open this morning because you fixed it this morning. Awesome. Thanks!