raptorbt 0.1.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.
Files changed (55) hide show
  1. raptorbt-0.1.0/.github/workflows/ci.yml +47 -0
  2. raptorbt-0.1.0/.github/workflows/release.yml +132 -0
  3. raptorbt-0.1.0/.gitignore +24 -0
  4. raptorbt-0.1.0/Cargo.lock +828 -0
  5. raptorbt-0.1.0/Cargo.toml +33 -0
  6. raptorbt-0.1.0/LICENSE +21 -0
  7. raptorbt-0.1.0/PKG-INFO +824 -0
  8. raptorbt-0.1.0/README.md +794 -0
  9. raptorbt-0.1.0/benches/backtest_benchmark.rs +123 -0
  10. raptorbt-0.1.0/pyproject.toml +50 -0
  11. raptorbt-0.1.0/python/raptorbt/__init__.py +68 -0
  12. raptorbt-0.1.0/rustfmt.toml +6 -0
  13. raptorbt-0.1.0/src/core/error.rs +80 -0
  14. raptorbt-0.1.0/src/core/mod.rs +9 -0
  15. raptorbt-0.1.0/src/core/timeseries.rs +301 -0
  16. raptorbt-0.1.0/src/core/types.rs +462 -0
  17. raptorbt-0.1.0/src/execution/fees.rs +157 -0
  18. raptorbt-0.1.0/src/execution/fill.rs +361 -0
  19. raptorbt-0.1.0/src/execution/mod.rs +9 -0
  20. raptorbt-0.1.0/src/execution/slippage.rs +204 -0
  21. raptorbt-0.1.0/src/indicators/mod.rs +16 -0
  22. raptorbt-0.1.0/src/indicators/momentum.rs +301 -0
  23. raptorbt-0.1.0/src/indicators/strength.rs +257 -0
  24. raptorbt-0.1.0/src/indicators/trend.rs +280 -0
  25. raptorbt-0.1.0/src/indicators/volatility.rs +238 -0
  26. raptorbt-0.1.0/src/indicators/volume.rs +332 -0
  27. raptorbt-0.1.0/src/lib.rs +58 -0
  28. raptorbt-0.1.0/src/metrics/drawdown.rs +344 -0
  29. raptorbt-0.1.0/src/metrics/mod.rs +9 -0
  30. raptorbt-0.1.0/src/metrics/streaming.rs +400 -0
  31. raptorbt-0.1.0/src/metrics/trade_stats.rs +350 -0
  32. raptorbt-0.1.0/src/portfolio/allocation.rs +340 -0
  33. raptorbt-0.1.0/src/portfolio/engine.rs +804 -0
  34. raptorbt-0.1.0/src/portfolio/mod.rs +9 -0
  35. raptorbt-0.1.0/src/portfolio/position.rs +347 -0
  36. raptorbt-0.1.0/src/python/bindings.rs +974 -0
  37. raptorbt-0.1.0/src/python/mod.rs +4 -0
  38. raptorbt-0.1.0/src/python/numpy_bridge.rs +34 -0
  39. raptorbt-0.1.0/src/signals/expression.rs +456 -0
  40. raptorbt-0.1.0/src/signals/mod.rs +10 -0
  41. raptorbt-0.1.0/src/signals/processor.rs +429 -0
  42. raptorbt-0.1.0/src/signals/synchronizer.rs +385 -0
  43. raptorbt-0.1.0/src/stops/atr.rs +237 -0
  44. raptorbt-0.1.0/src/stops/fixed.rs +168 -0
  45. raptorbt-0.1.0/src/stops/mod.rs +38 -0
  46. raptorbt-0.1.0/src/stops/trailing.rs +395 -0
  47. raptorbt-0.1.0/src/strategies/basket.rs +450 -0
  48. raptorbt-0.1.0/src/strategies/mod.rs +13 -0
  49. raptorbt-0.1.0/src/strategies/multi.rs +378 -0
  50. raptorbt-0.1.0/src/strategies/options.rs +430 -0
  51. raptorbt-0.1.0/src/strategies/pairs.rs +453 -0
  52. raptorbt-0.1.0/src/strategies/single.rs +200 -0
  53. raptorbt-0.1.0/tests/test_indicators.rs +230 -0
  54. raptorbt-0.1.0/tests/test_portfolio.rs +309 -0
  55. raptorbt-0.1.0/uv.lock +8 -0
