alpacahq / alpaca-py

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

[Bug]: Error messages not propagated #337

Open alessiocastrica opened 11 months ago

alessiocastrica commented 11 months ago

Is there an existing issue for this?

Current Behavior

There are several endpoints that return additional data for an error other than the code and message that we should propagate in the SDK an example: {"code":40310000,"day_trading_buying_power":"43251.29","max_dtbp_used":"43370.5226","max_dtbp_used_so_far":"12805.2817","message":"day trading margin call protection","open_orders":"283","symbol":"ID"}

Expected Behavior

The full response body should be mapped in case of errors too.

SDK Version I encountered this issue in

0.10.0

Steps To Reproduce

1. Sending an order without enough buying power
2. Compare the SDK output with the direct API response

Filled out the Steps to Reproduce section?

Anything else?

No response