build(agent): c3po#b883b4 iteration
This commit is contained in:
parent
39baedd049
commit
fe6c318c23
|
|
@ -2,3 +2,24 @@ __pycache__/
|
||||||
*.pyc
|
*.pyc
|
||||||
.pytest_cache/
|
.pytest_cache/
|
||||||
*.egg-info/
|
*.egg-info/
|
||||||
|
node_modules/
|
||||||
|
.npmrc
|
||||||
|
.env
|
||||||
|
.env.*
|
||||||
|
__tests__/
|
||||||
|
coverage/
|
||||||
|
.nyc_output/
|
||||||
|
dist/
|
||||||
|
build/
|
||||||
|
.cache/
|
||||||
|
*.log
|
||||||
|
.DS_Store
|
||||||
|
tmp/
|
||||||
|
.tmp/
|
||||||
|
__pycache__/
|
||||||
|
*.pyc
|
||||||
|
.venv/
|
||||||
|
venv/
|
||||||
|
*.egg-info/
|
||||||
|
.pytest_cache/
|
||||||
|
READY_TO_PUBLISH
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
# AGENTS.md
|
||||||
|
|
||||||
|
## Architecture
|
||||||
|
|
||||||
|
- Python package: `deltatrace`
|
||||||
|
- Core modules:
|
||||||
|
- `event_graph.py` for causal event DAGs
|
||||||
|
- `replay_engine.py` for deterministic replay
|
||||||
|
- `audit_log.py` for signed audit trails
|
||||||
|
- `adapters.py` for market-data and exchange adapters
|
||||||
|
- `demo.py` for an end-to-end pipeline example
|
||||||
|
|
||||||
|
## Tech Stack
|
||||||
|
|
||||||
|
- Python 3.10+
|
||||||
|
- `setuptools` for packaging
|
||||||
|
- `cryptography` for Ed25519 signing
|
||||||
|
- `pytest` for test execution when available
|
||||||
|
|
||||||
|
## Verification
|
||||||
|
|
||||||
|
- `bash test.sh`
|
||||||
|
- `python -m build`
|
||||||
|
- `python -m pytest tests/ -v`
|
||||||
|
|
||||||
|
## Contribution Rules
|
||||||
|
|
||||||
|
- Keep changes minimal and focused.
|
||||||
|
- Preserve deterministic behavior in replay and tests.
|
||||||
|
- Prefer standard library code unless a dependency is clearly justified.
|
||||||
|
- Update this file when packaging, test commands, or module layout changes.
|
||||||
44
README.md
44
README.md
|
|
@ -1,29 +1,53 @@
|
||||||
# DeltaTrace
|
# DeltaTrace
|
||||||
|
|
||||||
Deterministic Replayable Latency & Compliance Tracing for Live Market-Execution Pipelines.
|
Deterministic replay, latency accounting, and compliance tracing for live market-execution pipelines.
|
||||||
|
|
||||||
A cross-layer traceability toolkit for high-frequency trading systems that enables deterministic replay of order lifecycles, end-to-end latency accounting, governance-ready audit trails, and vendor-agnostic adapters.
|
DeltaTrace provides a small, production-oriented Python package for capturing market events as a causal graph, replaying them deterministically, and writing a tamper-evident audit trail for governance review.
|
||||||
|
|
||||||
## Core Components
|
## What It Does
|
||||||
|
|
||||||
- **Event Graph**: Models market events (ticks, signals, orders, fills, risk checks) as a DAG with causal edges and latency budgets
|
- Models market-data ticks, signals, plan deltas, orders, fills, and risk checks as graph nodes.
|
||||||
- **Replay Engine**: Deterministically replays captured event streams to reproduce decision paths
|
- Links nodes with causal edges and latency measurements.
|
||||||
- **Audit Log**: Crypto-signed, tamper-evident governance log for regulatory reviews
|
- Replays captured traces in deterministic order for incident analysis.
|
||||||
- **Adapters**: Pluggable adapters for FIX feeds and exchange gateways
|
- Signs audit entries with Ed25519 and chains them with SHA-256 hashes.
|
||||||
|
- Includes two starter adapters:
|
||||||
|
- FIX feed adapter for FIX-like market data messages.
|
||||||
|
- Sandbox exchange adapter for order/fill simulation.
|
||||||
|
|
||||||
## Quick Start
|
## Package Layout
|
||||||
|
|
||||||
|
- `deltatrace.event_graph`: event and DAG primitives.
|
||||||
|
- `deltatrace.replay_engine`: deterministic replay runner.
|
||||||
|
- `deltatrace.audit_log`: signed audit log with hash chaining.
|
||||||
|
- `deltatrace.adapters`: FIX and sandbox adapters.
|
||||||
|
- `deltatrace.demo`: end-to-end example pipeline.
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install -e .
|
||||||
|
```
|
||||||
|
|
||||||
|
## Run the Demo
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pip install -r requirements.txt
|
|
||||||
python -m deltatrace.demo
|
python -m deltatrace.demo
|
||||||
```
|
```
|
||||||
|
|
||||||
## Testing
|
## Test And Build
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./test.sh
|
./test.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
|
This script installs dependencies, verifies `python -m build`, runs the test suite, and executes the demo.
|
||||||
|
|
||||||
|
## Publishing Notes
|
||||||
|
|
||||||
|
- Project metadata lives in `pyproject.toml`.
|
||||||
|
- The package README is wired as the long description for distribution builds.
|
||||||
|
- The build backend is setuptools and supports standard wheel/sdist creation.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
MIT
|
MIT
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,27 @@
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["setuptools>=68.0"]
|
requires = ["setuptools>=68.0", "wheel"]
|
||||||
build-backend = "setuptools.backends._legacy:_Backend"
|
build-backend = "setuptools.build_meta"
|
||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "deltatrace"
|
name = "deltatrace"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
description = "Deterministic Replayable Latency & Compliance Tracing for Live Market-Execution Pipelines"
|
description = "Deterministic Replayable Latency & Compliance Tracing for Live Market-Execution Pipelines"
|
||||||
|
readme = "README.md"
|
||||||
requires-python = ">=3.10"
|
requires-python = ">=3.10"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cryptography>=41.0.0",
|
"cryptography>=41.0.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[project.urls]
|
||||||
|
Homepage = "https://example.com/deltatrace"
|
||||||
|
Repository = "https://example.com/deltatrace.git"
|
||||||
|
|
||||||
[project.optional-dependencies]
|
[project.optional-dependencies]
|
||||||
test = ["pytest>=7.0"]
|
test = ["pytest>=7.0"]
|
||||||
|
|
||||||
|
[tool.setuptools]
|
||||||
|
include-package-data = true
|
||||||
|
|
||||||
|
[tool.setuptools.packages.find]
|
||||||
|
where = ["."]
|
||||||
|
include = ["deltatrace*"]
|
||||||
|
|
|
||||||
9
test.sh
9
test.sh
|
|
@ -3,11 +3,16 @@ set -e
|
||||||
|
|
||||||
echo "=== DeltaTrace Test Suite ==="
|
echo "=== DeltaTrace Test Suite ==="
|
||||||
echo "Installing dependencies..."
|
echo "Installing dependencies..."
|
||||||
pip install -q cryptography>=41.0.0
|
python -m pip install -q --upgrade pip
|
||||||
|
python -m pip install -q build
|
||||||
|
python -m pip install -q -e ".[test]"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "Verifying package build..."
|
||||||
|
python -m build
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "Running unit tests..."
|
echo "Running unit tests..."
|
||||||
cd "$(dirname "$0")"
|
|
||||||
python -m pytest tests/ -v --tb=short 2>/dev/null || python -m unittest discover -s tests -v
|
python -m pytest tests/ -v --tb=short 2>/dev/null || python -m unittest discover -s tests -v
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue