Skip to content

Commit cd8da33

Browse files
committed
Fix env typos, expose strategies, and extend metrics tests
1 parent 0e7afa0 commit cd8da33

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

.env.example

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Example environment file for pwb-alphaevolve
22
# Copy to `.env` and edit as needed. Values left blank will fall back to
3-
# defaults specified in `alpha_trader/config.py`.
3+
# defaults specified in `alphaevolve/config.py`.
44

55
# ---------------------------------------------------------------------------
66
# OpenAI configuration
@@ -9,7 +9,7 @@
99
# Your OpenAI API key (required for live evolution)
1010
OPENAI_API_KEY=
1111

12-
# Chat model name (default "o3")
12+
# Chat model name (default "o3-mini")
1313
OPENAI_MODEL=o3-mini
1414

1515
# Maximum tokens for each response (default 4096)
@@ -19,7 +19,7 @@ MAX_COMPLETION_TOKENS=4096
1919
# Data & storage
2020
# ---------------------------------------------------------------------------
2121

22-
# Path to the SQLite database (default \~/.alpha\_trader/programs.db)
22+
# Path to the SQLite database (default \~/.alphaevolve/programs.db)
2323

2424
SQLITE_DB="~/.alphaevolve/programs.db"
2525

alphaevolve/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""PWB AlphaEvolve package - discover & evolve trading strategies."""
22

33
from .engine import AlphaEvolve, Strategy
4+
from . import strategies
45

56
__all__ = [
67
"AlphaEvolve",

tests/test_metrics.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import pytest
44

55
np = pytest.importorskip("numpy")
6+
pd = pytest.importorskip("pandas")
67

78
spec = importlib.util.spec_from_file_location(
89
"metrics", "alphaevolve/evaluator/metrics.py"
@@ -13,3 +14,15 @@
1314

1415
def test_sharpe_short_series_returns_zero():
1516
assert metrics.sharpe(np.array([0.01])) == 0.0
17+
18+
19+
def test_max_drawdown():
20+
curve = np.array([100, 120, 80, 130], dtype=float)
21+
series = pd.Series(curve)
22+
assert metrics.max_drawdown(series) == pytest.approx(-1 / 3)
23+
24+
25+
def test_cagr_simple_case():
26+
curve = pd.Series([1.0, 2.0])
27+
result = metrics.cagr(curve, periods_per_year=1)
28+
assert result == pytest.approx(np.sqrt(2) - 1)

0 commit comments

Comments
 (0)