aptrade 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.
- aptrade-0.1.0/PKG-INFO +133 -0
- aptrade-0.1.0/aptrade/__init__.py +0 -0
- aptrade-0.1.0/aptrade/cli.py +64 -0
- aptrade-0.1.0/aptrade/version.py +24 -0
- aptrade-0.1.0/docs/README.md +86 -0
- aptrade-0.1.0/pyproject.toml +77 -0
aptrade-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: aptrade
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Add your description here
|
|
5
|
+
Requires-Dist: alembic>=1.17.2
|
|
6
|
+
Requires-Dist: backtesting>=0.6.5
|
|
7
|
+
Requires-Dist: beautifulsoup4>=4.14.2
|
|
8
|
+
Requires-Dist: bn-lightweight-charts>=1.1.0
|
|
9
|
+
Requires-Dist: boto3>=1.40.3
|
|
10
|
+
Requires-Dist: celery>=5.5.3
|
|
11
|
+
Requires-Dist: click>=8.2.1
|
|
12
|
+
Requires-Dist: emails>=0.6
|
|
13
|
+
Requires-Dist: fastapi-crons>=2.0.1
|
|
14
|
+
Requires-Dist: fastapi[standard]
|
|
15
|
+
Requires-Dist: ib-async>=2.1.0
|
|
16
|
+
Requires-Dist: ipykernel>=6.30.1
|
|
17
|
+
Requires-Dist: jwt>=1.4.0
|
|
18
|
+
Requires-Dist: massive>=2.0.1
|
|
19
|
+
Requires-Dist: matplotlib>=3.10.5
|
|
20
|
+
Requires-Dist: mkdocs>=1.6.1
|
|
21
|
+
Requires-Dist: mkdocs-material>=9.6.17
|
|
22
|
+
Requires-Dist: mkdocstrings-python>=1.17.0
|
|
23
|
+
Requires-Dist: mypy>=1.18.2
|
|
24
|
+
Requires-Dist: pandas-market-calendars>=5.2.3
|
|
25
|
+
Requires-Dist: passlib>=1.7.4
|
|
26
|
+
Requires-Dist: plotly>=6.5.1
|
|
27
|
+
Requires-Dist: polygon>=1.2.6
|
|
28
|
+
Requires-Dist: polygon-api-client>=1.15.3
|
|
29
|
+
Requires-Dist: pre-commit>=4.3.0
|
|
30
|
+
Requires-Dist: psycopg>=3.2.12
|
|
31
|
+
Requires-Dist: psycopg2-binary>=2.9.10
|
|
32
|
+
Requires-Dist: pyarrow>=22.0.0
|
|
33
|
+
Requires-Dist: pydantic-settings>=2.12.0
|
|
34
|
+
Requires-Dist: pyjwt>=2.8.0,<3.0.0
|
|
35
|
+
Requires-Dist: pytest>=8.4.1
|
|
36
|
+
Requires-Dist: pytest-cov>=6.2.1
|
|
37
|
+
Requires-Dist: python-dotenv>=1.1.1
|
|
38
|
+
Requires-Dist: python-telegram-bot>=22.5
|
|
39
|
+
Requires-Dist: redis>=6.4.0
|
|
40
|
+
Requires-Dist: sqlmodel>=0.0.24
|
|
41
|
+
Requires-Dist: statsmodels>=0.14.6
|
|
42
|
+
Requires-Dist: tenacity>=9.1.2
|
|
43
|
+
Requires-Dist: tqdm>=4.67.1
|
|
44
|
+
Requires-Dist: uvicorn>=0.35.0
|
|
45
|
+
Requires-Python: >=3.12
|
|
46
|
+
Description-Content-Type: text/markdown
|
|
47
|
+
|
|
48
|
+
# aptrade
|
|
49
|
+
|
|
50
|
+
[](https://img.shields.io/github/v/release/vcaldas/aptrade)
|
|
51
|
+
[](https://github.com/vcaldas/aptrade/actions/workflows/main.yml?query=branch%3Amain)
|
|
52
|
+
[](https://codecov.io/gh/vcaldas/aptrade)
|
|
53
|
+
[](https://img.shields.io/github/commit-activity/m/vcaldas/aptrade)
|
|
54
|
+
[](https://img.shields.io/github/license/vcaldas/aptrade)
|
|
55
|
+
|
|
56
|
+
This is a template repository for Python projects that use uv for their dependency management.
|
|
57
|
+
|
|
58
|
+
- **Github repository**: <https://github.com/vcaldas/aptrade/>
|
|
59
|
+
- **Documentation** <https://vcaldas.github.io/aptrade/>
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
## Organization
|
|
63
|
+
This project is organized in a monorepo structure, with the following folders:
|
|
64
|
+
- `src/aptrade`: The main package of the project. This can be imported by other python projects
|
|
65
|
+
- `tests`: The tests for the main package.
|
|
66
|
+
- `docs`: The documentation for the project.
|
|
67
|
+
- `frontend`: The UI for the project. This is a React app that can be run with `npm start` and built with `npm run build`.
|
|
68
|
+
- `app`: The app for the project. This is a Flask app that provides the API routes and other backend functionalities.
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
## Getting started with the project
|
|
72
|
+
|
|
73
|
+
### 1. Create a New Repository
|
|
74
|
+
|
|
75
|
+
First, create a repository on GitHub with the same name as this project, and then run the following commands:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
git init -b main
|
|
79
|
+
git add .
|
|
80
|
+
git commit -m "init commit"
|
|
81
|
+
git remote add origin git@github.com:vcaldas/aptrade.git
|
|
82
|
+
git push -u origin main
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### 2. Set Up Your Development Environment
|
|
86
|
+
|
|
87
|
+
Then, install the environment and the pre-commit hooks with
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
make install
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
This will also generate your `uv.lock` file
|
|
94
|
+
|
|
95
|
+
### 3. Run the pre-commit hooks
|
|
96
|
+
|
|
97
|
+
Initially, the CI/CD pipeline might be failing due to formatting issues. To resolve those run:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
uv run pre-commit run -a
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### 4. Commit the changes
|
|
104
|
+
|
|
105
|
+
Lastly, commit the changes made by the two steps above to your repository.
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
git add .
|
|
109
|
+
git commit -m 'Fix formatting issues'
|
|
110
|
+
git push origin main
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
You are now ready to start development on your project!
|
|
114
|
+
The CI/CD pipeline will be triggered when you open a pull request, merge to main, or when you create a new release.
|
|
115
|
+
|
|
116
|
+
To finalize the set-up for publishing to PyPI, see [here](https://fpgmaas.github.io/cookiecutter-uv/features/publishing/#set-up-for-pypi).
|
|
117
|
+
For activating the automatic documentation with MkDocs, see [here](https://fpgmaas.github.io/cookiecutter-uv/features/mkdocs/#enabling-the-documentation-on-github).
|
|
118
|
+
To enable the code coverage reports, see [here](https://fpgmaas.github.io/cookiecutter-uv/features/codecov/).
|
|
119
|
+
|
|
120
|
+
## Releasing a new version
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
## Inspiration and Why this project exists
|
|
125
|
+
|
|
126
|
+
This project is my attempt to combine my interests in algorithmic trading, data science, and software engineering. It is inspired by the need for a robust framework to backtest trading strategies using Python, while also providing a user-friendly interface for analysis and visualization.
|
|
127
|
+
|
|
128
|
+
This will be heavily inspired by the following projects:
|
|
129
|
+
Backtrader: <https://www.backtrader.com/>
|
|
130
|
+
Backtesting.py: <https://kernc.github.io/backtesting.py/>
|
|
131
|
+
pysystemtrade: <https://github.com/robcarver17/pysystemtrade>
|
|
132
|
+
|
|
133
|
+
For the real deal, please use the above projects, as they are more mature and have a larger community. This project is more of a learning experience for me, and I hope it can be useful for others as well.
|
|
File without changes
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import datetime as dt
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
from typing import Any, Dict
|
|
4
|
+
|
|
5
|
+
import typer
|
|
6
|
+
import uvicorn
|
|
7
|
+
|
|
8
|
+
from aptrade.version import VERSION as APP_VERSION
|
|
9
|
+
|
|
10
|
+
APP_AUTHOR = "Victor Caldas"
|
|
11
|
+
APP_COPYRIGHT = "2025-2026"
|
|
12
|
+
|
|
13
|
+
CLI_HELP_TEXT = (
|
|
14
|
+
"APTrade Command Line Interface\n\n"
|
|
15
|
+
f"Author: {APP_AUTHOR}\n"
|
|
16
|
+
f"Years: {APP_COPYRIGHT}\n"
|
|
17
|
+
f"Version: {APP_VERSION}"
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
cli = typer.Typer(help=CLI_HELP_TEXT, no_args_is_help=True)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
@cli.callback(invoke_without_command=True)
|
|
24
|
+
def main(
|
|
25
|
+
ctx: typer.Context,
|
|
26
|
+
version: bool = typer.Option(False, "--version", "-v", help="Show version and exit"),
|
|
27
|
+
):
|
|
28
|
+
"""APTrade CLI entrypoint. Use `--version` to print version and exit."""
|
|
29
|
+
if version:
|
|
30
|
+
print(APP_VERSION)
|
|
31
|
+
raise typer.Exit()
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
@cli.command()
|
|
35
|
+
def server(
|
|
36
|
+
dev: bool = typer.Option(
|
|
37
|
+
False, "--dev", "-d", help="Run server in development mode (with reload)"
|
|
38
|
+
),
|
|
39
|
+
host: str = typer.Option("0.0.0.0", "--host", "-h"),
|
|
40
|
+
port: int = typer.Option(8000, "--port", "-p"),
|
|
41
|
+
):
|
|
42
|
+
"""Start the APTrade Server."""
|
|
43
|
+
print("Starting APTrade Server...")
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
@cli.command()
|
|
47
|
+
def scanner():
|
|
48
|
+
"""Start the APTrade Scanner Service."""
|
|
49
|
+
print("Starting APTrade Scanner Service...")
|
|
50
|
+
|
|
51
|
+
@cli.command()
|
|
52
|
+
def backtest(
|
|
53
|
+
debug: bool = typer.Option(
|
|
54
|
+
False,
|
|
55
|
+
"--debug",
|
|
56
|
+
"-d",
|
|
57
|
+
help="Enable verbose output and keep running after individual ticker failures",
|
|
58
|
+
),
|
|
59
|
+
):
|
|
60
|
+
"""Run backtests described in the given YAML configuration."""
|
|
61
|
+
print("Running backtests...")
|
|
62
|
+
|
|
63
|
+
if __name__ == "__main__":
|
|
64
|
+
cli()
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# -*- coding: utf-8; py-indent-offset:4 -*-
|
|
3
|
+
###############################################################################
|
|
4
|
+
#
|
|
5
|
+
# Copyright (C) 2025-2026 Victor Caldas
|
|
6
|
+
#
|
|
7
|
+
# This program is free software: you can redistribute it and/or modify
|
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
# (at your option) any later version.
|
|
11
|
+
#
|
|
12
|
+
# This program is distributed in the hope that it will be useful,
|
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
# GNU General Public License for more details.
|
|
16
|
+
#
|
|
17
|
+
# You should have received a copy of the GNU General Public License
|
|
18
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
19
|
+
#
|
|
20
|
+
###############################################################################
|
|
21
|
+
|
|
22
|
+
__version__ = "0.1.0"
|
|
23
|
+
|
|
24
|
+
VERSION = __version__
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# aptrade
|
|
2
|
+
|
|
3
|
+
[](https://img.shields.io/github/v/release/vcaldas/aptrade)
|
|
4
|
+
[](https://github.com/vcaldas/aptrade/actions/workflows/main.yml?query=branch%3Amain)
|
|
5
|
+
[](https://codecov.io/gh/vcaldas/aptrade)
|
|
6
|
+
[](https://img.shields.io/github/commit-activity/m/vcaldas/aptrade)
|
|
7
|
+
[](https://img.shields.io/github/license/vcaldas/aptrade)
|
|
8
|
+
|
|
9
|
+
This is a template repository for Python projects that use uv for their dependency management.
|
|
10
|
+
|
|
11
|
+
- **Github repository**: <https://github.com/vcaldas/aptrade/>
|
|
12
|
+
- **Documentation** <https://vcaldas.github.io/aptrade/>
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## Organization
|
|
16
|
+
This project is organized in a monorepo structure, with the following folders:
|
|
17
|
+
- `src/aptrade`: The main package of the project. This can be imported by other python projects
|
|
18
|
+
- `tests`: The tests for the main package.
|
|
19
|
+
- `docs`: The documentation for the project.
|
|
20
|
+
- `frontend`: The UI for the project. This is a React app that can be run with `npm start` and built with `npm run build`.
|
|
21
|
+
- `app`: The app for the project. This is a Flask app that provides the API routes and other backend functionalities.
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
## Getting started with the project
|
|
25
|
+
|
|
26
|
+
### 1. Create a New Repository
|
|
27
|
+
|
|
28
|
+
First, create a repository on GitHub with the same name as this project, and then run the following commands:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
git init -b main
|
|
32
|
+
git add .
|
|
33
|
+
git commit -m "init commit"
|
|
34
|
+
git remote add origin git@github.com:vcaldas/aptrade.git
|
|
35
|
+
git push -u origin main
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### 2. Set Up Your Development Environment
|
|
39
|
+
|
|
40
|
+
Then, install the environment and the pre-commit hooks with
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
make install
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
This will also generate your `uv.lock` file
|
|
47
|
+
|
|
48
|
+
### 3. Run the pre-commit hooks
|
|
49
|
+
|
|
50
|
+
Initially, the CI/CD pipeline might be failing due to formatting issues. To resolve those run:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
uv run pre-commit run -a
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### 4. Commit the changes
|
|
57
|
+
|
|
58
|
+
Lastly, commit the changes made by the two steps above to your repository.
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
git add .
|
|
62
|
+
git commit -m 'Fix formatting issues'
|
|
63
|
+
git push origin main
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
You are now ready to start development on your project!
|
|
67
|
+
The CI/CD pipeline will be triggered when you open a pull request, merge to main, or when you create a new release.
|
|
68
|
+
|
|
69
|
+
To finalize the set-up for publishing to PyPI, see [here](https://fpgmaas.github.io/cookiecutter-uv/features/publishing/#set-up-for-pypi).
|
|
70
|
+
For activating the automatic documentation with MkDocs, see [here](https://fpgmaas.github.io/cookiecutter-uv/features/mkdocs/#enabling-the-documentation-on-github).
|
|
71
|
+
To enable the code coverage reports, see [here](https://fpgmaas.github.io/cookiecutter-uv/features/codecov/).
|
|
72
|
+
|
|
73
|
+
## Releasing a new version
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
## Inspiration and Why this project exists
|
|
78
|
+
|
|
79
|
+
This project is my attempt to combine my interests in algorithmic trading, data science, and software engineering. It is inspired by the need for a robust framework to backtest trading strategies using Python, while also providing a user-friendly interface for analysis and visualization.
|
|
80
|
+
|
|
81
|
+
This will be heavily inspired by the following projects:
|
|
82
|
+
Backtrader: <https://www.backtrader.com/>
|
|
83
|
+
Backtesting.py: <https://kernc.github.io/backtesting.py/>
|
|
84
|
+
pysystemtrade: <https://github.com/robcarver17/pysystemtrade>
|
|
85
|
+
|
|
86
|
+
For the real deal, please use the above projects, as they are more mature and have a larger community. This project is more of a learning experience for me, and I hope it can be useful for others as well.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "aptrade"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Add your description here"
|
|
5
|
+
readme = "docs/README.md"
|
|
6
|
+
requires-python = ">=3.12"
|
|
7
|
+
dependencies = [
|
|
8
|
+
"alembic>=1.17.2",
|
|
9
|
+
"backtesting>=0.6.5",
|
|
10
|
+
"beautifulsoup4>=4.14.2",
|
|
11
|
+
"bn-lightweight-charts>=1.1.0",
|
|
12
|
+
"boto3>=1.40.3",
|
|
13
|
+
"celery>=5.5.3",
|
|
14
|
+
"click>=8.2.1",
|
|
15
|
+
"emails>=0.6",
|
|
16
|
+
"fastapi-crons>=2.0.1",
|
|
17
|
+
"fastapi[standard]",
|
|
18
|
+
"ib-async>=2.1.0",
|
|
19
|
+
"ipykernel>=6.30.1",
|
|
20
|
+
"jwt>=1.4.0",
|
|
21
|
+
"massive>=2.0.1",
|
|
22
|
+
"matplotlib>=3.10.5",
|
|
23
|
+
"mkdocs>=1.6.1",
|
|
24
|
+
"mkdocs-material>=9.6.17",
|
|
25
|
+
"mkdocstrings-python>=1.17.0",
|
|
26
|
+
"mypy>=1.18.2",
|
|
27
|
+
"pandas-market-calendars>=5.2.3",
|
|
28
|
+
"passlib>=1.7.4",
|
|
29
|
+
"plotly>=6.5.1",
|
|
30
|
+
"polygon>=1.2.6",
|
|
31
|
+
"polygon-api-client>=1.15.3",
|
|
32
|
+
"pre-commit>=4.3.0",
|
|
33
|
+
"psycopg>=3.2.12",
|
|
34
|
+
"psycopg2-binary>=2.9.10",
|
|
35
|
+
"pyarrow>=22.0.0",
|
|
36
|
+
"pydantic-settings>=2.12.0",
|
|
37
|
+
"pyjwt>=2.8.0,<3.0.0",
|
|
38
|
+
"pytest>=8.4.1",
|
|
39
|
+
"pytest-cov>=6.2.1",
|
|
40
|
+
"python-dotenv>=1.1.1",
|
|
41
|
+
"python-telegram-bot>=22.5",
|
|
42
|
+
"redis>=6.4.0",
|
|
43
|
+
"sqlmodel>=0.0.24",
|
|
44
|
+
"statsmodels>=0.14.6",
|
|
45
|
+
"tenacity>=9.1.2",
|
|
46
|
+
"tqdm>=4.67.1",
|
|
47
|
+
"uvicorn>=0.35.0",
|
|
48
|
+
]
|
|
49
|
+
|
|
50
|
+
[project.scripts]
|
|
51
|
+
aptrade = "aptrade:cli.cli"
|
|
52
|
+
|
|
53
|
+
[build-system]
|
|
54
|
+
requires = ["uv_build>=0.8.4,<0.9.0"]
|
|
55
|
+
build-backend = "uv_build"
|
|
56
|
+
|
|
57
|
+
[tool.uv.build-backend]
|
|
58
|
+
module-name = "aptrade"
|
|
59
|
+
module-root = ""
|
|
60
|
+
|
|
61
|
+
[tool.uv.workspace]
|
|
62
|
+
members = ["documentation"]
|
|
63
|
+
|
|
64
|
+
[tool.pytest.ini_options]
|
|
65
|
+
addopts = "-ra"
|
|
66
|
+
testpaths = ["tests"]
|
|
67
|
+
python_files = "test_*.py"
|
|
68
|
+
python_classes = "Test*"
|
|
69
|
+
python_functions = "test_*"
|
|
70
|
+
|
|
71
|
+
[tool.commitizen]
|
|
72
|
+
name = "cz_conventional_commits"
|
|
73
|
+
tag_format = "$version"
|
|
74
|
+
version_scheme = "pep440"
|
|
75
|
+
version_provider = "uv"
|
|
76
|
+
update_changelog_on_bump = true
|
|
77
|
+
major_version_zero = true
|