Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
246 commits
Select commit Hold shift + click to select a range
5ad719f
Merge pull request #1 from lee101/chronos
lee101 Jun 21, 2024
547ac51
looping canceling in new process
lee101 Jun 23, 2024
6dd928f
fixup dates
lee101 Jun 24, 2024
f623d22
fix limiting orders kept clsoing at market
lee101 Jul 3, 2024
0beb518
fix import
lee101 Jul 3, 2024
b34c39c
f rounding
lee101 Jul 3, 2024
9654b3a
more aggressive sell ramp to exit positions - todo market order as a …
lee101 Jul 4, 2024
a0f5f08
fix async
lee101 Jul 5, 2024
171e204
fixlog
lee101 Jul 7, 2024
7b52228
fix debouncing
lee101 Jul 8, 2024
cea9514
fix debouncing
lee101 Jul 9, 2024
0130076
clean context
lee101 Aug 12, 2024
3f18e22
another layer of cooldown
lee101 Aug 16, 2024
7243de3
fix not backing out when its not trading time for normal assets - cou…
lee101 Aug 16, 2024
1f4b08d
filetypeonlychangenewforecasts
lee101 Sep 20, 2024
e27563e
wip
lee101 Sep 21, 2024
07990e7
wip
lee101 Sep 24, 2024
f9a2721
wip
lee101 Sep 25, 2024
61cf6ae
fix
lee101 Sep 25, 2024
1a02247
fix final day
lee101 Sep 25, 2024
a51260a
diff handling
lee101 Sep 25, 2024
f0badc1
fix/todo
lee101 Sep 25, 2024
1b1ad53
wip
lee101 Sep 25, 2024
da94105
ramp from bid to ask
lee101 Sep 25, 2024
d5beb68
print more details of when we should trade
lee101 Sep 25, 2024
a84a9a7
test other strat
lee101 Sep 26, 2024
3cdbb9c
dont change cache in test
lee101 Sep 26, 2024
5fdff88
wip todo fix math
lee101 Sep 26, 2024
60f345f
fix tests
lee101 Sep 26, 2024
bcef95f
fix fees calc
lee101 Sep 26, 2024
b682906
fix cache
lee101 Sep 26, 2024
de3d27c
wip
lee101 Oct 28, 2024
de07d4a
fix
lee101 Oct 28, 2024
e386033
fix fees calc
lee101 Oct 28, 2024
be8b6cf
fmt
lee101 Oct 28, 2024
ddc6a00
auto trading bot
lee101 Oct 29, 2024
87030fc
fix
lee101 Oct 29, 2024
e229fdd
only close orders we know are bad
lee101 Oct 29, 2024
552064d
fix tests, dont close orders that are aiite
lee101 Oct 29, 2024
e0e734a
fix
lee101 Oct 29, 2024
c7be579
r bonferoni stuff
lee101 Oct 29, 2024
ab041aa
fix
lee101 Oct 29, 2024
958aa19
fix
lee101 Oct 29, 2024
a299404
fix
lee101 Oct 29, 2024
6a584e5
fix
lee101 Oct 29, 2024
e97b466
whatever
lee101 Oct 30, 2024
cee176c
fix
lee101 Oct 30, 2024
f147701
Merge branch 'backtesting' of github.com:lee101/stock-prediction into…
lee101 Oct 30, 2024
54787bb
tweak fees
lee101 Oct 30, 2024
5f8685c
fix trading less aggressive with crypto as its high fee
lee101 Oct 30, 2024
f318e38
fix to be careful with crypto not trying to short
lee101 Oct 30, 2024
0973ec2
fix async
lee101 Oct 30, 2024
1159250
fix erroring too quick
lee101 Oct 30, 2024
b2dfe01
fix
lee101 Nov 1, 2024
ebe9140
r loguru
lee101 Nov 1, 2024
a361dbd
r
lee101 Nov 2, 2024
5cb7564
fix result ref before assign
lee101 Nov 2, 2024
614707a
fix order canceling
lee101 Nov 4, 2024
018e26b
fix
lee101 Nov 8, 2024
eb42438
fix show position
lee101 Nov 29, 2024
72c1075
fix not asking for all if bal goes out of date
lee101 Nov 29, 2024
34bfe59
fix comparing pairs
lee101 Dec 8, 2024
5ec1de8
fix
lee101 Dec 11, 2024
610b5d6
update chronos
lee101 Dec 11, 2024
1f66b2a
wip
lee101 Dec 18, 2024
69479f5
fix
lee101 Dec 19, 2024
430b164
fix tests
lee101 Dec 19, 2024
cc6c607
fix
lee101 Dec 19, 2024
d655be5
wip
lee101 Dec 19, 2024
fee2276
fix
lee101 Dec 20, 2024
6e2edda
Merge branch 'backtesting' of github.com:lee101/stock-prediction into…
lee101 Dec 20, 2024
74d0809
fixes
lee101 Dec 28, 2024
a5ca906
fix
lee101 Dec 28, 2024
ab2e3f6
fix trading plan
lee101 Dec 28, 2024
0a20e86
fix computation around crypto
lee101 Dec 28, 2024
5e5cfe2
fix openpred
lee101 Dec 28, 2024
ea33856
fixup calculations
lee101 Dec 28, 2024
ec6616a
refactor
lee101 Dec 28, 2024
0b7922c
test
lee101 Dec 28, 2024
1db4d83
realism
lee101 Dec 28, 2024
9447664
Merge branch 'backtesting' of github.com:lee101/stock-prediction into…
lee101 Dec 28, 2024
43d6483
fmt
lee101 Dec 28, 2024
58b4023
fx
lee101 Dec 28, 2024
38b2bdf
val losses logging
lee101 Jan 2, 2025
5db1a13
experiments with claude for forecasting
lee101 Jan 16, 2025
980b59d
wip
lee101 Jan 24, 2025
e24a8b9
Merge branch 'backtesting' of github.com:lee101/stock-prediction into…
lee101 Jan 24, 2025
7caeb4e
rm file around what strat is being executed
lee101 Jan 24, 2025
3906225
fix crippling bug
lee101 Jan 24, 2025
d5faabe
fix weird zero issue
lee101 Jan 24, 2025
50a4bc4
fix final pred
lee101 Jan 30, 2025
adaffc1
oss
lee101 Feb 8, 2025
385d531
oss
lee101 Feb 8, 2025
556e63c
docs
lee101 Feb 8, 2025
c432882
fix docs
lee101 Feb 8, 2025
e90c5c7
doc
lee101 Feb 19, 2025
f78b5d6
add vid
lee101 Feb 19, 2025
71857bc
fix
lee101 Feb 28, 2025
f0ba51c
fix model caching
lee101 Mar 5, 2025
91a0a07
fix
lee101 May 10, 2025
8d70b87
large logging refactor
lee101 May 10, 2025
83b8e8a
comment
lee101 May 10, 2025
081aab9
util enable crypto
lee101 May 11, 2025
c42b0f4
fix early exiting stopping trading
lee101 May 11, 2025
d586889
r script
lee101 May 11, 2025
c471178
bolt
lee101 May 23, 2025
1f1d526
fix float stuff
lee101 May 23, 2025
fdaef23
Handle insufficient funds retry
lee101 May 29, 2025
d09113e
Merge pull request #8 from lee101/7vhq2w-codex/handle-trade-refusal-i…
lee101 May 29, 2025
1f06fd6
more aggressive
lee101 May 29, 2025
300e37f
more aggressive backout
lee101 May 30, 2025
09ceb72
Add market fallback for backout
lee101 Jun 4, 2025
0ab6e60
Update alpaca_wrapper.py
lee101 Jun 4, 2025
6d604d3
Merge pull request #9 from lee101/codex/improve-short-position-backou…
lee101 Jun 4, 2025
847ed68
fix
lee101 Jun 4, 2025
5644a75
Refine demo to use real data
lee101 Jul 17, 2025
458d783
wip
lee101 Jul 19, 2025
ea80846
migration to toto
lee101 Jul 19, 2025
b590960
retry allin if its too smal what we can trade
lee101 Jul 20, 2025
16fb09f
tweak rules to trade less/larger more risk
lee101 Jul 22, 2025
0a6e740
retry get proper ask sometimes ask it not there
lee101 Jul 22, 2025
7b70c8c
fxup so we can ramp up a given position a bit if its alreayd open wit…
lee101 Jul 23, 2025
c5d3077
fx risk
lee101 Jul 25, 2025
e6ed2d0
twice in morning potentially to have higher risk
lee101 Jul 30, 2025
f54dced
Merge branch 'main' of github.com:lee101/stock-prediction
lee101 Jul 30, 2025
796493d
fx
lee101 Jul 30, 2025
ff3db48
training start
lee101 Aug 18, 2025
c03493f
try some other alg
lee101 Aug 18, 2025
ff4af9d
fx training
lee101 Aug 20, 2025
681d380
training
lee101 Aug 24, 2025
1e1aef1
wip
lee101 Aug 24, 2025
8f3bc0c
training
lee101 Aug 27, 2025
ecee554
fx
lee101 Sep 2, 2025
720aa0c
hfinference
lee101 Sep 2, 2025
25b6cd4
fx
lee101 Sep 6, 2025
28585db
tests - todo get better integ
lee101 Sep 6, 2025
76d0f15
wip training
lee101 Sep 6, 2025
51480bd
tools
lee101 Sep 6, 2025
05c8472
idk
lee101 Sep 6, 2025
1ae6dc1
pufferlib
lee101 Sep 6, 2025
377732d
fx
lee101 Sep 6, 2025
d5eae07
tests
lee101 Sep 6, 2025
a6ac864
trainin
lee101 Sep 6, 2025
ea10994
r jfinance
lee101 Sep 6, 2025
6f84196
todo fix this slop in totoembbedding
lee101 Sep 6, 2025
78181e3
todoREVIEWME
lee101 Sep 6, 2025
b6e5ba5
addtoto
lee101 Oct 10, 2025
cac7992
agen
lee101 Oct 10, 2025
a927701
fx idk
lee101 Oct 10, 2025
bae3554
wip
lee101 Oct 13, 2025
252e755
Merge branch 'training' of github.com:lee101/stock-prediction into tr…
lee101 Oct 13, 2025
e48bc2f
wip
lee101 Oct 16, 2025
ba93146
hyperparams
lee101 Oct 16, 2025
748b150
fx
lee101 Oct 16, 2025
e6eda3b
fixlogsand
lee101 Oct 16, 2025
30a4338
independnentagent
lee101 Oct 16, 2025
e20d5c3
Merge branch 'main' of github.com:lee101/stock-prediction
lee101 Oct 16, 2025
df619a8
fx
lee101 Oct 16, 2025
5e1a1d2
Merge branch 'main' of github.com:lee101/stock-prediction
lee101 Oct 16, 2025
b6dbd68
fx
lee101 Oct 16, 2025
32235b1
Merge branch 'main' of github.com:lee101/stock-prediction
lee101 Oct 16, 2025
e3e17ce
rname
lee101 Oct 17, 2025
e1fe2d2
fxsims
lee101 Oct 17, 2025
d063950
fx
lee101 Oct 17, 2025
79f87af
fx
lee101 Oct 17, 2025
43f8f1c
Merge branch 'main' of github.com:lee101/stock-prediction
lee101 Oct 17, 2025
99854f6
fx
lee101 Oct 17, 2025
de80409
Merge branch 'main' of github.com:lee101/stock-prediction
lee101 Oct 17, 2025
bae1bbf
fxtodo
lee101 Oct 17, 2025
6d4de2c
fxtodo
lee101 Oct 17, 2025
ca62e2a
fx
lee101 Oct 18, 2025
492d573
Merge branch 'main' of github.com:lee101/stock-prediction
lee101 Oct 18, 2025
031a7f0
syspronmpt
lee101 Oct 18, 2025
9440ddb
Merge branch 'origin/main'
lee101 Oct 18, 2025
0415fc2
Fix gymrl trading fee import fallback
lee101 Oct 18, 2025
c8e489b
improfveperf
lee101 Oct 18, 2025
a7bbaf2
fixes
lee101 Oct 19, 2025
af15b18
fx
lee101 Oct 19, 2025
241646f
fxup
lee101 Oct 19, 2025
a4ed4c8
fx
lee101 Oct 19, 2025
947ab65
pkg
lee101 Oct 19, 2025
d232115
Merge branch 'main' of github.com:lee101/stock-prediction
lee101 Oct 19, 2025
818a885
fxlock
lee101 Oct 19, 2025
b9d8819
nit
lee101 Oct 19, 2025
b0fe171
fxlock
lee101 Oct 19, 2025
6d04052
fx
lee101 Oct 19, 2025
54f3e11
Merge branch 'origin/main'
lee101 Oct 19, 2025
90eaaec
fsx
lee101 Oct 20, 2025
7a31e2d
Merge branch 'main' of github.com:lee101/stock-prediction
lee101 Oct 20, 2025
c239f0c
Add day-end deleveraging script and tests
lee101 Oct 20, 2025
10d2e43
fx
lee101 Oct 20, 2025
8efa18e
Merge branch 'main' of github.com:lee101/stock-prediction
lee101 Oct 20, 2025
46947b1
Resolve merge conflicts in workspace packages
lee101 Oct 20, 2025
cd1e35c
fx
lee101 Oct 20, 2025
fb4f689
fxwip
lee101 Oct 20, 2025
d3f29f9
various-differnetiablemarkethit99pctnice
lee101 Oct 21, 2025
dedadb0
kronosdifferentiabl74pctannual
lee101 Oct 21, 2025
dfb2928
interest
lee101 Oct 22, 2025
561cde5
Merge branch 'main' of github.com:lee101/stock-prediction
lee101 Oct 22, 2025
e5be13b
stockagentsn_fal
lee101 Oct 22, 2025
180d782
Merge branch 'main' of github.com:lee101/stock-prediction
lee101 Oct 22, 2025
4dbd89a
wips
lee101 Oct 23, 2025
b21468e
refactortests_prod
lee101 Oct 23, 2025
b51b130
leverage cpa for crypto - + - better silulation
lee101 Oct 23, 2025
c47031f
Merge branch 'main' of github.com:lee101/stock-prediction
lee101 Oct 23, 2025
a1b9717
Fix trade_stock_e2e fallback import closure
lee101 Oct 23, 2025
6131bc5
fx
lee101 Oct 24, 2025
c592482
simulatefalhmm
lee101 Oct 24, 2025
728934d
fx
lee101 Oct 24, 2025
898e2cc
fx
lee101 Oct 25, 2025
affb53b
Merge branch 'main' of github.com:lee101/stock-prediction
lee101 Oct 25, 2025
7a4c68b
Merge remote-tracking branch 'origin/main'
lee101 Oct 25, 2025
3eff6a7
tests: harden prod suites for kronos/toto merge
lee101 Oct 25, 2025
994f7a5
tests: add real marketsimulator gpu integration
lee101 Oct 25, 2025
3eaaf6d
lock
lee101 Oct 26, 2025
c039c26
wip_provisioning
lee101 Oct 26, 2025
26a8e7b
Merge remote-tracking branch 'origin/main'
lee101 Oct 26, 2025
a224efa
tests: stabilize marketsimulator gpu integration
lee101 Oct 26, 2025
f22f9b1
Add yfinance dependency for trading tests
lee101 Oct 26, 2025
34c7892
marketsimulator: handle multiindex prices and kronos gpu fallback
lee101 Oct 26, 2025
a0f51dd
Optimize calibration window forecasting
lee101 Oct 26, 2025
7a77079
fx
lee101 Oct 26, 2025
415cdd1
Merge branch 'main' of github.com:lee101/stock-prediction
lee101 Oct 26, 2025
0605ac4
fx
lee101 Oct 26, 2025
c74e110
fx
lee101 Oct 27, 2025
fff69ff
Merge branch 'main' of github.com:lee101/stock-prediction
lee101 Oct 27, 2025
f2a4a31
asdf
lee101 Oct 27, 2025
ba9aa47
fx
lee101 Oct 28, 2025
b26d3b9
fx
lee101 Oct 28, 2025
e51ba89
todo
lee101 Oct 28, 2025
d027ae6
fx
lee101 Oct 28, 2025
bae38d7
fx
lee101 Oct 28, 2025
d38fd02
idk
lee101 Oct 28, 2025
a8c5a2e
Merge branch 'main' of github.com:lee101/stock-prediction
lee101 Oct 28, 2025
e98f724
fx
lee101 Oct 28, 2025
bc24726
fx
lee101 Oct 28, 2025
00abc4c
Merge branch 'main' of github.com:lee101/stock-prediction
lee101 Oct 28, 2025
d074774
Add rlsys reinforcement learning system with tests
lee101 Oct 28, 2025
12d2635
fx
lee101 Oct 29, 2025
6c6f774
setupstuff
lee101 Oct 29, 2025
0bc5cee
Merge pull request #12 from lee101/codex/develop-rl-system-with-moder…
lee101 Oct 29, 2025
70192f7
experiments
lee101 Oct 29, 2025
715f499
fxgithub
lee101 Oct 29, 2025
b3c1978
fx
lee101 Oct 29, 2025
d63e078
fx
lee101 Oct 29, 2025
3c2b6bf
Update readme.md
lee101 Oct 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
9 changes: 9 additions & 0 deletions .claude/settings.local.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"permissions": {
"allow": [
"Bash(ls:*)",
"Bash(grep:*)"
],
"deny": []
}
}
29 changes: 29 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[run]
source =
src
rlinference
hfinference
hftraining
hyperparamopt
totoembedding
omit =
tests/*
**/test_*.
**/*_test.py
**/.venv/*
**/venv/*
**/.tox/*
**/site-packages/*
**/experiments/*
**/reports/*

[report]
exclude_lines =
pragma: no cover
if __name__ == .__main__.
@overload
@abstractmethod
@abc.abstractmethod
precision = 1
skip_empty = True

24 changes: 24 additions & 0 deletions .cursorignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
data
lightning*
logs
optuna*
.idea

.env
.cache
data
results
env.py
env_real.py
logs
lightning_logs
lightning_logs*
lightning_logsminute


optuna_test
.pytest_cache

__pycache__
__pycache__*
logfile.log
9 changes: 9 additions & 0 deletions .cursorrules
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
you can use tools like bash:

git --no-pager diff --cached -p
git --no-pager diff -p

to look over the diff
testing/uv installing in the .venv
pytest .
uv pip compile requirements.in -o requirements.txt && uv pip install -r requirements.txt --python .venv/bin/python
15 changes: 15 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "PufferTank 5090",
"image": "pufferai/puffertank:latest",
"runArgs": ["--gpus=all"],
"customizations": {
"vscode": {
"extensions": [
"ms-python.python",
"ms-toolsai.jupyter",
"github.vscode-pull-request-github"
]
}
},
"postCreateCommand": "uv pip install --upgrade pufferlib torch gymnasium"
}
37 changes: 37 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

# Ignore everything by default.
*

!.dockerignore
!Dockerfile.runpod
!pyproject.toml
!uv.lock
!runpodmarket/**
!falmarket/**
!fal_marketsimulator/**
!faltrain/**
!marketsimulator/Dockerfile
!marketsimulator/**
!src/**
!traininglib/**
!training/**
!rlinference/**
!gymrl/**
!analysis/**
!analysis_runner_funcs/**
!fal_utils/**
!utils/**
!stock/**
!toto/**
!trade_stock_e2e.py
!trade_stock_e2e_trained.py
!alpaca_wrapper.py
!backtest_test3_inline.py
!data_curate_daily.py
!env_real.py
!jsonshelve.py
!loss_utils.py

gymrl/artifacts/**
gymrl/cache/**
gymrl/runs/**
147 changes: 147 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
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

- 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 critical trading backtests
run: |
python -m pytest \
tests/prod/trading/test_trade_stock_e2e.py \
tests/prod/backtesting/test_backtest3.py

- name: Run unit tests
run: |
python -m pytest tests/prod \
--ignore=tests/prod/trading/test_trade_stock_e2e.py \
--ignore=tests/prod/backtesting/test_backtest3.py \
-m "not integration"

- 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@ci_guard:2,MSFT@ci_guard:20,AAPL@ci_guard:20,AMZN@ci_guard:16,GOOG@ci_guard:12,XLK@ci_guard:12,SOXX@ci_guard: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
89 changes: 89 additions & 0 deletions .github/workflows/trend-pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Trend Pipeline Refresh

on:
workflow_dispatch:
schedule:
- cron: '15 1 * * *'

jobs:
run-pipeline:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'

- name: Set up uv
uses: astral-sh/setup-uv@v3

- name: Install dependencies
run: |
uv pip install -e .

- name: Run trend pipeline
run: |
uv run make trend-pipeline

- name: Check latency status
run: |
uv run make latency-status

- name: Append latency summary to job summary
run: |
uv run python scripts/write_latency_step_summary.py

- name: Show provider usage summary
if: always()
run: |
if [ -f marketsimulator/run_logs/provider_usage.csv ]; then
uv run python scripts/provider_usage_report.py --log marketsimulator/run_logs/provider_usage.csv --timeline-window 20 --no-sparkline
if [ -f marketsimulator/run_logs/provider_usage_sparkline.md ]; then
echo "--- Provider Usage Sparkline ---"
cat marketsimulator/run_logs/provider_usage_sparkline.md
fi
else
echo "provider_usage.csv not found"
fi
if [ -f marketsimulator/run_logs/provider_latency.csv ]; then
uv run python scripts/provider_latency_report.py --log marketsimulator/run_logs/provider_latency.csv --output marketsimulator/run_logs/provider_latency_summary.txt
if [ -f marketsimulator/run_logs/provider_latency_rolling.md ]; then
echo "--- Provider Latency Rolling ---"
cat marketsimulator/run_logs/provider_latency_rolling.md
fi
if [ -f marketsimulator/run_logs/provider_latency_history.md ]; then
echo "--- Provider Latency History ---"
cat marketsimulator/run_logs/provider_latency_history.md
fi
else
echo "provider_latency.csv not found"
fi

- name: Upload artefacts
if: always()
uses: actions/upload-artifact@v4
with:
name: trend-pipeline-logs
path: |
marketsimulator/run_logs/trend_summary.json
marketsimulator/run_logs/candidate_readiness.md
marketsimulator/run_logs/candidate_momentum.md
marketsimulator/run_logs/candidate_forecast_gate_report.md
marketsimulator/run_logs/candidate_forecast_gate_history.csv
marketsimulator/run_logs/candidate_readiness_history.csv
marketsimulator/run_logs/provider_usage.csv
marketsimulator/run_logs/provider_switches.csv
marketsimulator/run_logs/provider_usage_summary.txt
marketsimulator/run_logs/provider_usage_sparkline.md
marketsimulator/run_logs/provider_latency.csv
marketsimulator/run_logs/provider_latency_summary.txt
marketsimulator/run_logs/provider_latency_rollup.csv
marketsimulator/run_logs/provider_latency_rolling.md
marketsimulator/run_logs/provider_latency_rolling.json
marketsimulator/run_logs/provider_latency_rolling_history.jsonl
marketsimulator/run_logs/provider_latency_history.md
marketsimulator/run_logs/provider_latency_history.html
Loading
Loading