Phase 0 completion: NT8 SDK core framework with risk management and position sizing
Some checks failed
Build and Test / build (push) Has been cancelled
Some checks failed
Build and Test / build (push) Has been cancelled
This commit is contained in:
226
project_plan.md
Normal file
226
project_plan.md
Normal file
@@ -0,0 +1,226 @@
|
||||
# NT8 Institutional SDK - Phase 0 Implementation Plan
|
||||
|
||||
## Project Overview
|
||||
This document outlines the implementation plan for the NT8 Institutional SDK Phase 0, which includes setting up the repository foundation, implementing core interfaces, risk management, and position sizing components.
|
||||
|
||||
## Phase 0 Components
|
||||
Based on the handoff summary, Phase 0 consists of 5 packages:
|
||||
1. Repository Setup Package
|
||||
2. Core Interfaces Package
|
||||
3. Risk Management Package
|
||||
4. Position Sizing Package
|
||||
5. Complete Validation Script
|
||||
|
||||
## Detailed Implementation Plan
|
||||
|
||||
### 1. Repository Setup Package
|
||||
**Objective**: Establish the complete directory structure and foundational files
|
||||
|
||||
#### Directory Structure to Create:
|
||||
```
|
||||
nt8-institutional-sdk/
|
||||
├── .gitea/
|
||||
│ └── workflows/
|
||||
│ ├── build.yml
|
||||
│ ├── test.yml
|
||||
│ └── release.yml
|
||||
├── .devcontainer/
|
||||
│ ├── devcontainer.json
|
||||
│ └── Dockerfile
|
||||
├── src/
|
||||
│ ├── NT8.Core/
|
||||
│ │ ├── Common/
|
||||
│ │ ├── Configuration/
|
||||
│ │ │ ├── Interfaces/
|
||||
│ │ │ └── Models/
|
||||
│ │ ├── Risk/
|
||||
│ │ ├── Sizing/
|
||||
│ │ ├── Logging/
|
||||
│ │ └── OMS/
|
||||
│ ├── NT8.Adapters/
|
||||
│ │ └── NinjaTrader/
|
||||
│ ├── NT8.Strategies/
|
||||
│ │ └── Examples/
|
||||
│ └── NT8.Contracts/
|
||||
│ └── V1/
|
||||
├── tests/
|
||||
│ ├── NT8.Core.Tests/
|
||||
│ ├── NT8.Integration.Tests/
|
||||
│ └── NT8.Performance.Tests/
|
||||
├── tools/
|
||||
│ ├── replay/
|
||||
│ └── market-data/
|
||||
├── docs/
|
||||
│ ├── architecture/
|
||||
│ ├── api/
|
||||
│ └── deployment/
|
||||
├── deployment/
|
||||
│ ├── dev/
|
||||
│ ├── staging/
|
||||
│ └── prod/
|
||||
├── .gitignore
|
||||
├── .editorconfig
|
||||
├── Directory.Build.props
|
||||
├── NT8-SDK.sln
|
||||
└── README.md
|
||||
```
|
||||
|
||||
#### Key Files to Create:
|
||||
1. **.gitignore** - Contains standard ignore patterns for .NET projects, Visual Studio, and NinjaTrader files
|
||||
2. **Directory.Build.props** - Centralized MSBuild properties for the solution
|
||||
3. **.editorconfig** - Code style and formatting conventions
|
||||
4. **.gitea/workflows/build.yml** - CI/CD workflow for building and testing
|
||||
5. **README.md** - Project overview and quick start guide
|
||||
|
||||
#### Tasks:
|
||||
- [ ] Create directory structure as specified in repository_setup_package.md
|
||||
- [ ] Create .gitignore file with the exact content from specifications
|
||||
- [ ] Create Directory.Build.props file with the exact content from specifications
|
||||
- [ ] Create .editorconfig file with the exact content from specifications
|
||||
- [ ] Create .gitea/workflows directory and build.yml file
|
||||
- [ ] Create README.md file with the exact content from specifications
|
||||
- [ ] Create solution and projects using the specified dotnet commands
|
||||
- [ ] Add required NuGet packages as specified
|
||||
- [ ] Validate project structure and build
|
||||
|
||||
### 2. Core Interfaces Package
|
||||
**Objective**: Implement all interface definitions and model classes
|
||||
|
||||
#### Key Files to Create:
|
||||
- src/NT8.Core/Common/Interfaces/IStrategy.cs
|
||||
- src/NT8.Core/Common/Models/StrategyMetadata.cs
|
||||
- src/NT8.Core/Common/Models/StrategyIntent.cs
|
||||
- src/NT8.Core/Common/Models/StrategyContext.cs
|
||||
- src/NT8.Core/Common/Models/MarketData.cs
|
||||
- src/NT8.Core/Risk/IRiskManager.cs
|
||||
- src/NT8.Core/Sizing/IPositionSizer.cs
|
||||
|
||||
#### Tasks:
|
||||
- [ ] Implement IStrategy interface
|
||||
- [ ] Implement StrategyMetadata and related models
|
||||
- [ ] Implement StrategyIntent and related enums
|
||||
- [ ] Implement StrategyContext and related models
|
||||
- [ ] Implement MarketData models and IMarketDataProvider interface
|
||||
- [ ] Implement IRiskManager interface
|
||||
- [ ] Implement IPositionSizer interface
|
||||
|
||||
### 3. Risk Management Package
|
||||
**Objective**: Implement the BasicRiskManager with Tier 1 risk controls
|
||||
|
||||
#### Key Files to Create:
|
||||
- src/NT8.Core/Risk/BasicRiskManager.cs
|
||||
|
||||
#### Tasks:
|
||||
- [ ] Implement ValidateOrder method with all Tier 1 checks
|
||||
- [ ] Implement OnFill method for position tracking
|
||||
- [ ] Implement OnPnLUpdate method for P&L tracking
|
||||
- [ ] Implement EmergencyFlatten method for emergency halts
|
||||
- [ ] Implement GetRiskStatus method for monitoring
|
||||
- [ ] Implement thread-safe locking mechanisms
|
||||
- [ ] Add proper logging throughout the implementation
|
||||
|
||||
### 4. Position Sizing Package
|
||||
**Objective**: Implement the BasicPositionSizer with fixed contracts and fixed dollar risk methods
|
||||
|
||||
#### Key Files to Create:
|
||||
- src/NT8.Core/Sizing/BasicPositionSizer.cs
|
||||
|
||||
#### Tasks:
|
||||
- [ ] Implement CalculateSize method with both sizing methods
|
||||
- [ ] Implement Fixed Contracts sizing approach
|
||||
- [ ] Implement Fixed Dollar Risk sizing approach
|
||||
- [ ] Implement contract clamping (min/max limits)
|
||||
- [ ] Implement multi-symbol support with accurate tick values
|
||||
- [ ] Add proper configuration validation
|
||||
- [ ] Add comprehensive error handling
|
||||
|
||||
### 5. Test Suite Implementation
|
||||
**Objective**: Create comprehensive unit tests for all components
|
||||
|
||||
#### Tasks:
|
||||
- [ ] Create test project structure
|
||||
- [ ] Implement test data builders
|
||||
- [ ] Create unit tests for Core Interfaces
|
||||
- [ ] Create unit tests for Risk Management
|
||||
- [ ] Create scenario tests for Risk Management
|
||||
- [ ] Create unit tests for Position Sizing
|
||||
- [ ] Create calculation validation tests for Position Sizing
|
||||
- [ ] Ensure >90% test coverage
|
||||
|
||||
### 6. Validation and Documentation
|
||||
**Objective**: Validate the complete implementation and create documentation
|
||||
|
||||
#### Tasks:
|
||||
- [ ] Run complete validation script
|
||||
- [ ] Verify all success criteria are met
|
||||
- [ ] Document SDK foundation and usage guidelines
|
||||
- [ ] Create developer setup guide
|
||||
- [ ] Document architecture principles
|
||||
|
||||
## Development Guidelines
|
||||
All implementation must follow the guidelines specified in:
|
||||
- rules/archon.md - Archon workflow principles
|
||||
- rules/Compile error guidance.md - NT8 compile guidelines
|
||||
- rules/Guidelines.md - General development guidelines
|
||||
- rules/nt8compilespec.md - NT8 compile specifications
|
||||
|
||||
## Success Criteria
|
||||
Phase 0 is considered complete when:
|
||||
1. Repository structure matches specification exactly
|
||||
2. All starter files are in correct locations
|
||||
3. Solution builds successfully with 0 warnings
|
||||
4. All NuGet packages are properly referenced
|
||||
5. CI/CD pipeline configuration is in place
|
||||
6. All core interfaces are implemented
|
||||
7. Risk management is fully functional with Tier 1 controls
|
||||
8. Position sizing works with both methods
|
||||
9. Comprehensive test suite passes with >90% coverage
|
||||
10. Complete validation script passes
|
||||
|
||||
## Next Steps (Phase 1)
|
||||
After successful completion of Phase 0, the focus will shift to:
|
||||
1. Order Management System implementation
|
||||
2. NinjaTrader 8 adapter development
|
||||
3. Enhanced risk controls (Tier 2)
|
||||
4. Market data handling and validation
|
||||
5. Performance optimization
|
||||
|
||||
## Timeline
|
||||
Estimated completion time: 2-3 weeks of traditional development (accelerated with AI implementation)
|
||||
|
||||
## Notes
|
||||
This plan follows the Archon workflow principles:
|
||||
1. Check Current Task → Review task details and requirements
|
||||
2. Research for Task → Search relevant documentation and examples
|
||||
3. Implement the Task → Write code based on research
|
||||
4. Update Task Status → Move task from "todo" → "doing" → "review"
|
||||
5. Get Next Task → Check for next priority task
|
||||
6. Repeat Cycle
|
||||
|
||||
## Implementation Approach
|
||||
Since this is being developed in Architect mode, the actual implementation will require switching to Code mode. The following files will need to be created in Code mode:
|
||||
|
||||
### Configuration Files
|
||||
1. `.gitignore` - Git ignore patterns
|
||||
2. `Directory.Build.props` - MSBuild properties
|
||||
3. `.editorconfig` - Code formatting rules
|
||||
4. `.gitea/workflows/build.yml` - CI/CD workflow
|
||||
5. `README.md` - Project documentation
|
||||
|
||||
### Core SDK Files
|
||||
1. `src/NT8.Core/Common/Interfaces/IStrategy.cs` - Strategy interface
|
||||
2. `src/NT8.Core/Common/Models/StrategyMetadata.cs` - Strategy metadata models
|
||||
3. `src/NT8.Core/Common/Models/StrategyIntent.cs` - Strategy intent models
|
||||
4. `src/NT8.Core/Common/Models/StrategyContext.cs` - Strategy context models
|
||||
5. `src/NT8.Core/Common/Models/MarketData.cs` - Market data models
|
||||
6. `src/NT8.Core/Risk/IRiskManager.cs` - Risk manager interface
|
||||
7. `src/NT8.Core/Risk/BasicRiskManager.cs` - Risk manager implementation
|
||||
8. `src/NT8.Core/Sizing/IPositionSizer.cs` - Position sizer interface
|
||||
9. `src/NT8.Core/Sizing/BasicPositionSizer.cs` - Position sizer implementation
|
||||
|
||||
### Test Files
|
||||
1. `tests/NT8.Core.Tests/Risk/BasicRiskManagerTests.cs` - Risk manager unit tests
|
||||
2. `tests/NT8.Core.Tests/Risk/RiskScenarioTests.cs` - Risk scenario tests
|
||||
3. `tests/NT8.Core.Tests/Sizing/BasicPositionSizerTests.cs` - Position sizer unit tests
|
||||
|
||||
This implementation plan should be followed when switching to Code mode for actual file creation and coding.
|
||||
Reference in New Issue
Block a user