You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am requesting all document types (account statements, tax, and trade confs) so I do this by leaving the optional TradeDocumentType parameter as None. According to the API documentation this parameter is also optional.
However, the API is returning documents that are not supported by the TradeDocumentType enumeration. Specifically... in addition to trade_confirmation type documents I am also receiving trade_confirmation_json type documents. Because this document type is unknown enumeration to the SDK it crashes (pydantic error) when trying to parse the result.
Snippet of the crash:
__root__ -> 7 -> type
value is not a valid enumeration member; permitted: 'account_statement', 'trade_confirmation', 'tax_statement', 'tax_1099_b_details', 'tax_1099_b_form', 'tax_1099_div_details', 'tax_1099_div_form', 'tax_1099_int_details', 'tax_1099_int_form', 'tax_w8' (type=type_error.enum; enum_values=[<TradeDocumentType.ACCOUNT_STATEMENT: 'account_statement'>, <TradeDocumentType.TRADE_CONFIRMATION: 'trade_confirmation'>, <TradeDocumentType.TAX_STATEMENT: 'tax_statement'>, <TradeDocumentType.TAX_1099_B_DETAILS: 'tax_1099_b_details'>, <TradeDocumentType.TAX_1099_B_FORM: 'tax_1099_b_form'>, <TradeDocumentType.TAX_1099_DIV_DETAILS: 'tax_1099_div_details'>, <TradeDocumentType.TAX_1099_DIV_FORM: 'tax_1099_div_form'>, <TradeDocumentType.TAX_1099_INT_DETAILS: 'tax_1099_int_details'>, <TradeDocumentType.TAX_1099_INT_FORM: 'tax_1099_int_form'>, <TradeDocumentType.TAX_W8: 'tax_w8'>])
When I make a request of all document types from the API... the SDK should be able to parse the results.
Either:
a) there is an error in the API and it should not be generating responses with type = trade_confirmation_json
b) the SDK (and API documentation) need to add support for this new document type (add to TradeDocumentType enum)
SDK Version I encountered this issue in
alpaca-py version: 0.6.1
Steps To Reproduce
client = BrokerClient(...)
doc_filter = GetTradeDocumentsRequest(start=<date>, end=<date>). # leave the "type" filter empty
client.get_trade_documents_for_account(account_id=<id>, document_filter=doc_filter)
# crash will happen if there are `trade_confirmation_json` documents in the account for that time range
### 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?
_No response_
The text was updated successfully, but these errors were encountered:
This seems to be missing on the Alpaca docs as well. I've raised an issue: alpacahq/alpaca-docs#44. Once we get the confirmation this is indeed missing, this could get fixed on this repo as well
Is there an existing issue for this?
Current Behavior
In the Broker API sandbox I am making an API call to the Trade Documents API using the get_trade_documents_for_account method in the SDK.
I am requesting all document types (account statements, tax, and trade confs) so I do this by leaving the optional TradeDocumentType parameter as None. According to the API documentation this parameter is also optional.
However, the API is returning documents that are not supported by the TradeDocumentType enumeration. Specifically... in addition to
trade_confirmation
type documents I am also receivingtrade_confirmation_json
type documents. Because this document type is unknown enumeration to the SDK it crashes (pydantic error) when trying to parse the result.Snippet of the crash:
Snippet of the response:
Expected Behavior
When I make a request of all document types from the API... the SDK should be able to parse the results.
Either:
a) there is an error in the API and it should not be generating responses with type =
trade_confirmation_json
b) the SDK (and API documentation) need to add support for this new document type (add to TradeDocumentType enum)
SDK Version I encountered this issue in
alpaca-py version: 0.6.1
Steps To Reproduce
The text was updated successfully, but these errors were encountered: