onesecondtrader 0.6.0__tar.gz → 0.8.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- onesecondtrader-0.8.0/PKG-INFO +248 -0
- onesecondtrader-0.8.0/README.md +233 -0
- {onesecondtrader-0.6.0 → onesecondtrader-0.8.0}/pyproject.toml +3 -1
- {onesecondtrader-0.6.0 → onesecondtrader-0.8.0}/src/onesecondtrader/__init__.py +1 -3
- onesecondtrader-0.8.0/src/onesecondtrader/core/__init__.py +0 -0
- onesecondtrader-0.8.0/src/onesecondtrader/core/models.py +133 -0
- onesecondtrader-0.8.0/src/onesecondtrader/core/py.typed +0 -0
- onesecondtrader-0.8.0/src/onesecondtrader/messaging/__init__.py +0 -0
- onesecondtrader-0.8.0/src/onesecondtrader/messaging/events.py +742 -0
- onesecondtrader-0.8.0/src/onesecondtrader/monitoring/__init__.py +0 -0
- onesecondtrader-0.6.0/src/onesecondtrader/monitoring.py → onesecondtrader-0.8.0/src/onesecondtrader/monitoring/console.py +2 -3
- onesecondtrader-0.8.0/src/onesecondtrader/monitoring/py.typed +0 -0
- onesecondtrader-0.8.0/src/onesecondtrader/py.typed +0 -0
- onesecondtrader-0.6.0/PKG-INFO +0 -24
- onesecondtrader-0.6.0/README.md +0 -9
- {onesecondtrader-0.6.0 → onesecondtrader-0.8.0}/LICENSE +0 -0
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: onesecondtrader
|
|
3
|
+
Version: 0.8.0
|
|
4
|
+
Summary: The Trading Infrastructure Toolkit for Python. Research, simulate, and deploy algorithmic trading strategies — all in one place.
|
|
5
|
+
Author: Nils P. Kujath
|
|
6
|
+
Author-email: 63961429+NilsKujath@users.noreply.github.com
|
|
7
|
+
Requires-Python: >=3.11
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
12
|
+
Requires-Dist: pandas (>=2.3.1,<3.0.0)
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
|
|
15
|
+
# OneSecondTrader
|
|
16
|
+
|
|
17
|
+
[](https://github.com/nilskujath/onesecondtrader/actions/workflows/release.yml)
|
|
18
|
+
[](https://www.onesecondtrader.com)
|
|
19
|
+
[](https://pypi.org/project/onesecondtrader/)
|
|
20
|
+
[](https://github.com/nilskujath/onesecondtrader/blob/master/LICENSE)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
For documentation, please visit [onesecondtrader.com](https://www.onesecondtrader.com).
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
## For Developers: Continuous Integration & Delivery (CI/CD) Pipeline
|
|
29
|
+
|
|
30
|
+
This project's continuous integration & continuous delivery (CI/CD) pipeline consists of two distinct workflows:
|
|
31
|
+
**local pre-commit hooks** that run on `git commit` to ensure code quality,
|
|
32
|
+
and **GitHub Actions** that run on `git push origin master` to automate releases.
|
|
33
|
+
|
|
34
|
+
In order for the pipeline to work, the following configuration is required:
|
|
35
|
+
|
|
36
|
+
* version field in `pyproject.toml` must be set to appropriate version
|
|
37
|
+
```toml
|
|
38
|
+
[tool.poetry]
|
|
39
|
+
name = "onesecondtrader"
|
|
40
|
+
version = "0.1.0" # Updated automatically by bump_version.py
|
|
41
|
+
```
|
|
42
|
+
* `mkdocs.yml` must have `mkdocstrings-python` plugin configured
|
|
43
|
+
```yaml
|
|
44
|
+
plugins:
|
|
45
|
+
- mkdocstrings:
|
|
46
|
+
handlers:
|
|
47
|
+
python:
|
|
48
|
+
options:
|
|
49
|
+
docstring_style: google
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Local Pre-Commit Workflow
|
|
53
|
+
|
|
54
|
+
To ensure that only good quality code is commited to the repository, a series of pre-commit hooks are executed before each commit.
|
|
55
|
+
These hooks include code quality checks, testing, security scans, and automated API reference generation.
|
|
56
|
+
This workflow is orchestrated by the `pre-commit` package, which is configured in the `.pre-commit-config.yaml` file.
|
|
57
|
+
If any of these checks fail, the commit is blocked and the developer must fix the issues before retrying.
|
|
58
|
+
|
|
59
|
+
Prior to usage, the pre-commit hooks must be installed by running:
|
|
60
|
+
```bash
|
|
61
|
+
poetry run pre-commit install
|
|
62
|
+
poetry run pre-commit install --hook-type commit-msg
|
|
63
|
+
poetry run pre-commit run --all-files # Optional: Test installation
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
This project follows [Conventional Commits](https://www.conventionalcommits.org/) specification for commit messages.
|
|
67
|
+
This standardized format enables automated semantic versioning and changelog generation.
|
|
68
|
+
The commit messages must have the following format:
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
<type>: <description>
|
|
72
|
+
|
|
73
|
+
[optional body]
|
|
74
|
+
|
|
75
|
+
[optional footer(s)]
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
The commit message must start with a type, followed by a colon and a space, and then a description. The type must be one of the following:
|
|
79
|
+
|
|
80
|
+
- **feat**: New features that add functionality
|
|
81
|
+
- **fix**: Bug fixes and patches
|
|
82
|
+
- **docs**: Documentation changes only
|
|
83
|
+
- **chore**: Maintenance tasks, dependency updates, build changes
|
|
84
|
+
- **test**: Adding or modifying tests
|
|
85
|
+
- **refactor**: Code changes that neither fix bugs nor add features
|
|
86
|
+
- **perf**: Performance improvements
|
|
87
|
+
- **ci**: Changes to CI/CD configuration
|
|
88
|
+
|
|
89
|
+
Examples:
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
feat: added trade-by-trade chart generation
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
The following diagram illustrates this pre-commit workflow:
|
|
96
|
+
|
|
97
|
+
```mermaid
|
|
98
|
+
---
|
|
99
|
+
config:
|
|
100
|
+
themeVariables:
|
|
101
|
+
fontSize: "11px"
|
|
102
|
+
---
|
|
103
|
+
graph TD
|
|
104
|
+
A([<kbd>git commit</kbd>]) -->|Trigger Pre-commit Workflow on <kbd>commit</kbd>| PrecommitHooks
|
|
105
|
+
|
|
106
|
+
subgraph PrecommitHooks ["Local Pre-commit Hooks"]
|
|
107
|
+
B["<b>Code Quality Checks</b><br/>• Ruff Check & Format<br/>• MyPy Type Checking<br/>• Tests & Doctests"]
|
|
108
|
+
C["<b>Security Checks</b><br/>• Gitleaks Secret Detection"]
|
|
109
|
+
D["<b>File Validation</b><br/>• YAML/TOML/JSON Check<br/>• End-of-file Fixer<br/>• Large Files Check<br/>• Merge Conflict Check<br/>• Debug Statements Check"]
|
|
110
|
+
E["<b>Generate API Documentation</b> via <kbd>scripts/generate_api_docs.py</kbd><br/>• Auto-generate docs<br/>• Stage changes"]
|
|
111
|
+
end
|
|
112
|
+
B --> C --> D --> E
|
|
113
|
+
|
|
114
|
+
F([Write Commit Message])
|
|
115
|
+
PrecommitHooks -->|Pass| F
|
|
116
|
+
PrecommitHooks -.->|Fail| H
|
|
117
|
+
|
|
118
|
+
subgraph CommitMessageHook ["Commit Message Hook"]
|
|
119
|
+
G{Commit Message Valid?}
|
|
120
|
+
end
|
|
121
|
+
G -.->|No| H[Commit Blocked]
|
|
122
|
+
G -->|Yes| I[Commit Successful]
|
|
123
|
+
|
|
124
|
+
F --> CommitMessageHook
|
|
125
|
+
|
|
126
|
+
H -.->|Rework & Restage<br/>| K
|
|
127
|
+
|
|
128
|
+
K(["<kbd>git commit --amend</kbd>"])
|
|
129
|
+
|
|
130
|
+
K -.-> PrecommitHooks
|
|
131
|
+
|
|
132
|
+
L(["<kbd>git pull --rebase origin master</kbd>"])
|
|
133
|
+
|
|
134
|
+
L -.->|Rebase & Resolve Conflicts| M
|
|
135
|
+
|
|
136
|
+
M([<kbd>git add <...></kbd>])
|
|
137
|
+
|
|
138
|
+
M -.-> A
|
|
139
|
+
|
|
140
|
+
I -.~.-> J([<kbd>git push</kbd>])
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
### GitHub Actions Workflow
|
|
145
|
+
|
|
146
|
+
Once a commit is pushed to the remote `master` branch, the GitHub Actions workflow `.github/workflows/release.yml` is triggered.
|
|
147
|
+
Note that the GitHub Actions workflow might push commits to the remote repository.
|
|
148
|
+
This means your local branch will be behind the remote branch.
|
|
149
|
+
|
|
150
|
+
In order for this workflow to run properly, two secrets need to be configured (`Settings > Secrets and variables > Actions`):
|
|
151
|
+
|
|
152
|
+
- `GH_PAT`: Personal Access Token with enhanced permissions (see PAT Setup below)
|
|
153
|
+
- `PYPI_API_TOKEN`: Generate from PyPI account settings
|
|
154
|
+
|
|
155
|
+
The default `GITHUB_TOKEN` has limited permissions and cannot trigger subsequent workflow runs or push to protected branches.
|
|
156
|
+
The PAT provides the necessary permissions for the automated release process.
|
|
157
|
+
The PAT is created as follows:
|
|
158
|
+
|
|
159
|
+
1. Go to GitHub Settings > Developer settings > Personal access tokens > Tokens (classic)
|
|
160
|
+
2. Click "Generate new token (classic)"
|
|
161
|
+
3. Set expiration and select these scopes:
|
|
162
|
+
- `repo` (Full control of private repositories)
|
|
163
|
+
- `workflow` (Update GitHub Action workflows)
|
|
164
|
+
4. Copy the token and add it as `GH_PAT` secret in repository settings
|
|
165
|
+
|
|
166
|
+
Note that GitHub Actions bot must have write permissions to the repository.
|
|
167
|
+
|
|
168
|
+
The following diagram illustrates this GitHub Actions workflow:
|
|
169
|
+
|
|
170
|
+
```mermaid
|
|
171
|
+
---
|
|
172
|
+
config:
|
|
173
|
+
themeVariables:
|
|
174
|
+
fontSize: "11px"
|
|
175
|
+
---
|
|
176
|
+
graph TD
|
|
177
|
+
|
|
178
|
+
A0(<kdb>git commit</kbd>)
|
|
179
|
+
|
|
180
|
+
A1(<kdb>git commit --amend</kdb>)
|
|
181
|
+
|
|
182
|
+
A(<kbd>git push origin master</kbd>) -->|Trigger GitHub Actions Workflow on <kbd>push</kbd>| GitHubActions
|
|
183
|
+
|
|
184
|
+
A2(<kbd>git push origin master --force</kbd>) -->|Trigger GitHub Actions Workflow on <kbd>push</kbd>| GitHubActions
|
|
185
|
+
|
|
186
|
+
A0 -.->|Trigger Pre-commit Workflow & Commit| A
|
|
187
|
+
A1 -.->|Trigger Pre-commit Workflow & Commit| A2
|
|
188
|
+
|
|
189
|
+
subgraph GitHubActions ["GitHub Actions Environment Setup"]
|
|
190
|
+
B["<b>Checkout Repository</b><br/>Retrieve the full repository history on the latest Ubuntu runner"]
|
|
191
|
+
C["<b>Setup Python Environment</b><br/>Configure the required Python version and install Poetry"]
|
|
192
|
+
D["<b>Install Dependencies</b><br/>Install all project dependencies, including development ones"]
|
|
193
|
+
B --> C --> D
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
GitHubActions -.->|Failure<br/>Rework & Restage| A3
|
|
197
|
+
A3(<kdb>git commit --amend</kdb>)
|
|
198
|
+
|
|
199
|
+
GitHubActions -->|Environment Setup Complete| QualityChecks
|
|
200
|
+
|
|
201
|
+
subgraph QualityChecks ["CI Quality Validation"]
|
|
202
|
+
F["<b>Ruff Linting</b><br/>Validate code style and enforce formatting rules"]
|
|
203
|
+
G["<b>MyPy Type Checking</b><br/>Static type analysis"]
|
|
204
|
+
H["<b>Test Suite</b><br/>Run all automated tests"]
|
|
205
|
+
F --> G --> H
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
QualityChecks -.->|Failure<br/>Rework & Restage| A3
|
|
209
|
+
|
|
210
|
+
QualityChecks -->|CI Quality Checks Passed| GitConfig
|
|
211
|
+
|
|
212
|
+
subgraph GitConfig ["Git Configuration"]
|
|
213
|
+
J["<b>Configure Git Identity</b><br/>Set the automated commit author for CI operations"]
|
|
214
|
+
K["<b>Setup Authentication</b><br/>Enable secure access to the repository with release permissions (requires <kbd>GH_PAT</kbd>)"]
|
|
215
|
+
J --> K
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
GitConfig -->|Git Configured| VersionAnalysis
|
|
219
|
+
|
|
220
|
+
subgraph VersionAnalysis ["Semantic Version Analysis"]
|
|
221
|
+
N["<b>Execute bump_version.py</b><br/>Analyze commits since last tag to decide on version bump and bump level"]
|
|
222
|
+
P{Version Bump Required?}
|
|
223
|
+
N --> P
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
VersionAnalysis -->|No Version Change<br/>Skip Release Process| DocDeployment
|
|
227
|
+
VersionAnalysis -->|Version Bump Required| ReleaseProcess
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
subgraph ReleaseProcess ["Release & Publishing"]
|
|
231
|
+
R["<b>Update Version & Changelog</b><br/>Write new version and regenerate release notes."]
|
|
232
|
+
S["<b>Commit & Push</b><br/>Commit updated files and push to the default branch."]
|
|
233
|
+
T["<b>Publish to PyPI</b><br/>Build and upload distributions in one step."]
|
|
234
|
+
U["<b>Create GitHub Release</b><br/>Publish tag and attach changelog."]
|
|
235
|
+
R --> S --> T --> U
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
ReleaseProcess -->|Release Complete| DocDeployment
|
|
240
|
+
|
|
241
|
+
subgraph DocDeployment ["Documentation Deployment"]
|
|
242
|
+
X["<b>Generate API Documentation</b><br/>Automatically build API docs and update navigation"]
|
|
243
|
+
Y["<b>Install Package for Docs</b><br/>Prepare project for import-based documentation"]
|
|
244
|
+
Z["<b>Deploy to GitHub Pages</b><br/>Publish updated documentation site"]
|
|
245
|
+
X --> Y --> Z
|
|
246
|
+
end
|
|
247
|
+
```
|
|
248
|
+
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
# OneSecondTrader
|
|
2
|
+
|
|
3
|
+
[](https://github.com/nilskujath/onesecondtrader/actions/workflows/release.yml)
|
|
4
|
+
[](https://www.onesecondtrader.com)
|
|
5
|
+
[](https://pypi.org/project/onesecondtrader/)
|
|
6
|
+
[](https://github.com/nilskujath/onesecondtrader/blob/master/LICENSE)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
For documentation, please visit [onesecondtrader.com](https://www.onesecondtrader.com).
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## For Developers: Continuous Integration & Delivery (CI/CD) Pipeline
|
|
15
|
+
|
|
16
|
+
This project's continuous integration & continuous delivery (CI/CD) pipeline consists of two distinct workflows:
|
|
17
|
+
**local pre-commit hooks** that run on `git commit` to ensure code quality,
|
|
18
|
+
and **GitHub Actions** that run on `git push origin master` to automate releases.
|
|
19
|
+
|
|
20
|
+
In order for the pipeline to work, the following configuration is required:
|
|
21
|
+
|
|
22
|
+
* version field in `pyproject.toml` must be set to appropriate version
|
|
23
|
+
```toml
|
|
24
|
+
[tool.poetry]
|
|
25
|
+
name = "onesecondtrader"
|
|
26
|
+
version = "0.1.0" # Updated automatically by bump_version.py
|
|
27
|
+
```
|
|
28
|
+
* `mkdocs.yml` must have `mkdocstrings-python` plugin configured
|
|
29
|
+
```yaml
|
|
30
|
+
plugins:
|
|
31
|
+
- mkdocstrings:
|
|
32
|
+
handlers:
|
|
33
|
+
python:
|
|
34
|
+
options:
|
|
35
|
+
docstring_style: google
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Local Pre-Commit Workflow
|
|
39
|
+
|
|
40
|
+
To ensure that only good quality code is commited to the repository, a series of pre-commit hooks are executed before each commit.
|
|
41
|
+
These hooks include code quality checks, testing, security scans, and automated API reference generation.
|
|
42
|
+
This workflow is orchestrated by the `pre-commit` package, which is configured in the `.pre-commit-config.yaml` file.
|
|
43
|
+
If any of these checks fail, the commit is blocked and the developer must fix the issues before retrying.
|
|
44
|
+
|
|
45
|
+
Prior to usage, the pre-commit hooks must be installed by running:
|
|
46
|
+
```bash
|
|
47
|
+
poetry run pre-commit install
|
|
48
|
+
poetry run pre-commit install --hook-type commit-msg
|
|
49
|
+
poetry run pre-commit run --all-files # Optional: Test installation
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
This project follows [Conventional Commits](https://www.conventionalcommits.org/) specification for commit messages.
|
|
53
|
+
This standardized format enables automated semantic versioning and changelog generation.
|
|
54
|
+
The commit messages must have the following format:
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
<type>: <description>
|
|
58
|
+
|
|
59
|
+
[optional body]
|
|
60
|
+
|
|
61
|
+
[optional footer(s)]
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
The commit message must start with a type, followed by a colon and a space, and then a description. The type must be one of the following:
|
|
65
|
+
|
|
66
|
+
- **feat**: New features that add functionality
|
|
67
|
+
- **fix**: Bug fixes and patches
|
|
68
|
+
- **docs**: Documentation changes only
|
|
69
|
+
- **chore**: Maintenance tasks, dependency updates, build changes
|
|
70
|
+
- **test**: Adding or modifying tests
|
|
71
|
+
- **refactor**: Code changes that neither fix bugs nor add features
|
|
72
|
+
- **perf**: Performance improvements
|
|
73
|
+
- **ci**: Changes to CI/CD configuration
|
|
74
|
+
|
|
75
|
+
Examples:
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
feat: added trade-by-trade chart generation
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
The following diagram illustrates this pre-commit workflow:
|
|
82
|
+
|
|
83
|
+
```mermaid
|
|
84
|
+
---
|
|
85
|
+
config:
|
|
86
|
+
themeVariables:
|
|
87
|
+
fontSize: "11px"
|
|
88
|
+
---
|
|
89
|
+
graph TD
|
|
90
|
+
A([<kbd>git commit</kbd>]) -->|Trigger Pre-commit Workflow on <kbd>commit</kbd>| PrecommitHooks
|
|
91
|
+
|
|
92
|
+
subgraph PrecommitHooks ["Local Pre-commit Hooks"]
|
|
93
|
+
B["<b>Code Quality Checks</b><br/>• Ruff Check & Format<br/>• MyPy Type Checking<br/>• Tests & Doctests"]
|
|
94
|
+
C["<b>Security Checks</b><br/>• Gitleaks Secret Detection"]
|
|
95
|
+
D["<b>File Validation</b><br/>• YAML/TOML/JSON Check<br/>• End-of-file Fixer<br/>• Large Files Check<br/>• Merge Conflict Check<br/>• Debug Statements Check"]
|
|
96
|
+
E["<b>Generate API Documentation</b> via <kbd>scripts/generate_api_docs.py</kbd><br/>• Auto-generate docs<br/>• Stage changes"]
|
|
97
|
+
end
|
|
98
|
+
B --> C --> D --> E
|
|
99
|
+
|
|
100
|
+
F([Write Commit Message])
|
|
101
|
+
PrecommitHooks -->|Pass| F
|
|
102
|
+
PrecommitHooks -.->|Fail| H
|
|
103
|
+
|
|
104
|
+
subgraph CommitMessageHook ["Commit Message Hook"]
|
|
105
|
+
G{Commit Message Valid?}
|
|
106
|
+
end
|
|
107
|
+
G -.->|No| H[Commit Blocked]
|
|
108
|
+
G -->|Yes| I[Commit Successful]
|
|
109
|
+
|
|
110
|
+
F --> CommitMessageHook
|
|
111
|
+
|
|
112
|
+
H -.->|Rework & Restage<br/>| K
|
|
113
|
+
|
|
114
|
+
K(["<kbd>git commit --amend</kbd>"])
|
|
115
|
+
|
|
116
|
+
K -.-> PrecommitHooks
|
|
117
|
+
|
|
118
|
+
L(["<kbd>git pull --rebase origin master</kbd>"])
|
|
119
|
+
|
|
120
|
+
L -.->|Rebase & Resolve Conflicts| M
|
|
121
|
+
|
|
122
|
+
M([<kbd>git add <...></kbd>])
|
|
123
|
+
|
|
124
|
+
M -.-> A
|
|
125
|
+
|
|
126
|
+
I -.~.-> J([<kbd>git push</kbd>])
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
### GitHub Actions Workflow
|
|
131
|
+
|
|
132
|
+
Once a commit is pushed to the remote `master` branch, the GitHub Actions workflow `.github/workflows/release.yml` is triggered.
|
|
133
|
+
Note that the GitHub Actions workflow might push commits to the remote repository.
|
|
134
|
+
This means your local branch will be behind the remote branch.
|
|
135
|
+
|
|
136
|
+
In order for this workflow to run properly, two secrets need to be configured (`Settings > Secrets and variables > Actions`):
|
|
137
|
+
|
|
138
|
+
- `GH_PAT`: Personal Access Token with enhanced permissions (see PAT Setup below)
|
|
139
|
+
- `PYPI_API_TOKEN`: Generate from PyPI account settings
|
|
140
|
+
|
|
141
|
+
The default `GITHUB_TOKEN` has limited permissions and cannot trigger subsequent workflow runs or push to protected branches.
|
|
142
|
+
The PAT provides the necessary permissions for the automated release process.
|
|
143
|
+
The PAT is created as follows:
|
|
144
|
+
|
|
145
|
+
1. Go to GitHub Settings > Developer settings > Personal access tokens > Tokens (classic)
|
|
146
|
+
2. Click "Generate new token (classic)"
|
|
147
|
+
3. Set expiration and select these scopes:
|
|
148
|
+
- `repo` (Full control of private repositories)
|
|
149
|
+
- `workflow` (Update GitHub Action workflows)
|
|
150
|
+
4. Copy the token and add it as `GH_PAT` secret in repository settings
|
|
151
|
+
|
|
152
|
+
Note that GitHub Actions bot must have write permissions to the repository.
|
|
153
|
+
|
|
154
|
+
The following diagram illustrates this GitHub Actions workflow:
|
|
155
|
+
|
|
156
|
+
```mermaid
|
|
157
|
+
---
|
|
158
|
+
config:
|
|
159
|
+
themeVariables:
|
|
160
|
+
fontSize: "11px"
|
|
161
|
+
---
|
|
162
|
+
graph TD
|
|
163
|
+
|
|
164
|
+
A0(<kdb>git commit</kbd>)
|
|
165
|
+
|
|
166
|
+
A1(<kdb>git commit --amend</kdb>)
|
|
167
|
+
|
|
168
|
+
A(<kbd>git push origin master</kbd>) -->|Trigger GitHub Actions Workflow on <kbd>push</kbd>| GitHubActions
|
|
169
|
+
|
|
170
|
+
A2(<kbd>git push origin master --force</kbd>) -->|Trigger GitHub Actions Workflow on <kbd>push</kbd>| GitHubActions
|
|
171
|
+
|
|
172
|
+
A0 -.->|Trigger Pre-commit Workflow & Commit| A
|
|
173
|
+
A1 -.->|Trigger Pre-commit Workflow & Commit| A2
|
|
174
|
+
|
|
175
|
+
subgraph GitHubActions ["GitHub Actions Environment Setup"]
|
|
176
|
+
B["<b>Checkout Repository</b><br/>Retrieve the full repository history on the latest Ubuntu runner"]
|
|
177
|
+
C["<b>Setup Python Environment</b><br/>Configure the required Python version and install Poetry"]
|
|
178
|
+
D["<b>Install Dependencies</b><br/>Install all project dependencies, including development ones"]
|
|
179
|
+
B --> C --> D
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
GitHubActions -.->|Failure<br/>Rework & Restage| A3
|
|
183
|
+
A3(<kdb>git commit --amend</kdb>)
|
|
184
|
+
|
|
185
|
+
GitHubActions -->|Environment Setup Complete| QualityChecks
|
|
186
|
+
|
|
187
|
+
subgraph QualityChecks ["CI Quality Validation"]
|
|
188
|
+
F["<b>Ruff Linting</b><br/>Validate code style and enforce formatting rules"]
|
|
189
|
+
G["<b>MyPy Type Checking</b><br/>Static type analysis"]
|
|
190
|
+
H["<b>Test Suite</b><br/>Run all automated tests"]
|
|
191
|
+
F --> G --> H
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
QualityChecks -.->|Failure<br/>Rework & Restage| A3
|
|
195
|
+
|
|
196
|
+
QualityChecks -->|CI Quality Checks Passed| GitConfig
|
|
197
|
+
|
|
198
|
+
subgraph GitConfig ["Git Configuration"]
|
|
199
|
+
J["<b>Configure Git Identity</b><br/>Set the automated commit author for CI operations"]
|
|
200
|
+
K["<b>Setup Authentication</b><br/>Enable secure access to the repository with release permissions (requires <kbd>GH_PAT</kbd>)"]
|
|
201
|
+
J --> K
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
GitConfig -->|Git Configured| VersionAnalysis
|
|
205
|
+
|
|
206
|
+
subgraph VersionAnalysis ["Semantic Version Analysis"]
|
|
207
|
+
N["<b>Execute bump_version.py</b><br/>Analyze commits since last tag to decide on version bump and bump level"]
|
|
208
|
+
P{Version Bump Required?}
|
|
209
|
+
N --> P
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
VersionAnalysis -->|No Version Change<br/>Skip Release Process| DocDeployment
|
|
213
|
+
VersionAnalysis -->|Version Bump Required| ReleaseProcess
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
subgraph ReleaseProcess ["Release & Publishing"]
|
|
217
|
+
R["<b>Update Version & Changelog</b><br/>Write new version and regenerate release notes."]
|
|
218
|
+
S["<b>Commit & Push</b><br/>Commit updated files and push to the default branch."]
|
|
219
|
+
T["<b>Publish to PyPI</b><br/>Build and upload distributions in one step."]
|
|
220
|
+
U["<b>Create GitHub Release</b><br/>Publish tag and attach changelog."]
|
|
221
|
+
R --> S --> T --> U
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
ReleaseProcess -->|Release Complete| DocDeployment
|
|
226
|
+
|
|
227
|
+
subgraph DocDeployment ["Documentation Deployment"]
|
|
228
|
+
X["<b>Generate API Documentation</b><br/>Automatically build API docs and update navigation"]
|
|
229
|
+
Y["<b>Install Package for Docs</b><br/>Prepare project for import-based documentation"]
|
|
230
|
+
Z["<b>Deploy to GitHub Pages</b><br/>Publish updated documentation site"]
|
|
231
|
+
X --> Y --> Z
|
|
232
|
+
end
|
|
233
|
+
```
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "onesecondtrader"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.8.0"
|
|
4
4
|
description = "The Trading Infrastructure Toolkit for Python. Research, simulate, and deploy algorithmic trading strategies — all in one place."
|
|
5
5
|
authors = [
|
|
6
6
|
{name = "Nils P. Kujath",email = "63961429+NilsKujath@users.noreply.github.com"}
|
|
@@ -53,6 +53,8 @@ build-backend = "poetry.core.masonry.api"
|
|
|
53
53
|
|
|
54
54
|
[tool.mypy]
|
|
55
55
|
explicit_package_bases = true
|
|
56
|
+
mypy_path = "src"
|
|
57
|
+
namespace_packages = true
|
|
56
58
|
|
|
57
59
|
[tool.pytest.ini_options]
|
|
58
60
|
testpaths = ["tests"]
|
|
@@ -4,11 +4,9 @@ The Trading Infrastructure Toolkit for Python.
|
|
|
4
4
|
Research, simulate, and deploy algorithmic trading strategies — all in one place.
|
|
5
5
|
"""
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
from .monitoring import logger
|
|
7
|
+
from .monitoring.console import logger
|
|
9
8
|
|
|
10
9
|
|
|
11
10
|
__all__ = [
|
|
12
|
-
# Core infrastructure
|
|
13
11
|
"logger",
|
|
14
12
|
]
|
|
File without changes
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
import enum
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class BrokerType(enum.Enum):
|
|
6
|
+
"""
|
|
7
|
+
Enum for broker types.
|
|
8
|
+
|
|
9
|
+
**Attributes:**
|
|
10
|
+
|
|
11
|
+
| Enum | Value | Description |
|
|
12
|
+
|------|-------|-------------|
|
|
13
|
+
| `LOCAL_SIMULATED` | `enum.auto()` | Locally simulated broker |
|
|
14
|
+
| `IB_SIMULATED` | `enum.auto()` | Interactive Brokers paper trading account |
|
|
15
|
+
| `IB_LIVE` | `enum.auto()` | Interactive Brokers live trading account |
|
|
16
|
+
| `MT5` | `enum.auto()` | MetaTrader 5 |
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
LOCAL_SIMULATED = enum.auto()
|
|
20
|
+
IB_SIMULATED = enum.auto()
|
|
21
|
+
IB_LIVE = enum.auto()
|
|
22
|
+
MT5 = enum.auto()
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
@dataclass(frozen=True, slots=True)
|
|
26
|
+
class Bar:
|
|
27
|
+
"""
|
|
28
|
+
Class for representing a OHLC(V) bar of market data.
|
|
29
|
+
|
|
30
|
+
Attributes:
|
|
31
|
+
open (float): Open price
|
|
32
|
+
high (float): High price
|
|
33
|
+
low (float): Low price
|
|
34
|
+
close (float): Close price
|
|
35
|
+
volume (float): Volume
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
open: float
|
|
39
|
+
high: float
|
|
40
|
+
low: float
|
|
41
|
+
close: float
|
|
42
|
+
volume: float | None = None
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class Side(enum.Enum):
|
|
46
|
+
"""
|
|
47
|
+
Enum for order sides.
|
|
48
|
+
"""
|
|
49
|
+
|
|
50
|
+
BUY = enum.auto()
|
|
51
|
+
SELL = enum.auto()
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
class TimeInForce(enum.Enum):
|
|
55
|
+
"""
|
|
56
|
+
Order time-in-force specifications.
|
|
57
|
+
|
|
58
|
+
**Attributes:**
|
|
59
|
+
|
|
60
|
+
| Enum | Value | Description |
|
|
61
|
+
|------|-------|-------------|
|
|
62
|
+
| `DAY` | `enum.auto()` | Valid until end of trading day |
|
|
63
|
+
| `FOK` | `enum.auto()` | Fill entire order immediately or cancel (Fill-or-Kill) |
|
|
64
|
+
| `GTC` | `enum.auto()` | Active until explicitly cancelled (Good-Till-Cancelled) |
|
|
65
|
+
| `GTD` | `enum.auto()` | Active until specified date (Good-Till-Date) |
|
|
66
|
+
| `IOC` | `enum.auto()` | Execute available quantity immediately, cancel rest
|
|
67
|
+
(Immediate-or-Cancel) |
|
|
68
|
+
"""
|
|
69
|
+
|
|
70
|
+
DAY = enum.auto()
|
|
71
|
+
FOK = enum.auto()
|
|
72
|
+
GTC = enum.auto()
|
|
73
|
+
GTD = enum.auto()
|
|
74
|
+
IOC = enum.auto()
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
class OrderType(enum.Enum):
|
|
78
|
+
"""
|
|
79
|
+
Enum for order types.
|
|
80
|
+
|
|
81
|
+
**Attributes:**
|
|
82
|
+
|
|
83
|
+
| Enum | Value | Description |
|
|
84
|
+
|------|-------|-------------|
|
|
85
|
+
| `MARKET` | `enum.auto()` | Market order |
|
|
86
|
+
| `LIMIT` | `enum.auto()` | Limit order |
|
|
87
|
+
| `STOP` | `enum.auto()` | Stop order |
|
|
88
|
+
| `STOP_LIMIT` | `enum.auto()` | Stop-limit order |
|
|
89
|
+
"""
|
|
90
|
+
|
|
91
|
+
MARKET = enum.auto()
|
|
92
|
+
LIMIT = enum.auto()
|
|
93
|
+
STOP = enum.auto()
|
|
94
|
+
STOP_LIMIT = enum.auto()
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
class OrderLifecycleState(enum.Enum):
|
|
98
|
+
"""
|
|
99
|
+
Enum for order lifecycle states.
|
|
100
|
+
|
|
101
|
+
**Attributes:**
|
|
102
|
+
|
|
103
|
+
| Enum | Value | Description |
|
|
104
|
+
|------|-------|-------------|
|
|
105
|
+
| `PENDING` | `enum.auto()` | Order has been submitted, but not yet acknowledged by
|
|
106
|
+
the broker |
|
|
107
|
+
| `OPEN` | `enum.auto()` | Order has been acknowledged by the broker, but not yet
|
|
108
|
+
filled or cancelled |
|
|
109
|
+
| `FILLED` | `enum.auto()` | Order has been filled |
|
|
110
|
+
| `CANCELLED` | `enum.auto()` | Order has been cancelled |
|
|
111
|
+
"""
|
|
112
|
+
|
|
113
|
+
PENDING = enum.auto()
|
|
114
|
+
OPEN = enum.auto()
|
|
115
|
+
PARTIALLY_FILLED = enum.auto()
|
|
116
|
+
FILLED = enum.auto()
|
|
117
|
+
CANCELLED = enum.auto()
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
class OrderRejectionReason(enum.Enum):
|
|
121
|
+
"""
|
|
122
|
+
Enum for order rejection reasons.
|
|
123
|
+
|
|
124
|
+
**Attributes:**
|
|
125
|
+
|
|
126
|
+
| Enum | Value | Description |
|
|
127
|
+
|------|-------|-------------|
|
|
128
|
+
| `UNKNOWN` | `enum.auto()` | Unknown reason |
|
|
129
|
+
| `NEGATIVE_QUANTITY` | `enum.auto()` | Negative quantity |
|
|
130
|
+
"""
|
|
131
|
+
|
|
132
|
+
UNKNOWN = enum.auto()
|
|
133
|
+
NEGATIVE_QUANTITY = enum.auto()
|
|
File without changes
|
|
File without changes
|