mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-11 00:49:36 +08:00
49eaeeb6ae
Truncate non-integer order amounts in `TradingAlgorithm.order` instead of `Blotter.order`. This fixes an issue where non-integer orders coming out of order_value can spuriously trigger a `LongOnly` trading guard. Example: sid.price == 2.0 order_value(sid, 5) -> order(sid, 2.5) -> truncated to order(sid, 2.0) order_value(sid, -5) -> order(sid, -2.5) -> LongOnlyViolation b/c 2.0 - 2.5 < 0