Skip to content

Commit 558147e

Browse files
committed
migrating to rust
1 parent ae046db commit 558147e

File tree

313 files changed

+3936
-222
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

313 files changed

+3936
-222
lines changed

.bumpversion.cfg

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[bumpversion]
2+
current_version = 0.1.0
3+
commit = True
4+
tag = False
5+
6+
[bumpversion:file:python/aat/aat/__init__.py]
7+
search = __version__ = "{current_version}"
8+
replace = __version__ = "{new_version}"
9+
10+
[bumpversion:file:python/aat/setup.py]
11+
search = version = "{current_version}"
12+
replace = version = "{new_version}"
13+
14+
# [bumpversion:file:js/package.json]
15+
# search = "version": "{current_version}"
16+
# replace = "version": "{new_version}"

.github/workflows/build.yml

Lines changed: 45 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ on:
44
push:
55
branches:
66
- main
7+
- jb/rust
8+
tags:
9+
- v*
10+
paths-ignore:
11+
- LICENSE
12+
- README.md
713
pull_request:
814

915
concurrency:
@@ -16,72 +22,70 @@ jobs:
1622

1723
strategy:
1824
matrix:
19-
os: [ubuntu-latest, macos-latest, windows-latest]
25+
# os: [ubuntu-latest, macos-latest, windows-latest]
26+
os: [ubuntu-latest]
2027
python-version: [3.9]
2128
node-version: [14.x]
2229
event-name: [push]
2330

2431
steps:
2532
- uses: actions/checkout@v3
2633

34+
- name: Set up Rust
35+
uses: actions-rs/toolchain@v1
36+
with:
37+
profile: minimal
38+
toolchain: nightly
39+
components: clippy
40+
override: true
41+
2742
- name: Set up Python ${{ matrix.python-version }}
2843
uses: actions/setup-python@v4
2944
with:
3045
python-version: ${{ matrix.python-version }}
46+
# cache: "pip"
47+
# cache-dependency-path: 'python/aat/pyproject.toml'
3148

32-
- name: Install system dependencies
33-
run: |
34-
sudo apt-get install libboost-dev
35-
wget https://github.com/pybind/pybind11/archive/v2.5.0.tar.gz && tar xfz v2.5.0.tar.gz && cd pybind11-2.5.0 && mkdir build && cd build && cmake .. -DPYBIND11_TEST=OFF && sudo make -j4 install
36-
if: ${{ matrix.os == 'ubuntu-latest' }}
37-
38-
- name: Install system dependencies
39-
run: |
40-
brew install boost cmake pybind11
41-
if: ${{ matrix.os == 'macos-latest' }}
49+
# - name: Use Node.js ${{ matrix.node-version }}
50+
# uses: actions/setup-node@v3
51+
# with:
52+
# node-version: ${{ matrix.node-version }}
53+
# cache: 'yarn'
54+
# cache-dependency-path: js/yarn.lock
4255

43-
- name: Install dependencies
44-
run: |
45-
python -m pip install -U cpplint numpy pip pyarrow pyEX setuptools tqdm twine wheel
46-
python -m pip install -e .[dev]
56+
# - name: Install yarn
57+
# run: npm install -g yarn
4758

48-
- name: Lint Python
49-
run: |
50-
make lintpy
59+
# - uses: actions-rs/cargo@v1
60+
# with:
61+
# command: check
5162

52-
- name: Lint C++
53-
run: |
54-
make lintcpp
55-
56-
- name: Type Annotate
63+
- name: Install dependencies
5764
run: |
58-
make annotate
65+
make develop
5966
60-
- name: Test
67+
- name: Build
6168
run: |
62-
make tests
63-
if: ${{ github.event_name == matrix.event-name || matrix.os == 'ubuntu-latest' }}
69+
make build
6470
65-
- name: Test C++
71+
- name: Lint
6672
run: |
67-
make testpycpp
68-
if: ${{ github.event_name == matrix.event-name || matrix.os == 'ubuntu-latest' }}
73+
make lint
6974
70-
- name: Live tests
75+
- name: Checks
7176
run: |
72-
make testruns
77+
make checks
7378
if: ${{ github.event_name == matrix.event-name || matrix.os == 'ubuntu-latest' }}
7479

75-
- name: Twine check
80+
- name: Test
7681
run: |
77-
make dist
82+
make tests-ci-gha
83+
if: ${{ matrix.os == 'ubuntu-latest' }}
7884

7985
- name: Upload test results
80-
uses: actions/upload-artifact@v3
86+
uses: EnricoMi/publish-unit-test-result-action@v1
8187
with:
82-
name: pytest-results-${{ matrix.os }}-${{ matrix.python-version }}
83-
path: python_junit.xml
84-
if: ${{ always() }}
85-
86-
- name: Upload coverage
87-
uses: codecov/codecov-action@v3
88+
check_name: Test Results
89+
github_token: ${{ secrets.GITHUB_TOKEN }}
90+
files: results.xml
91+
if: ${{ matrix.os == 'ubuntu-latest' }}

.gitignore

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,18 @@ pip-delete-this-directory.txt
3535
# Unit test / coverage reports
3636
htmlcov/
3737
.tox/
38+
coverage
3839
.coverage
3940
.coverage.*
4041
.cache
4142
nosetests.xml
4243
coverage.xml
4344
*,cover
4445
cover
46+
results.xml
47+
python_junit.xml
48+
.mypy_cache
49+
venv/
4550

4651
# Translations
4752
*.mo
@@ -52,47 +57,37 @@ cover
5257

5358
# Sphinx documentation
5459
docs/_build/
60+
docs/api
61+
docs/index.md
5562

5663
# PyBuilder
5764
target/
5865

5966
*_keys
6067
horizon
6168

69+
# Mac files
6270
*.DS_Store
71+
72+
# JS Files
6373
js/node_modules/
6474
js/build/
6575
aat/ui/assets/static/
66-
notes.txt
67-
ref
76+
node_modules
77+
78+
# Keys
6879
coinbase.sh
6980
coinbase_sandbox.sh
7081
keys
71-
old
7282

83+
# Notebooks
7384
.ipynb_checkpoints
74-
*.pkl
7585
notebooks/BTC_*
86+
87+
# IDE
7688
.idea
89+
.vscode
7790

91+
# Other
7892
custom_strategies
7993

80-
node_modules
81-
package-lock.json
82-
yarn.lock
83-
logo.ai
84-
logo.png
85-
coverage
86-
experiments
87-
aat_test
88-
docs/api
89-
docs/index.md
90-
tornado_sqlalchemy_login
91-
aat.db
92-
python_junit.xml
93-
.mypy_cache
94-
.vscode
95-
private_config
96-
_aat_BACKTEST*
97-
98-
venv/

Makefile

Lines changed: 8 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -1,108 +1,14 @@
1-
PYTHON=python
2-
CONFIG=./config/synthetic.cfg
3-
4-
5-
run: ## Clean and make target, run target
6-
$(PYTHON) -m aat --config $(CONFIG)
7-
8-
runcpp: build ## Clean and make target, run target
9-
AAT_USE_CPP=1 $(PYTHON) -m aat --config $(CONFIG)
10-
11-
rundebug: debug ## Clean and make debug target, run target
12-
$(PYTHON) -m aat --config $(CONFIG)
13-
14-
stratres: ## View strategy results offline
15-
$(PYTHON) -m aat.strategy.calculations
16-
17-
buildextf: ## build the package extensions
18-
$(PYTHON) setup.py build_ext -j8 --inplace -f
19-
20-
buildext: ## build the package extensions
21-
$(PYTHON) setup.py build_ext -j8 --inplace
22-
23-
build: buildext ## build the package
24-
$(PYTHON) setup.py build
25-
26-
debug: ## build debug build of the package
27-
DEBUG=1 $(PYTHON) setup.py build
28-
29-
install: ## install the package
30-
$(PYTHON) -m pip install .
31-
32-
tests: build testpy ## Make unit tests
33-
34-
testpy: ## Make unit tests
35-
$(PYTHON) -m pytest -vvv ./aat/tests --cov=aat --junitxml=python_junit.xml --cov-report=xml --cov-branch
36-
37-
testpycpp: ## Make unit tests
38-
# AAT_USE_CPP=1 $(PYTHON) -m pytest -vvv ./aat/tests --cov=aat --junitxml=python_junit.xml --cov-report=xml --cov-branch --capture=no
39-
AAT_USE_CPP=1 $(PYTHON) -m pytest -vs ./aat/tests
40-
41-
testruns: testrunscsv testrunsiex ## Run a few examples as a live end-to-end test
42-
43-
testrunscsv:
44-
$(PYTHON) -m aat.strategy.sample.csv.readonly
45-
$(PYTHON) -m aat.strategy.sample.csv.readonly_periodic
46-
$(PYTHON) -m aat.strategy.sample.csv.received
47-
48-
testrunsiex:
49-
$(PYTHON) -m aat.strategy.sample.iex.readonly
50-
TESTING=1 $(PYTHON) -m aat.strategy.sample.iex.buy_and_hold
51-
TESTING=1 $(PYTHON) -m aat.strategy.sample.iex.momentum
52-
TESTING=1 $(PYTHON) -m aat.strategy.sample.iex.golden_death
53-
54-
lint: lintpy lintcpp ## run all linters
55-
56-
lintpy: ## run python linter
57-
$(PYTHON) -m flake8 aat setup.py
58-
59-
lintcpp: ## run cpp linter
60-
cpplint --linelength=120 --recursive aat/cpp/{src,include}
61-
62-
fix: fixpy fixcpp ## run all fixers
63-
64-
fixpy: ## run autopep8 fix
65-
$(PYTHON) -m black aat/ setup.py
66-
67-
fixcpp: ## run clang-format
68-
clang-format -i -style=file `find ./aat/cpp/{src,include} -name "*.*pp"`
69-
70-
annotate: ## MyPy type annotation check
71-
$(PYTHON) -m mypy aat
72-
73-
type_ignore: ## Count type ignores
74-
grep -rin "type: ignore" ./aat | wc -l
75-
76-
type_ignore_list: ## List all type ignores
77-
grep -rin "type: ignore" ./aat
78-
79-
docs: ## Build the sphinx docs
80-
make -C docs html
81-
open ./docs/_build/html/index.html
82-
83-
dist: ## create dists
84-
rm -rf dist build
85-
python setup.py sdist bdist_wheel
86-
python -m twine check dist/*
1+
.DEFAULT_GOAL := help
2+
.PHONY: develop build lint checks tests tests-ci-gha
873

88-
publish: dist ## dist to pypi and npm
89-
python -m twine upload dist/* --skip-existing
4+
develop: ## Setup project for development
905

91-
clean: ## clean the repository
92-
find . -name "__pycache__" | xargs rm -rf
93-
find . -name "*.pyc" | xargs rm -rf
94-
rm -rf .coverage coverage cover htmlcov logs build dist *.egg-info coverage.xml .mypy_cache
95-
find . -name "*.so" | xargs rm -rf
96-
make -C ./docs clean
97-
rm -rf _aat_BACKTEST_*
6+
build: ## Build the project
987

99-
# Thanks to Francoise at marmelab.com for this
100-
.DEFAULT_GOAL := help
101-
help:
102-
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
8+
lint: ## Run project linters
1039

104-
print-%:
105-
@echo '$*=$($*)'
10+
checks: ## Run any other checks
10611

107-
.PHONY: run buildext build install tests lint fix docs dist clean help fixcpp
12+
tests: ## Run the tests
10813

14+
tests-ci-gha:

0 commit comments

Comments
 (0)