@@ -0,0 +1,47 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ env:
10
+ CARGO_TERM_COLOR: always
11
+
12
+ jobs:
13
+ lint:
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+
18
+ - name: Set up Rust
19
+ uses: dtolnay/rust-toolchain@stable
20
+ with:
21
+ components: clippy, rustfmt
22
+
23
+ - name: Check Rust formatting
24
+ run: cargo fmt --check
25
+
26
+ - name: Run Rust clippy
27
+ run: cargo clippy --all-features
28
+
29
+ build:
30
+ runs-on: ubuntu-latest
31
+ steps:
32
+ - uses: actions/checkout@v4
33
+
34
+ - name: Set up Python
35
+ uses: actions/setup-python@v5
36
+ with:
37
+ python-version: '3.11'
38
+
39
+ - name: Build wheel
40
+ uses: PyO3/maturin-action@v1
41
+ with:
42
+ args: --release --out dist
43
+
44
+ - name: Install and test import
45
+ run: |
46
+ pip install dist/*.whl
47
+ python -c "import raptorbt; print(raptorbt.__version__)"
@@ -0,0 +1,132 @@
1
+ name: Release
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+ workflow_dispatch:
7
+ inputs:
8
+ publish:
9
+ description: 'Publish to PyPI'
10
+ required: true
11
+ type: boolean
12
+ default: false
13
+
14
+ permissions:
15
+ contents: read
16
+
17
+ jobs:
18
+ # Build wheels for Linux
19
+ linux:
20
+ runs-on: ubuntu-latest
21
+ strategy:
22
+ matrix:
23
+ target: [x86_64, aarch64]
24
+ steps:
25
+ - uses: actions/checkout@v4
26
+
27
+ - name: Build wheels
28
+ uses: PyO3/maturin-action@v1
29
+ with:
30
+ target: ${{ matrix.target }}
31
+ args: --release --out dist -i python3.10 -i python3.11 -i python3.12
32
+ manylinux: auto
33
+
34
+ - name: Upload wheels
35
+ uses: actions/upload-artifact@v4
36
+ with:
37
+ name: wheels-linux-${{ matrix.target }}
38
+ path: dist
39
+
40
+ # Build wheels for macOS
41
+ macos:
42
+ runs-on: macos-latest
43
+ strategy:
44
+ matrix:
45
+ target: [x86_64, aarch64]
46
+ steps:
47
+ - uses: actions/checkout@v4
48
+
49
+ - name: Set up Python
50
+ uses: actions/setup-python@v5
51
+ with:
52
+ python-version: '3.12'
53
+
54
+ - name: Build wheels
55
+ uses: PyO3/maturin-action@v1
56
+ with:
57
+ target: ${{ matrix.target }}-apple-darwin
58
+ args: --release --out dist
59
+
60
+ - name: Upload wheels
61
+ uses: actions/upload-artifact@v4
62
+ with:
63
+ name: wheels-macos-${{ matrix.target }}
64
+ path: dist
65
+
66
+ # Build wheels for Windows
67
+ windows:
68
+ runs-on: windows-latest
69
+ strategy:
70
+ matrix:
71
+ target: [x64]
72
+ steps:
73
+ - uses: actions/checkout@v4
74
+
75
+ - name: Set up Python
76
+ uses: actions/setup-python@v5
77
+ with:
78
+ python-version: '3.12'
79
+
80
+ - name: Build wheels
81
+ uses: PyO3/maturin-action@v1
82
+ with:
83
+ args: --release --out dist
84
+
85
+ - name: Upload wheels
86
+ uses: actions/upload-artifact@v4
87
+ with:
88
+ name: wheels-windows-${{ matrix.target }}
89
+ path: dist
90
+
91
+ # Build source distribution
92
+ sdist:
93
+ runs-on: ubuntu-latest
94
+ steps:
95
+ - uses: actions/checkout@v4
96
+
97
+ - name: Build sdist
98
+ uses: PyO3/maturin-action@v1
99
+ with:
100
+ command: sdist
101
+ args: --out dist
102
+
103
+ - name: Upload sdist
104
+ uses: actions/upload-artifact@v4
105
+ with:
106
+ name: wheels-sdist
107
+ path: dist
108
+
109
+ # Publish to PyPI
110
+ publish:
111
+ name: Publish to PyPI
112
+ runs-on: ubuntu-latest
113
+ needs: [linux, macos, windows, sdist]
114
+ if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && inputs.publish)
115
+ environment:
116
+ name: pypi
117
+ url: https://pypi.org/p/raptorbt
118
+ permissions:
119
+ id-token: write # Required for trusted publishing
120
+ steps:
121
+ - name: Download all artifacts
122
+ uses: actions/download-artifact@v4
123
+ with:
124
+ pattern: wheels-*
125
+ path: dist
126
+ merge-multiple: true
127
+
128
+ - name: List dist contents
129
+ run: ls -la dist/
130
+
131
+ - name: Publish to PyPI
132
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,24 @@
1
+ # Generated by Cargo
2
+ # will have compiled files and executables
3
+ debug
4
+ target
5
+
6
+ # These are backup files generated by rustfmt
7
+ **/*.rs.bk
8
+
9
+ # MSVC Windows builds of rustc generate these, which store debugging information
10
+ *.pdb
11
+
12
+ # Generated by cargo mutants
13
+ # Contains mutation testing data
14
+ **/mutants.out*/
15
+
16
+ # RustRover
17
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
18
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
19
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
20
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
21
+ #.idea/
22
+
23
+ # Python
24
+ .venv