stock-bot/test/fixtures/economics/contracts.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

803 lines
26 KiB
JSON
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
"schemaVersion": 1,
"valid": [
{
"id": "fillCommand",
"owningTask": "F01",
"assumptions": "Wire-shape example only; no simulated transition or engine certification.",
"handCalculation": "Parse and serialize without changing explicit identity, decimal values, or effect order.",
"type": "command",
"input": {
"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"
}
}
},
"canonical": {
"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"
}
}
}
},
{
"id": "markCommand",
"owningTask": "F01",
"assumptions": "Wire-shape example only; no simulated transition or engine certification.",
"handCalculation": "Parse and serialize without changing explicit identity, decimal values, or effect order.",
"type": "command",
"input": {
"version": 1,
"sessionId": "research:run-1",
"accountId": "account-1",
"commandId": "command-mark-1",
"eventTime": 1704292260000,
"body": {
"kind": "mark",
"instrumentId": "A^P.US",
"price": "2.00000000"
}
},
"canonical": {
"version": 1,
"sessionId": "research:run-1",
"accountId": "account-1",
"commandId": "command-mark-1",
"eventTime": 1704292260000,
"body": {
"kind": "mark",
"instrumentId": "A^P.US",
"price": "2.00000000"
}
}
},
{
"id": "boundaryCommand",
"owningTask": "F01",
"assumptions": "Wire-shape example only; no simulated transition or engine certification.",
"handCalculation": "Parse and serialize without changing explicit identity, decimal values, or effect order.",
"type": "command",
"input": {
"version": 1,
"sessionId": "research:run-1",
"accountId": "account-1",
"commandId": "boundary-1",
"eventTime": 1704292200000,
"body": {
"kind": "riskSessionBoundary",
"riskSession": {
"calendarId": "XNYS",
"calendarRevision": "2024-a",
"sessionId": "2024-01-03",
"startsAt": 1704292200000
}
}
},
"canonical": {
"version": 1,
"sessionId": "research:run-1",
"accountId": "account-1",
"commandId": "boundary-1",
"eventTime": 1704292200000,
"body": {
"kind": "riskSessionBoundary",
"riskSession": {
"calendarId": "XNYS",
"calendarRevision": "2024-a",
"sessionId": "2024-01-03",
"startsAt": 1704292200000
}
}
}
},
{
"id": "targetDecision",
"owningTask": "F01",
"assumptions": "Wire-shape example only; no simulated transition or engine certification.",
"handCalculation": "Parse and serialize without changing explicit identity, decimal values, or effect order.",
"type": "decision",
"input": {
"version": 1,
"sessionId": "research:run-1",
"barrierId": "barrier-1",
"revision": 0,
"decision": {
"ownerId": "strategy:A",
"decisionId": "decision-1",
"sequence": 1
},
"intent": {
"mode": "target",
"targets": [
{
"instrumentId": "A^P.US",
"quantity": "3.00000000"
},
{
"instrumentId": "B.US",
"quantity": "0.00000000"
}
]
}
},
"canonical": {
"version": 1,
"sessionId": "research:run-1",
"barrierId": "barrier-1",
"revision": 0,
"decision": {
"ownerId": "strategy:A",
"decisionId": "decision-1",
"sequence": 1
},
"intent": {
"mode": "target",
"targets": [
{
"instrumentId": "A^P.US",
"quantity": "3.00000000"
},
{
"instrumentId": "B.US",
"quantity": "0.00000000"
}
]
}
}
},
{
"id": "orderDecision",
"owningTask": "F01",
"assumptions": "Wire-shape example only; no simulated transition or engine certification.",
"handCalculation": "Parse and serialize without changing explicit identity, decimal values, or effect order.",
"type": "decision",
"input": {
"version": 1,
"sessionId": "research:run-1",
"barrierId": "barrier-1",
"revision": 0,
"decision": {
"ownerId": "strategy:A",
"decisionId": "decision-1",
"sequence": 1
},
"intent": {
"mode": "orders",
"orders": [
{
"kind": "market",
"orderId": "order-2",
"instrumentId": "A.US",
"side": "buy",
"quantity": "1.00000000",
"timeInForce": "GTC"
},
{
"kind": "limit",
"orderId": "order-3",
"instrumentId": "B.US",
"side": "sell",
"quantity": "1.00000000",
"price": "2.00000000",
"timeInForce": "DAY"
},
{
"kind": "cancel",
"orderId": "order-4"
}
]
}
},
"canonical": {
"version": 1,
"sessionId": "research:run-1",
"barrierId": "barrier-1",
"revision": 0,
"decision": {
"ownerId": "strategy:A",
"decisionId": "decision-1",
"sequence": 1
},
"intent": {
"mode": "orders",
"orders": [
{
"kind": "market",
"orderId": "order-2",
"instrumentId": "A.US",
"side": "buy",
"quantity": "1.00000000",
"timeInForce": "GTC"
},
{
"kind": "limit",
"orderId": "order-3",
"instrumentId": "B.US",
"side": "sell",
"quantity": "1.00000000",
"price": "2.00000000",
"timeInForce": "DAY"
},
{
"kind": "cancel",
"orderId": "order-4"
}
]
}
}
},
{
"id": "snapshot",
"owningTask": "F01",
"assumptions": "Wire-shape example only; no simulated transition or engine certification.",
"handCalculation": "Assume100 initial cash;3*2=6 notional,0.06 fee; cash93.94 and remaining basis6. Ordered example includes independent mark/boundary/rejection effects to cover tags.",
"type": "snapshot",
"input": {
"version": 1,
"sessionId": "research:run-1",
"accountId": "account-1",
"revision": 1,
"baseCurrency": "USD",
"reserveOwnerId": "reserve",
"cash": "93.94000000",
"positions": [
{
"ownerId": "strategy:A",
"instrumentId": "A^P.US",
"quantity": "3.00000000",
"remainingCost": "6.00000000",
"realizedGrossPnl": "0.00000000"
}
],
"fees": [
{
"ownerId": "strategy:A",
"amount": "0.06000000"
}
],
"riskSession": {
"calendarId": "XNYS",
"calendarRevision": "2024-a",
"sessionId": "2024-01-03",
"startsAt": 1704292200000
}
},
"canonical": {
"version": 1,
"sessionId": "research:run-1",
"accountId": "account-1",
"revision": 1,
"baseCurrency": "USD",
"reserveOwnerId": "reserve",
"cash": "93.94000000",
"positions": [
{
"ownerId": "strategy:A",
"instrumentId": "A^P.US",
"quantity": "3.00000000",
"remainingCost": "6.00000000",
"realizedGrossPnl": "0.00000000"
}
],
"fees": [
{
"ownerId": "strategy:A",
"amount": "0.06000000"
}
],
"riskSession": {
"calendarId": "XNYS",
"calendarRevision": "2024-a",
"sessionId": "2024-01-03",
"startsAt": 1704292200000
}
}
},
{
"id": "effects",
"owningTask": "F01",
"assumptions": "Wire-shape example only; no simulated transition or engine certification.",
"handCalculation": "Assume100 initial cash;3*2=6 notional,0.06 fee; cash93.94 and remaining basis6. Ordered example includes independent mark/boundary/rejection effects to cover tags.",
"type": "effects",
"input": {
"version": 1,
"sessionId": "research:run-1",
"accountId": "account-1",
"commandId": "command-fill-1",
"eventTime": 1704292260000,
"revision": 1,
"effects": [
{
"kind": "fillApplied",
"ownerId": "strategy:A",
"orderId": "order-1",
"fillId": "fill-1",
"instrumentId": "A^P.US",
"price": "2.00000000",
"cashDelta": "-6.00000000",
"quantityDelta": "3.00000000",
"releasedBasis": "0.00000000",
"realizedGrossPnl": "0.00000000"
},
{
"kind": "feeApplied",
"ownerId": "strategy:A",
"fillId": "fill-1",
"feeId": "fee-1",
"amount": "0.06000000"
},
{
"kind": "markUpdated",
"instrumentId": "A^P.US",
"price": "2.00000000"
},
{
"kind": "riskSessionChanged",
"riskSession": {
"calendarId": "XNYS",
"calendarRevision": "2024-a",
"sessionId": "2024-01-03",
"startsAt": 1704292200000
}
},
{
"kind": "rejected",
"code": "insufficientCash"
}
]
},
"canonical": {
"version": 1,
"sessionId": "research:run-1",
"accountId": "account-1",
"commandId": "command-fill-1",
"eventTime": 1704292260000,
"revision": 1,
"effects": [
{
"kind": "fillApplied",
"ownerId": "strategy:A",
"orderId": "order-1",
"fillId": "fill-1",
"instrumentId": "A^P.US",
"price": "2.00000000",
"cashDelta": "-6.00000000",
"quantityDelta": "3.00000000",
"releasedBasis": "0.00000000",
"realizedGrossPnl": "0.00000000"
},
{
"kind": "feeApplied",
"ownerId": "strategy:A",
"fillId": "fill-1",
"feeId": "fee-1",
"amount": "0.06000000"
},
{
"kind": "markUpdated",
"instrumentId": "A^P.US",
"price": "2.00000000"
},
{
"kind": "riskSessionChanged",
"riskSession": {
"calendarId": "XNYS",
"calendarRevision": "2024-a",
"sessionId": "2024-01-03",
"startsAt": 1704292200000
}
},
{
"kind": "rejected",
"code": "insufficientCash"
}
]
}
},
{
"id": "unicodeIdentity",
"owningTask": "F01",
"assumptions": "Identity text is preserved; instrument is a supported synthetic listing. No actual index execution implied.",
"handCalculation": "Parse and serialize without changing explicit identity, decimal values, or effect order.",
"type": "command",
"input": {
"version": 1,
"sessionId": "research:run-1",
"accountId": "account-1",
"commandId": "命令:α",
"eventTime": 1704292260000,
"body": {
"kind": "mark",
"instrumentId": "A^P.US",
"price": "2.00000000"
}
},
"canonical": {
"version": 1,
"sessionId": "research:run-1",
"accountId": "account-1",
"commandId": "命令:α",
"eventTime": 1704292260000,
"body": {
"kind": "mark",
"instrumentId": "A^P.US",
"price": "2.00000000"
}
}
}
],
"invalid": [
{
"id": "unknown_version",
"owningTask": "F01",
"assumptions": "Mutation of a valid contract; rejects before contextual engine admission.",
"handCalculation": "No economic calculation; malformed transport must fail identically in Rust and TypeScript.",
"base": "fillCommand",
"path": ["version"],
"value": 2
},
{
"id": "unknown_outer_key",
"owningTask": "F01",
"assumptions": "Mutation of a valid contract; rejects before contextual engine admission.",
"handCalculation": "No economic calculation; malformed transport must fail identically in Rust and TypeScript.",
"base": "fillCommand",
"path": ["unexpected"],
"value": true
},
{
"id": "unknown_body_key",
"owningTask": "F01",
"assumptions": "Mutation of a valid contract; rejects before contextual engine admission.",
"handCalculation": "No economic calculation; malformed transport must fail identically in Rust and TypeScript.",
"base": "fillCommand",
"path": ["body", "unexpected"],
"value": true
},
{
"id": "unknown_nested_key",
"owningTask": "F01",
"assumptions": "Mutation of a valid contract; rejects before contextual engine admission.",
"handCalculation": "No economic calculation; malformed transport must fail identically in Rust and TypeScript.",
"base": "fillCommand",
"path": ["body", "fee", "unexpected"],
"value": true
},
{
"id": "empty_owner",
"owningTask": "F01",
"assumptions": "Mutation of a valid contract; rejects before contextual engine admission.",
"handCalculation": "No economic calculation; malformed transport must fail identically in Rust and TypeScript.",
"base": "fillCommand",
"path": ["body", "decision", "ownerId"],
"value": ""
},
{
"id": "control_id",
"owningTask": "F01",
"assumptions": "Mutation of a valid contract; rejects before contextual engine admission.",
"handCalculation": "No economic calculation; malformed transport must fail identically in Rust and TypeScript.",
"base": "fillCommand",
"path": ["commandId"],
"value": "a\nb"
},
{
"id": "zero_fill_quantity",
"owningTask": "F01",
"assumptions": "Mutation of a valid contract; rejects before contextual engine admission.",
"handCalculation": "No economic calculation; malformed transport must fail identically in Rust and TypeScript.",
"base": "fillCommand",
"path": ["body", "quantity"],
"value": "0"
},
{
"id": "negative_fill_quantity",
"owningTask": "F01",
"assumptions": "Mutation of a valid contract; rejects before contextual engine admission.",
"handCalculation": "No economic calculation; malformed transport must fail identically in Rust and TypeScript.",
"base": "fillCommand",
"path": ["body", "quantity"],
"value": "-1"
},
{
"id": "numeric_price",
"owningTask": "F01",
"assumptions": "Mutation of a valid contract; rejects before contextual engine admission.",
"handCalculation": "No economic calculation; malformed transport must fail identically in Rust and TypeScript.",
"base": "fillCommand",
"path": ["body", "price"],
"value": 2
},
{
"id": "zero_price",
"owningTask": "F01",
"assumptions": "Mutation of a valid contract; rejects before contextual engine admission.",
"handCalculation": "No economic calculation; malformed transport must fail identically in Rust and TypeScript.",
"base": "fillCommand",
"path": ["body", "price"],
"value": "0"
},
{
"id": "negative_fee",
"owningTask": "F01",
"assumptions": "Mutation of a valid contract; rejects before contextual engine admission.",
"handCalculation": "No economic calculation; malformed transport must fail identically in Rust and TypeScript.",
"base": "fillCommand",
"path": ["body", "fee", "amount"],
"value": "-0.01"
},
{
"id": "excess_precision",
"owningTask": "F01",
"assumptions": "Mutation of a valid contract; rejects before contextual engine admission.",
"handCalculation": "No economic calculation; malformed transport must fail identically in Rust and TypeScript.",
"base": "fillCommand",
"path": ["body", "quantity"],
"value": "1.000000000"
},
{
"id": "unsafe_sequence",
"owningTask": "F01",
"assumptions": "Mutation of a valid contract; rejects before contextual engine admission.",
"handCalculation": "No economic calculation; malformed transport must fail identically in Rust and TypeScript.",
"base": "fillCommand",
"path": ["body", "decision", "sequence"],
"value": 9007199254740992
},
{
"id": "negative_sequence",
"owningTask": "F01",
"assumptions": "Mutation of a valid contract; rejects before contextual engine admission.",
"handCalculation": "No economic calculation; malformed transport must fail identically in Rust and TypeScript.",
"base": "fillCommand",
"path": ["body", "decision", "sequence"],
"value": -1
},
{
"id": "future_command_kind",
"owningTask": "F01",
"assumptions": "Mutation of a valid contract; rejects before contextual engine admission.",
"handCalculation": "No economic calculation; malformed transport must fail identically in Rust and TypeScript.",
"base": "fillCommand",
"path": ["body", "kind"],
"value": "deposit"
},
{
"id": "negative_cash",
"owningTask": "F01",
"assumptions": "Mutation of a valid contract; rejects before contextual engine admission.",
"handCalculation": "No economic calculation; malformed transport must fail identically in Rust and TypeScript.",
"base": "snapshot",
"path": ["cash"],
"value": "-1"
},
{
"id": "negative_long_quantity",
"owningTask": "F01",
"assumptions": "Mutation of a valid contract; rejects before contextual engine admission.",
"handCalculation": "No economic calculation; malformed transport must fail identically in Rust and TypeScript.",
"base": "snapshot",
"path": ["positions", "0", "quantity"],
"value": "-1"
},
{
"id": "negative_basis",
"owningTask": "F01",
"assumptions": "Mutation of a valid contract; rejects before contextual engine admission.",
"handCalculation": "No economic calculation; malformed transport must fail identically in Rust and TypeScript.",
"base": "snapshot",
"path": ["positions", "0", "remainingCost"],
"value": "-1"
},
{
"id": "mixed_intents",
"owningTask": "F01",
"assumptions": "Mutation of a valid contract; rejects before contextual engine admission.",
"handCalculation": "No economic calculation; malformed transport must fail identically in Rust and TypeScript.",
"base": "targetDecision",
"path": ["intent", "orders"],
"value": []
},
{
"id": "negative_target",
"owningTask": "F01",
"assumptions": "Mutation of a valid contract; rejects before contextual engine admission.",
"handCalculation": "No economic calculation; malformed transport must fail identically in Rust and TypeScript.",
"base": "targetDecision",
"path": ["intent", "targets", "0", "quantity"],
"value": "-1"
},
{
"id": "unsupported_stop",
"owningTask": "F01",
"assumptions": "Mutation of a valid contract; rejects before contextual engine admission.",
"handCalculation": "No economic calculation; malformed transport must fail identically in Rust and TypeScript.",
"base": "orderDecision",
"path": ["intent", "orders", "0", "kind"],
"value": "stop"
},
{
"id": "unsafe_revision",
"owningTask": "F01",
"assumptions": "Mutation of a valid contract; rejects before contextual engine admission.",
"handCalculation": "No economic calculation; malformed transport must fail identically in Rust and TypeScript.",
"base": "snapshot",
"path": ["revision"],
"value": 9007199254740992
},
{
"id": "unknown_snapshot_version",
"owningTask": "F01",
"assumptions": "Mutation of a valid contract; rejects before contextual engine admission.",
"handCalculation": "No economic calculation; malformed transport must fail identically in Rust and TypeScript.",
"base": "snapshot",
"path": ["version"],
"value": 2
},
{
"id": "unknown_decision_version",
"owningTask": "F01",
"assumptions": "Mutation of a valid contract; rejects before contextual engine admission.",
"handCalculation": "No economic calculation; malformed transport must fail identically in Rust and TypeScript.",
"base": "targetDecision",
"path": ["version"],
"value": 2
},
{
"id": "unknown_effect_version",
"owningTask": "F01",
"assumptions": "Mutation of a valid contract; rejects before contextual engine admission.",
"handCalculation": "No economic calculation; malformed transport must fail identically in Rust and TypeScript.",
"base": "effects",
"path": ["version"],
"value": 2
},
{
"id": "invalid_effect_price",
"owningTask": "F01",
"assumptions": "Mutation of a valid contract; rejects before contextual engine admission.",
"handCalculation": "No economic calculation; malformed transport must fail identically in Rust and TypeScript.",
"base": "effects",
"path": ["effects", "0", "price"],
"value": "0"
},
{
"id": "negative_release",
"owningTask": "F01",
"assumptions": "Mutation of a valid contract; rejects before contextual engine admission.",
"handCalculation": "No economic calculation; malformed transport must fail identically in Rust and TypeScript.",
"base": "effects",
"path": ["effects", "0", "releasedBasis"],
"value": "-1"
},
{
"id": "null_risk_session",
"owningTask": "F01",
"assumptions": "Mutation of a valid contract; rejects before contextual engine admission.",
"handCalculation": "No economic calculation; malformed transport must fail identically in Rust and TypeScript.",
"base": "snapshot",
"path": ["riskSession"],
"value": null
},
{
"id": "nul_identity",
"owningTask": "F01",
"assumptions": "Identifiers cannot contain ASCII control characters.",
"handCalculation": "Reject NUL in identity, without restricting legitimate Unicode text.",
"base": "fillCommand",
"path": ["commandId"],
"value": "a\u0000b"
}
],
"numeric": {
"id": "safe_json_number_parity",
"owningTask": "F01",
"assumptions": "Use parsed JSON number semantics across languages; counters nonnegative and timestamps signed; both JS-safe integers.",
"handCalculation": "Integral1.0 and1e0 equal1; abs(value)>9007199254740991, fractional/type-coerced values reject.",
"cases": [
{
"raw": "0",
"counterValid": true,
"timestampValid": true
},
{
"raw": "-0",
"counterValid": true,
"timestampValid": true
},
{
"raw": "1.0",
"counterValid": true,
"timestampValid": true
},
{
"raw": "1e0",
"counterValid": true,
"timestampValid": true
},
{
"raw": "9007199254740991",
"counterValid": true,
"timestampValid": true
},
{
"raw": "9007199254740992",
"counterValid": false,
"timestampValid": false
},
{
"raw": "1.5",
"counterValid": false,
"timestampValid": false
},
{
"raw": "-1",
"counterValid": false,
"timestampValid": true
},
{
"raw": "\"1\"",
"counterValid": false,
"timestampValid": false
},
{
"raw": "true",
"counterValid": false,
"timestampValid": false
},
{
"raw": "null",
"counterValid": false,
"timestampValid": false
},
{
"raw": "-9007199254740991",
"counterValid": false,
"timestampValid": true
},
{
"raw": "-9007199254740992",
"counterValid": false,
"timestampValid": false
}
]
}
}