Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
.PHONY: install lint typecheck test ci test-notebooks execute-notebooks

install:
poetry install

lint:
poetry run ruff check src tests
poetry run ruff format --check src tests

typecheck:
poetry run mypy src

test:
poetry run pytest --cov=src/nexa_backtest --cov-report=term-missing

ci: lint typecheck test

test-notebooks:
poetry run jupyter nbconvert --to notebook --execute notebooks/*.ipynb --output-dir /tmp/

execute-notebooks:
poetry run jupyter nbconvert --to notebook --execute --inplace notebooks/*.ipynb
804 changes: 804 additions & 0 deletions poetry.lock

Large diffs are not rendered by default.

61 changes: 61 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
[tool.poetry]
name = "nexa-backtest"
version = "0.1.0"
description = "Backtesting framework for European power markets"
authors = ["Phase Nexa <dev@phasenexa.com>"]
license = "MIT"
readme = "README.md"
packages = [{ include = "nexa_backtest", from = "src" }]
repository = "https://github.com/phasenexa/nexa-backtest"

[tool.poetry.dependencies]
python = "^3.11"
pydantic = ">=2.0"
pyarrow = ">=14.0"
numpy = ">=1.26"

[tool.poetry.extras]
pandas = ["pandas"]
plot = ["matplotlib"]
ml = ["onnxruntime", "scikit-learn"]

[tool.poetry.group.dev.dependencies]
pytest = ">=7.4"
pytest-cov = ">=4.1"
mypy = ">=1.8"
ruff = ">=0.3"

[tool.ruff]
target-version = "py311"
line-length = 100
src = ["src"]

[tool.ruff.lint]
select = ["E", "F", "W", "I", "UP", "ANN", "B", "C4", "SIM", "RUF"]
ignore = ["ANN401"]

[tool.ruff.lint.per-file-ignores]
"tests/**" = ["ANN"]

[tool.mypy]
python_version = "3.11"
strict = true
files = ["src"]

[tool.pytest.ini_options]
testpaths = ["tests"]
addopts = "--tb=short"

[tool.coverage.run]
source = ["src/nexa_backtest"]

[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"if TYPE_CHECKING:",
"\\.\\.\\.",
]

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
56 changes: 56 additions & 0 deletions src/nexa_backtest/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
"""nexa-backtest: Backtesting framework for European power markets.

Key public exports for Task 01. Additional exports will be added as
subsequent tasks are implemented.
"""

from nexa_backtest._version import __version__
from nexa_backtest.context import SignalValue, TradingContext
from nexa_backtest.exceptions import (
AlgoError,
DataError,
ExchangeError,
MatchingError,
NexaBacktestError,
SignalError,
UnsupportedFeatureError,
ValidationError,
)
from nexa_backtest.types import (
MTU,
AuctionInfo,
CancelResult,
Fill,
Order,
OrderBook,
OrderResult,
OrderStatus,
Position,
PriceLevel,
Side,
)

__all__ = [
"MTU",
"AlgoError",
"AuctionInfo",
"CancelResult",
"DataError",
"ExchangeError",
"Fill",
"MatchingError",
"NexaBacktestError",
"Order",
"OrderBook",
"OrderResult",
"OrderStatus",
"Position",
"PriceLevel",
"Side",
"SignalError",
"SignalValue",
"TradingContext",
"UnsupportedFeatureError",
"ValidationError",
"__version__",
]
1 change: 1 addition & 0 deletions src/nexa_backtest/_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "0.1.0"
Loading
Loading