chore(release): prepare v0.7.0
This commit is contained in:
@@ -4,7 +4,8 @@ Live portfolio-hub contract (verified against openapi, REQ-017 CHG-04):
|
||||
POST /v1/portfolios/{portfolio_id}/ledger/trades
|
||||
body keys: side, quantity, price, fee_amount, tax_amount, executed_at,
|
||||
execution_id, order_id
|
||||
- 2xx (201) => recorded (or duplicate accepted idempotently)
|
||||
- 201/status=new => recorded
|
||||
- 200/status=duplicate => duplicate accepted idempotently
|
||||
- 409 => LedgerConflictError (operator resolution)
|
||||
- 404/400/422 => LedgerPermanentError (dcy-015/REQ-017 — retry can't fix:
|
||||
portfolio not registered / malformed trade)
|
||||
@@ -94,18 +95,18 @@ class PortfolioHubLedger:
|
||||
raise LedgerRetryableError(f"portfolio-hub network error: {exc!s}") from exc
|
||||
|
||||
if 200 <= resp.status_code < 300:
|
||||
# orbit convention: response body may carry a "duplicate" flag when
|
||||
# the server has already recorded this execution_id idempotently.
|
||||
# portfolio-hub returns status="duplicate" for an idempotent replay.
|
||||
# Keep the former boolean marker compatible with older deployments.
|
||||
try:
|
||||
body = resp.json() if resp.content else {}
|
||||
except ValueError:
|
||||
body = {}
|
||||
if not isinstance(body, dict):
|
||||
body = {}
|
||||
result = (
|
||||
LedgerWriteResult.DUPLICATE_OK if body.get("duplicate") is True
|
||||
else LedgerWriteResult.NEW
|
||||
is_duplicate = (
|
||||
body.get("status") == "duplicate" or body.get("duplicate") is True
|
||||
)
|
||||
result = LedgerWriteResult.DUPLICATE_OK if is_duplicate else LedgerWriteResult.NEW
|
||||
# dcy-018 / REQ-017 (option D, portfolio-hub#8): root flat authoritative
|
||||
# cash/quantity after the write — present on new(201) + duplicate(200).
|
||||
return LedgerWriteOutcome(
|
||||
|
||||
Reference in New Issue
Block a user