Hello,
I have been working with alpaca_trade_api since I began working with Alpaca in June. Last night, I started receiving an endpoint error that would not resolve, so I migrated over to alpaca-py, and encountered a major obstacle in that I’m unable to “close_all_positions” on any crypto assets. I see that the stock I had in my portfolio had a sell order submitted, but just not crypto. I was very pleased by how much more quickly the market data downloaded and processed with the new alpaca-py, but I can’t possibly continue to build my strategy if this function does not work. I had no problem pulling market data or submitting orders with alpaca-py. Code looks like this:
#working on paper-trading
from alpaca.trading.client import TradingClient
tc = TradingClient(APCA_API_KEY_ID, APCA_API_SECRET_KEY, paper=True)
tc.close_all_positions(cancel_orders=True)
#and I get a bunch of errors in the terminal:
File “pydantic\tools.py”, line 38, in pydantic.tools.parse_obj_as
File “pydantic\main.py”, line 341, in pydantic.main.BaseModel.init
pydantic.error_wrappers.ValidationError: 90 validation errors for ParsingModel[List[alpaca.trading.models.ClosePositionResponse]]
root → 0 → body → available
field required (type=value_error.missing)
root → 0 → body → existing_qty
field required (type=value_error.missing)
root → 0 → body → held_for_orders
field required (type=value_error.missing)
root → 0 → body → symbol
field required (type=value_error.missing)
root → 0 → body → id
field required (type=value_error.missing)
root → 0 → body → client_order_id
field required (type=value_error.missing)
root → 0 → body → created_at
field required (type=value_error.missing)
root → 0 → body → updated_at
field required (type=value_error.missing)
root → 0 → body → submitted_at
field required (type=value_error.missing)
root → 0 → body → asset_id
field required (type=value_error.missing)
root → 0 → body → symbol
field required (type=value_error.missing)
root → 0 → body → asset_class
field required (type=value_error.missing)
root → 0 → body → order_type
field required (type=value_error.missing)
root → 0 → body → type
field required (type=value_error.missing)
root → 0 → body → side
field required (type=value_error.missing)
root → 0 → body → time_in_force
field required (type=value_error.missing)
etc…it goes on for a while.