Jack Allan Kasbeer

← Inventions & Projects

LAWRENCE: Exploring Solana Liquidity Pools With a Trading Model

· databricks, lightgbm, statistics, solana, pre-registration

The model I liked best averaged +2.93% per simulated trade during development. On 21 days of data I had set aside, it averaged −5.46% after costs. By then I’d already written down what counted as a pass, what counted as a failure and what I would do in either case. I recorded the failure. LAWRENCE never traded real money.

I started the project with a question left over from BIA. BIA tried to be early to a new Solana pool. If I gave up that head start and waited at least a minute, was there enough in the trading history to pick better entries and cover the fees?

What the model could see

I collected launches, bonding-curve trades and activity after tokens graduated into regular pools. On Databricks I joined the two stages into a continuous series of one-minute bars. The resulting dataset had 7.5 million candidate entry rows across 1.15 million tokens. Each row represented a decision I could have made about one token at one minute. The data followed the same layers as my Bitcoin and Ethereum lakehouse.

Pipeline from Dune Analytics into Bronze raw Delta tables, then Silver one-minute OHLCV, then Gold entry candidates with features and labels, then walk-forward research, then a frozen sha256-checked contract, then a pre-registered holdout that is run once and returns PASS, FAIL, INCONCLUSIVE or INVALID.
Every stage writes Delta tables in Unity Catalog. New features only ever go into new tables, so frozen columns are never edited.

I labeled a candidate by following it until the value doubled, halved, or six hours passed. If a single bar touched both boundaries, I counted the stop. The model was judged on the return after estimated fees and slippage on both sides.

Two illustrative price paths from an entry price. One rises and touches the 2x take-profit line first; the other falls and touches the half-price stop line first. A vertical line at six hours marks the timeout.
The label is decided by the first barrier the path touches.

I settled on a capped return after an uncomfortable afternoon in October. My first results showed gains in every fold. Remove the top 1% of trades and every fold went negative. A few extraordinary launches had supplied most of the apparent return, and sampling the same tokens each minute had given them many chances to appear.

Stress test (Oct 2, per fold) Result
Returns capped at 10x −1.1% to −6.6%
Returns capped at 2x −6.4% to −13.3%
Without the top 1% of trades −8.2% to −14.6%
Share of profit from the top 1% 251% to 408%

How LAWRENCE scored an entry

For each candidate, x described one token at one minute. It included the token’s age, recent trading volume and counts of buys and sells. I trained LightGBM to predict y, the gross return I would have earned by entering at that minute and following the six-hour exit rule.

y= PexitPentry −1

The model started with the mean return in the training data. Each new tree learned from the errors the earlier trees still made. For training row i, the error before tree m was the observed return minus the prediction so far.

ri,m= yi− y^m−1 (xi)

Tree m split the training rows into groups with similar errors. For a new candidate, hm(x) was the correction in the leaf where that candidate landed. The frozen model added 5% of each tree’s correction to the starting mean, ȳ. After 300 trees, its predicted gross return was

y^(x)= y¯+0.05 ∑m=1300 hm(x).

For example, a score of 0.10 meant the model estimated a 10% return before costs. For an eligible token with no open position, v2 would take that simulated trade. Its cutoff was about 6.85%, the 95th percentile of its training scores. v2-R1 used the same trees but raised the cutoff to the 98th percentile, about 13.70%, so it would skip the very same trade. I scored the outcome using the realized return minus fees and slippage on both sides. Frozen v2 model settings · Frozen entry cutoffs

A result you could only get at midnight

One rule picked the five top-scoring entries of each day. It averaged +8.04% and was positive in all four development folds. To make the first purchase of the morning, though, I would have needed the scores of tokens that hadn’t launched yet. When I ranked each entry using only the preceding 24 hours, the result collapsed.

That’s the sort of number I wanted to leave in the experiment log. If I recorded only the rules I eventually used, I’d lose the explanation for why a convincing result had disappeared. Experiment log

Writing the verdict before opening the data

I froze the model files and their evaluation code. A fixture of input rows and expected scores checked that the serving code loaded the same model and built the features in the same order. I committed the trading rule, window and verdict criteria before scoring the holdout. A written amendment added a third model and tightened the confidence threshold to account for testing three of them. Pre-registration · Amendment

A pass required the lower confidence bound on mean net return to exceed zero at base costs and the mean to stay positive at higher costs. I resampled whole token-days for the confidence interval. Repeated entries in the same token on the same day can move together, and treating each row as independent would make the interval look narrower.

The 21 days I hadn’t used

v1 v2 v2-R1
Trades / tokens 3,383 / 1,774 2,640 / 1,338 867 / 480
Mean net, base costs −5.28% −4.47% −5.46%
Lower bound (96.7%), base −7.31% −6.46% −8.96%
Mean net, stress costs −6.28% −5.47% −6.46%
Median net, base −43.7% −18.0% −21.0%
Hit 2x 24.5% 19.6% 20.0%
Verdict FAIL FAIL FAIL
Dot-and-line chart. Development results for v1, v2 and v2-R1 sit at −2.16%, +0.11% and +2.93%, with lower bounds below zero. All three holdout results sit between −4.5% and −5.5% with lower bounds between −6.5% and −9%.
Development (blue) against the holdout (red). A pass needed the whole line to the right of zero.

All three models failed. The development favorite, v2-R1, took about 41 trades a day in the holdout against about 22 in development. Its picks doubled about 20% of the time, down from 27%. It was picking more often and hitting less often.

Checking the simulator after the verdict

The first replay of the decision engine matched 10 of 11 backtest trades. On quiet tokens the engine needed to wake up every minute, even without a new bar. It also needed to consider a fresh entry in the same minute a previous position closed. After both fixes, a larger replay matched 55 of 55 trades across 300 tokens, with identical simulated returns. That answered a software question. The three holdout verdicts still stood.

I also tried taking partial exits and cutting losses earlier. This was exploratory work on data I’d already opened. Keeping the old entries and changing the exit brought the mean from roughly −5.4% to −0.7%. On the model’s training days, the original exit averaged +57.68% per trade and E3 averaged +36.65% on the same entries.

Step chart of the share of a position still held as price rises: 100% until 2x, then half sold at each of 2x, 4x, 6x and 8x, and the rest sold at 10x. A stop at 0.8x of entry sells everything.
E3: sell half of what's held at 2x, 4x, 6x and 8x, the rest at 10x; stop at −20% from entry; no time limit.

One last rule for stopping

For v5 I changed the training target to the new exit return, added market-wide features and used more history. I wrote the acceptance conditions first. The model needed to beat the baseline in at least four of six weekly folds and on the pooled mean and lower bound, with a positive pooled mean. Even success would only have earned it a fresh forward test. v5 plan

Fold B0 trades B0 mean net v5 trades v5 mean net
1 85 +20.7% 794 −5.2%
2 205 −0.2% 1,087 −4.1%
3 503 −3.3% 1,440 −8.4%
4 413 +0.1% 889 −1.7%
5 487 −1.2% 1,738 +0.9%
6 234 +1.3% 1,098 +2.6%
Pooled 1,927 −0.09% 7,046 −2.53%

It won two folds and averaged −2.53% across them all. On November 23 I closed the project. I built the system with Claude helping draft code, tests and the decision log. The decision I’m glad I made myself was writing down when to stop while I still wanted the models to work. LAWRENCE source and research notes