-
Notifications
You must be signed in to change notification settings - Fork 29
executable file
·140 lines (121 loc) · 4.85 KB
/
Copy pathci.yml
File metadata and controls
executable file
·140 lines (121 loc) · 4.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: CI
on:
push:
branches: ["main"]
pull_request:
permissions:
contents: read
jobs:
quality:
runs-on: [self-hosted, stock-ci, gpu]
env:
MARKETSIM_ALLOW_MOCK_ANALYTICS: "1"
MARKETSIM_SKIP_REAL_IMPORT: "1"
ALP_PAPER: "1"
PYTHONUNBUFFERED: "1"
strategy:
fail-fast: false
matrix:
python-version: ["3.13"]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for smart test detection
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@v3
- name: Install dependencies
run: |
uv pip install --system --requirement requirements.txt
uv pip install --system ty ruff pyright
- name: Lint with Ruff
run: ruff check src
- name: Type check with ty
continue-on-error: true
run: ty check
- name: Type check with Pyright
continue-on-error: true
run: python -m pyright
- name: Run smart test suite (change-aware, fail-fast)
run: |
python scripts/smart_test_runner.py --verbose
- name: Run integration tests
run: |
python -m pytest tests/prod -m integration
- name: Run fast env benchmark
run: |
make fast-env-benchmark
- name: Report benchmark drift
run: |
. .venv/bin/activate && python analysis/fast_env_drift.py --csv results/bench_fast_vs_python.csv
- name: Fast PPO smoke run
run: |
. .venv/bin/activate && python training/run_fastppo.py \
--symbol AAPL \
--data-root trainingdata \
--context-len 32 \
--total-timesteps 512 \
--num-envs 1 \
--learning-rate 1e-4 \
--env-backend python \
--log-json results/fastppo_ci.json \
--plot \
--plot-path results \
--html-report \
--html-path results/fastppo_ci_report.html \
--sma-window 32 \
--ema-window 32 \
--device cpu
- name: Run simulator report
env:
MARKETSIM_ALLOW_MOCK_ANALYTICS: "1"
MARKETSIM_SKIP_REAL_IMPORT: "1"
MARKETSIM_FORCE_KRONOS: "1"
MARKETSIM_SYMBOL_SIDE_MAP: "NVDA:sell"
MARKETSIM_SYMBOL_KELLY_SCALE_MAP: "AAPL:0.2,MSFT:0.25,NVDA:0.01,AMZN:0.15,GOOG:0.2,XLK:0.15,SOXX:0.15"
MARKETSIM_SYMBOL_MAX_HOLD_SECONDS_MAP: "AAPL:10800,MSFT:10800,NVDA:7200,AMZN:10800,GOOG:10800,XLK:10800,SOXX:10800"
MARKETSIM_SYMBOL_MIN_COOLDOWN_MAP: "NVDA:360"
MARKETSIM_SYMBOL_FORCE_PROBE_MAP: "AAPL:true"
MARKETSIM_SYMBOL_MIN_MOVE_MAP: "AAPL:0.08,AMZN:0.06,GOOG:0.05,XLK:0.04,SOXX:0.04"
MARKETSIM_SYMBOL_MIN_STRATEGY_RETURN_MAP: "AAPL:-0.03,AMZN:-0.02,GOOG:0.02,XLK:0.015,SOXX:0.015"
MARKETSIM_TREND_SUMMARY_PATH: "marketsimulator/run_logs/trend_summary.json"
MARKETSIM_TREND_PNL_SUSPEND_MAP: "AAPL:-5000,GOOG:-100,XLK:-200,AMZN:-400,SOXX:-150,NVDA:-1500"
MARKETSIM_TREND_PNL_RESUME_MAP: "AAPL:-3000,GOOG:-50,XLK:-100,AMZN:-200,SOXX:-75,NVDA:-750"
MARKETSIM_SYMBOL_MAX_ENTRIES_MAP: "NVDA:1,MSFT:10,AAPL:10,AMZN:8,GOOG:6,XLK:6,SOXX:6"
CI_SIM_PREFIX: "ci-${{ github.run_id }}"
run: |
make sim-report
- name: Aggregate simulator trends
run: |
make sim-trend
- name: Check trend alerts
env:
CI_SIM_PREFIX: "ci-${{ github.run_id }}"
MARKETSIM_SYMBOL_SIDE_MAP: "NVDA:sell"
MARKETSIM_SYMBOL_KELLY_SCALE_MAP: "AAPL:0.3,MSFT:0.2,NVDA:0.05,AMZN:0.15,GOOG:0.2,XLK:0.15,SOXX:0.15"
MARKETSIM_SYMBOL_MAX_HOLD_SECONDS_MAP: "AAPL:7200,MSFT:10800,NVDA:7200,AMZN:10800,GOOG:10800,XLK:10800,SOXX:10800"
run: |
python scripts/check_trend_alerts.py \
marketsimulator/run_logs/trend_summary.json \
--min-sma -1200 \
--max-std 1400 \
--symbols AAPL,MSFT,NVDA,AMZN,GOOG,XLK,SOXX \
--trades-glob "marketsimulator/run_logs/${CI_SIM_PREFIX}_trades_summary.json" \
--max-trades-map NVDA@maxdiff:2,MSFT@maxdiff:20,AAPL@maxdiff:20,AMZN@maxdiff:16,GOOG@maxdiff:12,XLK@maxdiff:12,SOXX@maxdiff:12
- name: Upload simulator artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: sim-report-${{ github.run_id }}
path: |
marketsimulator/run_logs/${{ env.CI_SIM_PREFIX }}_*
marketsimulator/run_logs/trend_summary.json
results/bench_fast_vs_python.json
results/bench_fast_vs_python.csv
results/fastppo_ci.json
results/fastppo_ci_report.html
results/aapl_fastppo_trace.png