Skip to content

Commit b6ea65d

Browse files
authored
refactor(core): establish clean deterministic Core package baseline (#9)
Co-authored-by: bxvtr <bxvtr@users.noreply.github.com>
1 parent 2c31754 commit b6ea65d

105 files changed

Lines changed: 3513 additions & 11920 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ What should happen?
2727

2828
## Logs / Output
2929

30-
Paste relevant logs, stack traces, or event output here.
30+
Paste relevant logs, traces, or outputs here.

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ venv.bak/
2323
*.key
2424
*.crt
2525
*.pub
26-
.oci/
2726

2827
# ==============================
2928
# Python packaging / build artifacts

CHANGELOG.md

Lines changed: 16 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,24 @@
11
# Changelog
22

3-
All notable changes to this project will be documented in this file.
4-
5-
The format is based on Keep a Changelog
6-
and this project adheres to Semantic Versioning.
3+
This changelog starts from the clean Core package baseline.
74

85
## [Unreleased]
96

10-
## [0.1.0] - 2026-02-17
7+
### Added
118

12-
Initial public release of the core.
9+
- Deterministic `run_core_step` and `run_core_wakeup_step` architecture.
10+
- CoreWakeupStep final-state Strategy evaluation: reduce all entries, then `CoreWakeupStrategyEvaluator` once.
11+
- Canonical Event input models and `EventStreamEntry`/`ProcessingPosition`.
12+
- Intent candidate record pipeline with dominance/reconciliation.
13+
- Risk Engine (policy-only) admission and Execution Control plan/apply integration.
14+
- `CoreStepResult.dispatchable_intents` and `ControlSchedulingObligation` outputs.
15+
- Core-only quickstart example and focused semantics test coverage.
1316

14-
### Added
17+
### Changed
18+
19+
- Package metadata, exports, and docs reset for standalone Core library identity.
20+
- Pydantic models established as contract source of truth across public API docs.
21+
22+
### Removed
1523

16-
#### Core Domain
17-
- Explicit order state machine
18-
- Structured domain types and reject reasons
19-
- Slot-based order tracking
20-
- Event bus and event sink abstractions
21-
- JSON schema validation for domain events
22-
23-
#### Risk Layer
24-
- Configurable risk engine
25-
- Risk constraint enforcement
26-
- Deterministic risk gating before execution
27-
28-
#### Backtest Layer
29-
- Integration with [hftbacktest](https://github.com/nkaz001/hftbacktest)
30-
- Strategy runner abstraction
31-
- Venue adapter interface
32-
- Deterministic event processing pipeline
33-
34-
#### Orchestration
35-
- Segment-based execution model
36-
- Parameter sweep runtime
37-
- Experiment and segment entrypoints
38-
- Prometheus metrics integration
39-
- MLflow-compatible logging hooks
40-
41-
#### Execution Modes
42-
- Fully local execution example
43-
- Cloud-native runtime entrypoints
44-
- S3-compatible storage adapter
45-
46-
#### Strategy
47-
- Base strategy interface
48-
- Structured strategy configuration
49-
50-
#### Testing
51-
- Semantic invariant test suite
52-
- Order state transition validation
53-
- Queue dominance rules
54-
- Risk constraint validation
55-
- Schema conformance tests
56-
57-
#### Tooling
58-
- Dev container configuration
59-
- Development validation scripts
60-
- Dependency compilation helper
24+
- Legacy compatibility-first contracts and references not part of the clean baseline.

CONTRIBUTING.md

Lines changed: 56 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,80 @@
1-
# Contributing
1+
# Contributing to TradingChassis Core
22

3-
Thank you for your interest in contributing!
3+
Contributions should preserve TradingChassis Core as a deterministic,
4+
Runtime-agnostic library.
45

5-
This repository focuses on deterministic, event-driven trading architecture.
6-
Contributions should preserve clarity, explicitness and reproducibility.
6+
> Terminology: Definitions and related terms match the [canonical
7+
> terminology](https://tradingchassis.github.io/docs/latest/00-guides/terminology/).
78
8-
---
9+
## Package Scope
910

10-
## Design Principles
11+
- Core owns canonical Events, State reduction, Strategy evaluation boundary,
12+
candidate reconciliation, Risk Engine (policy), Execution Control plan/apply,
13+
and `CoreStepResult`.
14+
- Core does not own Runtime orchestration, Venue Adapters, dispatch lifecycle,
15+
or deployment/config wiring.
1116

12-
All contributions must respect the core design philosophy:
17+
## Development Setup
1318

14-
- Determinism over convenience
15-
- Explicit state modeling
16-
- No hidden side effects
17-
- Risk-first architecture
18-
- Clear domain boundaries
19+
From `core`:
1920

20-
Avoid introducing implicit behavior or non-deterministic execution paths.
21+
```bash
22+
python -m pip install -e ".[dev]"
23+
```
2124

22-
---
25+
## Validation Commands
2326

24-
## Workflow
27+
Run before opening a PR:
2528

26-
1. Fork the repository
27-
2. Create a feature branch
28-
3. Commit small, logical changes
29-
4. Open a Pull Request with clear description
29+
```bash
30+
python examples/core_step_quickstart.py
31+
python -m pytest -q
32+
python -m build
33+
```
3034

31-
---
35+
## Architecture Rules
3236

33-
## Commit Style
37+
- Core accepts canonical Events through `EventStreamEntry` and
38+
`process_event_entry` / `process_canonical_event`.
39+
- Core returns deterministic `CoreStepResult`; Runtime dispatches.
40+
- Do not introduce Runtime imports.
41+
- Pydantic models are the source of truth for contract structure.
3442

35-
Use clear messages:
43+
## Changing Core Behavior
3644

37-
feat: add monitoring overlay
38-
fix: correct SecretProviderClass parameters
39-
docs: update bootstrap instructions
45+
### Canonical Events
4046

41-
---
47+
- Add Event models in `tradingchassis_core/core/domain/types.py`.
48+
- Register canonical category handling in `core/domain/event_model.py`.
49+
- Update canonical reduction behavior in `core/domain/processing.py`.
4250

43-
## Development Environment
51+
### CoreStep/CoreWakeupStep pipeline
4452

45-
Recommended:
53+
- Update `core/domain/processing_step.py` for deterministic flow changes.
54+
- Keep reconciliation/policy/apply transitions explicit and side-effect-safe.
4655

47-
- Python 3.11.x
48-
- Dev Container (provided in this repository)
56+
### Risk Engine (policy) behavior
4957

50-
Alternatively:
58+
- Implement policy checks in `core/risk/` and wire through
59+
`evaluate_policy_intent`.
60+
- Keep Risk Engine admission as policy-only; no dispatch/Runtime side effects.
5161

52-
```bash
53-
pip install -e .
54-
```
62+
### Execution Control behavior
63+
64+
- Update plan/apply stages in `core/domain/execution_control_plan.py` and
65+
`core/domain/execution_control_apply.py`.
66+
- Preserve `ControlSchedulingObligation` as non-canonical output.
5567

56-
---
68+
### Public API exports and docs
5769

58-
## Testing
70+
- Update `tradingchassis_core/__init__.py` for intentional public exports only.
71+
- Sync docs in `README.md` and `docs/reference/public-api.md`.
5972

60-
Before submitting:
73+
## Pull Request Checklist
6174

62-
- The `./scripts/check.sh` script must pass
63-
- All backtests must complete successfully and produce result artifacts
75+
- [ ] Package remains Core-only and deterministic.
76+
- [ ] Public API changes are intentional and tested.
77+
- [ ] Quickstart still runs via public imports.
78+
- [ ] `python -m pytest -q` passes.
79+
- [ ] `python -m build` succeeds.
80+
- [ ] README/docs/changelog updated to match behavior.

0 commit comments

Comments
 (0)