fix: round limit_price to 2 decimal places before order submit
Alpaca rejects prices with more than 2 decimal places (code 42210000). Affected BAC on first live tick.
This commit is contained in:
@@ -55,7 +55,7 @@ def _build_request(intent: OrderIntent) -> Any:
|
||||
**common,
|
||||
)
|
||||
if intent.order_type == "limit":
|
||||
return LimitOrderRequest(limit_price=intent.limit_price, **common)
|
||||
return LimitOrderRequest(limit_price=round(intent.limit_price, 2), **common)
|
||||
return MarketOrderRequest(**common)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user