stock-bot/test/fixtures/economics/ledger-specs.json
Boki b4af840d4e feat(research): add financial contracts and availability-aware datasets
Implement reviewed F01/D01 foundations without changing active trading runtimes. Validate strict Rust/TypeScript financial wire contracts, decimal postings, versioned datasets, explicit calendars, provenance, and v1 compatibility.
2026-10-22 20:51:25 -04:00

118 lines
3.6 KiB
JSON

{
"basis": {
"id": "basis_residual_spec",
"owningTask": "F02",
"assumptions": "Three owned shares have exact remaining cost5, no fees. Sell one share each time; basis rounds half-away at8dp. Final disposal releases exact residue.",
"handCalculation": "First5/3 rounds1.66666667; remaining3.33333333. Second3.33333333/2=1.666666665 rounds1.66666667; remaining1.66666666. Final release1.66666666. Sum exactly5, not3*roundedaverage=5.00000001.",
"initialQuantity": "3.00000000",
"initialCost": "5.00000000",
"releases": ["1.66666667", "1.66666667", "1.66666666"],
"remainingCosts": ["3.33333333", "1.66666666", "0.00000000"]
},
"commandIds": {
"id": "command_id_conflict_spec",
"owningTask": "F02",
"assumptions": "Command identity is tuple(sessionId,accountId,commandId); canonical typed payload comparison ignores object key order and decimal padding. Decision IDs are owner-scoped within session; no concatenated identifier collisions.",
"handCalculation": "Same identity+same canonical payload =>retry; same identity+changed fee=>conflict; different session=>independent. F01 checks this specification, not a runtime dedup store.",
"original": {
"version": 1,
"sessionId": "research:run-1",
"accountId": "account-1",
"commandId": "command-fill-1",
"eventTime": 1704292260000,
"body": {
"kind": "applyFill",
"decision": {
"ownerId": "strategy:A",
"decisionId": "decision-1",
"sequence": 1
},
"orderId": "order-1",
"fillId": "fill-1",
"instrumentId": "A^P.US",
"side": "buy",
"quantity": "3.00000000",
"price": "2.00000000",
"fee": {
"feeId": "fee-1",
"amount": "0.06000000"
}
}
},
"retry": {
"version": 1,
"sessionId": "research:run-1",
"accountId": "account-1",
"commandId": "command-fill-1",
"eventTime": 1704292260000,
"body": {
"kind": "applyFill",
"decision": {
"ownerId": "strategy:A",
"decisionId": "decision-1",
"sequence": 1
},
"orderId": "order-1",
"fillId": "fill-1",
"instrumentId": "A^P.US",
"side": "buy",
"quantity": "3",
"price": "2.00000000",
"fee": {
"feeId": "fee-1",
"amount": "0.06000000"
}
}
},
"conflict": {
"version": 1,
"sessionId": "research:run-1",
"accountId": "account-1",
"commandId": "command-fill-1",
"eventTime": 1704292260000,
"body": {
"kind": "applyFill",
"decision": {
"ownerId": "strategy:A",
"decisionId": "decision-1",
"sequence": 1
},
"orderId": "order-1",
"fillId": "fill-1",
"instrumentId": "A^P.US",
"side": "buy",
"quantity": "3.00000000",
"price": "2.00000000",
"fee": {
"feeId": "fee-1",
"amount": "0.07000000"
}
}
},
"independent": {
"version": 1,
"sessionId": "research:run-2",
"accountId": "account-1",
"commandId": "command-fill-1",
"eventTime": 1704292260000,
"body": {
"kind": "applyFill",
"decision": {
"ownerId": "strategy:A",
"decisionId": "decision-1",
"sequence": 1
},
"orderId": "order-1",
"fillId": "fill-1",
"instrumentId": "A^P.US",
"side": "buy",
"quantity": "3.00000000",
"price": "2.00000000",
"fee": {
"feeId": "fee-1",
"amount": "0.06000000"
}
}
}
}
}