Settlement latency is reported in whole milliseconds, and reconciliation keeps finding rows that are off by one: a latency of 345 ms is exported as 344. Only some values are affected, which made it hard to spot.
Settlement latency is reported in whole milliseconds, and reconciliation keeps finding rows that are off by one: a latency of 345 ms is exported as 344. Only some values are affected, which made it hard to spot.
import datetime as dt
from marshmallow import fields
field = fields.TimeDelta(precision="milliseconds")
field.serialize("latency", {"latency": dt.timedelta(milliseconds=345)})
field.serialize("latency", {"latency": dt.timedelta(milliseconds=1001)})
345
1001
344
1000
precision="seconds" is 1.Adapted from marshmallow-code/marshmallow (MIT).
Visible test command
pytest testsThe repository’s own tests. Run all tests includes them, and so does every submission.
Repository
timedelta-serializes-one-unit-short
Changes under src/ are evaluated.