Coverage for src/cvx/simulator/__init__.py: 100%

8 statements  

« prev     ^ index     » next       coverage.py v7.16.1, created at 2026-09-19 02:49 +0000

1"""Public API of the cvxsimulator distribution, importable as `cvx.simulator`. 

2 

3The package exposes the three objects a backtest is built from: 

4 

5- `Builder` accumulates positions while iterating over a frame of prices; 

6- `Portfolio` holds the finished result and the analytics derived from it; 

7- `State` is the view of the book at a single point in time, handed to the 

8 caller on each step of the builder's loop. 

9 

10Alongside them sit the `interpolate` and `valid` price helpers from 

11`cvx.simulator.utils`. Submodules stay importable directly, so 

12`from cvx.simulator.builder import Builder` reaches the same class as 

13`from cvx.simulator import Builder`. 

14 

15`__version__` is resolved at import time from the installed distribution 

16metadata of `cvxsimulator`. 

17""" 

18 

19import importlib.metadata 

20 

21__version__ = importlib.metadata.version("cvxsimulator") 

22 

23# Explicit re-exports to satisfy linters (ruff F401) 

24from .builder import Builder as Builder 

25from .portfolio import Portfolio as Portfolio 

26from .state import State as State 

27from .utils import interpolate as interpolate 

28from .utils import valid as valid 

29 

30__all__ = [ 

31 "Builder", 

32 "Portfolio", 

33 "State", 

34 "__version__", 

35 "interpolate", 

36 "valid", 

37]