[Bug]: 2 validation errors for TradeAccount
- Langage dominant
- Python
- Étoiles
- 1.5k
- Forks
- 398
- Merge moyen
- 1 j 16 h
- PR mergées (30 j)
- 6
Description
### Is there an existing issue for this?
- [x] I have searched the existing issues
### Current Behavior
Hey folks,
It looks like:
- Alpaca removed `last_daytrading_buying_power` and `last_daytrade_count` from the API responses today (2026-07-06) as part of a FINRA intraday-margin migration
- The alpaca-py library preemptively fixed this in commit `fd14c0af` on July 1, released as v0.43.5 on July 2 — 4 days before the removal
This patch release started causing errors and caused `500`s to be returned from core application flows.
```
pydantic_core._pydantic_core.ValidationError: 2 validation errors for TradeAccount
last_daytrading_buying_power
Field required [type=missing, input_value={'id': '46aec19b-61e6-497...ding_reg_taf_fees': '0'}, input_type=dict]
For further information visit https://errors.pydantic.dev/2.12/v/missing
last_daytrade_count
Field required [type=missing, input_value={'id': '46aec19b-61e6-497...ding_reg_taf_fees': '0'}, input_type=dict]
For further information visit https://errors.pydantic.dev/2.12/v/missing
```
### Expected Behavior
Non-backwards compatible changes should be effectively communicated about.
Users should be given more than 4 days to upgrade.
### SDK Version I encountered this issue in
alpaca.py version < `v0.43.4`
### Steps To Reproduce
```markdown
# Response shape Alpaca now returns (day-trading fields removed)
TradeAccount(**{
"id": "46aec19b-0000-0000-0000-000000000000",
"account_number": "TEST",
"status": "ACTIVE",
"cash": "1500.00",
"equity": "2500.00",
"cash_withdrawable": "1000.00",
"cash_transferable": "800.00",
"pending_transfer_in": "0",
"long_market_value": "0",
"short_market_value": "0",
"initial_margin": "0",
"maintenance_margin": "0",
"last_maintenance_margin": "0",
"sma": "0",
"buying_power": "0",
"regt_buying_power": "0",
"daytrading_buying_power": "0",
"non_marginable_buying_power": "0",
"trading_reg_taf_fees": "0",
})
# ValidationError: 2 validation errors for TradeAccount
# last_daytrading_buying_power — Field required
# last_daytrade_count — Field required
```
### 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_
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Start with the TradeAccount validation entry point and run the reproducible constructor shown in the issue against the affected SDK version. Compare the model's required fields with the response shape; done means the reported response no longer produces the two validation errors, with the compatibility or communication change agreed in the issue.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- python
- Domaine
- api
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- Calme
- Clarté
- À clarifier
- Accessibilité débutants
- 38/100