Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
204 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
0b4dd1f
Add device-aware caching for Toto and Kronos
lee101 Oct 23, 2025
29bd553
Improve Toto CPU dtype handling and compiled inference tests
lee101 Oct 24, 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
67 changes: 67 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: CI

on:
push:
branches: ["main"]
pull_request:

permissions:
contents: read

jobs:
quality:
runs-on: ubuntu-latest
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 mypy ruff pyright

- name: Lint with Ruff
run: ruff check src

- name: Type check with mypy
continue-on-error: true
run: python -m mypy --config-file mypy-ci.ini src

- name: Type check with Pyright
continue-on-error: true
run: python -m pyright

- name: Run critical trading backtests
run: |
python -m pytest tests/test_trade_stock_e2e.py tests/test_backtest3.py

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

- name: Run integration tests
run: |
python -m pytest tests/integ
python -m pytest -m integration --ignore=tests/integ
152 changes: 152 additions & 0 deletions .gitignore
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
.env
.venv
.venv314a
.venv313
.venv314
*.pt
*.pth
portfolio_optimization_results*
traininglogs*
training/traininglogs
training/models

expresults.md
backtestdata
.env2
.cache
data
results
env.py
Expand All @@ -8,9 +23,146 @@ lightning_logs
lightning_logs*
lightning_logsminute

strategy_state/
testresults/
data/_simulator/


optuna_test
.pytest_cache

__pycache__
__pycache__*
logfile.log
*.log
positions_shelf.json
*.pt
trainingdata
trainingdata2/
traininglogs
traininglogs_temp
training_log.txt
portfolio_sim_results/
portfolio_optimization_results_20250824_210102.json
portfolio_optimization_results_20250824_210102_best_config.json
optimization_reports/
improved_training_log.txt
toto
predictions/
models
training/training
training/quick_hf_output
training/quick_hf_output/
hftraining/hftraining
hftraining/test_logs/
hftraining/output
optimized_training_log.txt
training/production_model/
training/differentiable_training_history.png
training/optimization_results
training/quick_training_results
quick_simulation_results_forecasts.csv
quick_simulation_results_strategies.csv
POSITION_SIZING_RESULTS.md
LEVERAGE_BACKTEST_SUMMARY.md
LEVERAGE_ANALYSIS_RESULTS.md
BACKTESTING_SUMMARY.md
BACKTESTING_README.md
claudeideas.md
simulationresults
training/optimization_results/
trainingdata/
predictions
portfolio_sim_results/
models
optimization_reports/
toto
rlinference/models
rlinference/logs
rlinference/data
hftraining/logs
hftraining/test_cache
hftraining/test_logs
hftraining/test_output
hftraining/trainingdata/
hftraining/checkpoints/
hftraining/hftraining
improved_training_log.txt
optimized_training_log.txt
training_log.txt
training/quick_hf_output
training/quick_training_results
training/models
training/production_model
training/results
training/training/runs
training/training/improvement_cycles
training/training/traininglogs
training/training/visualizations
training/differentiable_training_history.png
#
# Differentiable Market experiment artifacts
differentiable_market/experiment_runs/
differentiable_market/experiment_runs_*/
differentiable_market/runs/
pufferlibtraining/logs
pufferlibtraining/models
pufferlibtraining/cache
pufferlibtraining/output
pufferlibtraining/runs
hftraining/output
.coverage
scratch.txt
SCINet/
algo-trading-bot/
public-trading-bot/
tototraining/tensorboard_logs
tototraining/mlruns
hftraining/tensorboard
tototraining/temp_predictions_0.json
tototraining/temp_predictions_15.json
tototraining/temp_predictions_5.json
gymrl/artifacts/
gymrl/runs/
hftraining/reports/
scratches
stock_test.db
stock.db
portfolio_risk.png
tototraining/artifacts/
compiled_models/
tototraining/checkpoints
external/kronos/
.tmp_bench_data
.venv312
runs
runs
hftraining/quick_test_logs_*
hftraining/quick_test_output*
.venv312c
nanochat
marketsimulator/environment.py
tmp
stock_trading_suite.egg-info
gymrl/gymrl.egg-info/
*.egg-info/
pynvml
kronostraining/artifacts/checkpoints
kronostraining/artifacts
metric_history.json
# Allow tracked source model implementations while keeping build artifacts ignored
!src/models/
src/models/__pycache__/
src/models/__pycache__/**
!src/models/*.py
!src/models/**/*.py
differentiable_market/evals
.env.local
.envrc
allresults.md
gymrl/gymrl.egg-info/
wandb/
reports
wandb
tensorboard_logs/
gymrl/cache
Empty file modified .gitmodules
100644 → 100755
Empty file.
7 changes: 7 additions & 0 deletions .openai/workspace.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"mcpServers": {
"fal": {
"url": "https://docs.fal.ai/mcp"
}
}
}
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
21 changes: 20 additions & 1 deletion .vscode/launch.json
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,31 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Run trade_stock_e2e",
"type": "debugpy",
"request": "launch",
"program": "${workspaceFolder}/trade_stock_e2e.py",
"console": "integratedTerminal",
"python": "${workspaceFolder}/.venv/bin/python",
"env": {
"PYTHONPATH": "${workspaceFolder}/.venv/lib/python3.12/site-packages:${env:PYTHONPATH}"
},
"envFile": "${workspaceFolder}/.env",
"cwd": "${workspaceFolder}"
},
{
"name": "Python Debugger: Current File",
"type": "debugpy",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
"console": "integratedTerminal",
"python": "${workspaceFolder}/.env/bin/python",
"env": {
"PYTHONPATH": "${workspaceFolder}/.env/lib/python3.11/site-packages:${env:PYTHONPATH}"
},
"envFile": "${workspaceFolder}/.env",
"cwd": "${workspaceFolder}"
}
]
}
Loading