Jack Allan Kasbeer.

← All posts

LAWRENCE: Exploring Solana Memecoins With a Trading Model

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

Abstract. LAWRENCE asks one question: after costs, is there a predictable edge in buying newly launched Solana tokens that doesn’t come from simply being faster? I built a Bronze/Silver/Gold lakehouse on Databricks (7.5M entry candidates across 1.15M tokens), labeled every candidate with a capped triple-barrier return, and trained walk-forward LightGBM models. I committed to the rules before running anything: a pass rule written ahead of each experiment, a fixed budget of variants, a log that keeps the failures, and a holdout window nobody looked at until the models were frozen and hashed. When the holdout came back, all three models failed, with mean net returns of −4.5% to −5.5% per trade and every lower bound below −6%. The best development result, +2.93% per trade, did not survive unseen data. Catching that is the reason the holdout exists. After the verdict I showed that the paper-trading engine reproduces the research exactly (55 of 55 trades), explored a better exit, and pre-registered one last model. Its own rule rejected it, and the research closed on November 23.

No real money was traded. The pre-registration blocked any live spend until a model passed, and none did. The code, the pre-registration and the full decision log are on GitHub.

1. Background

This is part 2 of a story that started with BIA, the Solana sniper I wrote in 2024. BIA had no model. She saw that a pool was new and tried to be one of the first buyers. Her best results came from removing waits, never from knowing which tokens to buy.

LAWRENCE tests the other half of that bet. If I give up the race to be first and enter a minute or more after launch, can a model tell the tokens that double from the ones that halve, by enough to pay the fees? The venues are pump.fun and Raydium LaunchLab. On both, a token trades on a bonding curve until it “graduates” into a regular AMM pool.

The rest of the post follows the order of a paper: data, label, costs, the rules, development results, then the holdout.

2. Data

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.

The first plan used Bitquery’s Solana API. On day three, the historical backfill came back 403, because archive access is an Enterprise feature. I moved everything to Dune Analytics SQL over its API. That move turned out to be a good constraint. Every pull became a resumable per-day job with a one-day cost test first, and every query was capped below the holdout start date, so the holdout couldn’t leak in by accident.

The layers follow the same medallion pattern I used for the BTC/ETH lakehouse:

  • Bronze: raw, append-only DEX trades, curve and post-graduation bars, launches, pool metadata and creator trades.
  • Silver: token_price_1m, 1-minute OHLCV for each token across both phases, so a token’s price history doesn’t break at graduation.
  • Gold: entry_candidates, one row per (token, minute) the model might trade, with point-in-time features and a label. That comes to 7.5M rows over 1.15M tokens, drawn from 1.59M launches.

3. The label

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.

Each candidate gets a triple-barrier return. From the entry price, exit at whichever comes first: the price doubles (+100%), the price halves (−50%), or 6 hours pass (exit at the close). When a choice is ambiguous, the code resolves it against me. A bar that touches both barriers counts as the stop, and a gap through the stop fills at the bar’s close, not at −50%.

The 2x cap came out of the project’s first scare. On October 2 the first model showed +4% to +9.5% per trade after costs, in every fold. The stress tests broke it the same afternoon:

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%

A handful of near-100x tokens, sampled again every minute, carried the whole result, and everything else lost money. You can’t capture that at any real size. I wrote it in the log as “no tradeable edge yet” and capped the label at 2x.

4. Costs

Fees were checked per venue: 125 bps a side on the pump.fun curve, 120 on PumpSwap, 25 on Raydium CPMM. Slippage is 50 bps a side in the base case and 100 in the stress case. Net is the barrier return minus both sides. Across venues and the two slippage cases, a round trip costs roughly 2.5% to 4.5%. Any edge has to clear that before it counts.

5. Not fooling myself

This section is the real project. Five rules, each added because something nearly fooled me.

A pass rule written before the experiment. On October 10 I wrote down an out-of-sample test for the first model (v1) before pulling any data after October 3. The test came back on the 16th as FAIL: −0.00% mean net per trade over 1,144 trades. The in-sample +2.3% had decayed to break-even. Picked tokens hit 2x 26% of the time against a 16% base rate, so there was a real signal, just a smaller one than the costs. The rule existed so that “it’s close” couldn’t turn into a reason to keep tuning on that window.

A variant budget and a log of every result. Each model version got about ten experiments. Each one was declared with its adoption rule before it ran, and each was logged, including the ones that lost. That limits how many paths through the garden of forking paths I could quietly try.

A pre-registered holdout. On October 18 I froze v2 and wrote PREREG.md. It covered the window (October 11 to November 1, 21 days, never pulled), the exact pull steps, the trading rule, and four possible verdicts:

  • PASS: the one-sided lower bound on mean net per trade is above 0 at base costs, and the mean is above 0 at stress costs.
  • INCONCLUSIVE: fewer than 100 trades.
  • INVALID: more than 20% of days missing data.
  • FAIL: anything else.

The file was committed together with the model, manifest and evaluator, and that commit is the freeze. On October 22 a third model, v2-R1, joined the test through a written amendment. I chose v2-R1 after seeing development results, so its numbers were biased upward. The amendment says so, and it tightens α from 0.05 to 0.10 / 3 for all three models (Bonferroni). Tightening a test before you see the data is allowed. Loosening it is not.

An honest error bar. Trades on the same token on the same day move together, so treating them as independent overstates confidence. The lower bound uses a block bootstrap that resamples whole token-days:

def block_bootstrap_lower_bound(trades, net, *, alpha=ALPHA, n_boot=N_BOOT, seed=SEED) -> float:
    block = trades["token_id"].astype(str) + "|" + trades["assessment_time"].dt.floor("D").astype(str)
    g = pd.DataFrame({"b": block.values, "net": net.values}).groupby("b")["net"].agg(["sum", "count"])
    sums, counts = g["sum"].to_numpy(), g["count"].to_numpy()
    rng = np.random.default_rng(seed)
    idx = rng.integers(0, len(g), size=(n_boot, len(g)))      # 10,000 resamples of token-days
    means = sums[idx].sum(axis=1) / counts[idx].sum(axis=1)   # trade-weighted mean per resample
    return float(np.quantile(means, alpha))

Frozen contracts. A frozen model is a file with a sha256 hash, a manifest and a fixture of sample rows with their expected scores. At startup the serving code rescores that sample and refuses to run if any score drifts. That catches a wrong library version, a wrong file, or a feature frame built differently from training:

def verify_startup(contract_dir: str | Path, booster=None) -> float:
    """Scores artifacts/startup_sample.parquet and raises unless every
    prediction matches `expected_prediction` within the manifest tolerance.
    Run at runtime start; refuse to start on failure (wrong library versions,
    wrong file, wrong frame building). Returns the max abs difference."""
    m = load_manifest(contract_dir)
    booster = booster or load_model(contract_dir)
    sample = pd.read_parquet(Path(contract_dir) / "artifacts" / m["startup_sample_file"])
    expected = sample.pop("expected_prediction").to_numpy()
    X = to_model_frame(sample.to_dict("records"), m["categories"])
    diff = float(np.max(np.abs(booster.predict(X) - expected)))
    if diff > m.get("startup_tolerance", 1e-12):
        raise RuntimeError(f"startup check failed: max |pred - expected| = {diff:.3e}")
    return diff

The paper-trading engine that runs a contract reuses the contract’s own label logic for exits, so live exits match the training labels by construction. Proving that it also matched the backtest’s entries took two bug fixes; that story is in section 8.

6. Development results

All on data up to October 10, with walk-forward LightGBM over four weekly folds. This is the repo’s own summary table, lightly trimmed. “Folds +” counts positive folds; for v3-10 to v3-12 it counts folds that beat v2. OOS means out-of-sample; p95 and p98 are the score percentiles used as cutoffs.

# Idea Trades Mean net Lower bound Folds + Verdict
v1 Barrier model 4,240 −2.16% −3.38% (90%) — Failed first OOS test; in holdout
v2 v1 + flow + host, p95 cutoff 2,440 +0.11% −1.45% (90%) 3/4 Frozen, in holdout
R1 v2, stricter p98 cutoff 553 +2.93% −0.61% (90%) 3/4 Best dev → holdout as v2-R1
R2–R6 Other cutoffs and rules 49–2,275 −0.3% to +10.1% all < 0 1–3/4 Rejected
R7 Top 5 per day 124 +8.04% — 4/4 Discarded: look-ahead
R9 Causal top 5 — collapsed — — Rejected
v3-10 + creator, early-buyer features 536 +3.16% −1.46% (95%) 2/4 better Rejected
v3-11 Exit ladder 553 +1.39% −3.97% (95%) 1/4 better Rejected
v3-12 Half at 2x, rest at 10x 553 +3.07% −3.64% (95%) 1/4 better Rejected
v4-1 Curve, 1–15 min in 31,746 −1.89% −3.50% (95%) 0/4 Rejected: latency
v4-2 Post-crash rule P1 3,260 −7.76% −9.60% (95%) 1/4 Rejected
v4-3 Post-crash model 219 −2.70% −8.60% (95%) 2/4 Rejected

R7 deserves a sentence. “Buy the day’s top 5 by score” was positive in all four folds at +8%. It also ranked each candidate against others that hadn’t launched yet, a textbook look-ahead bias. The causal version, which ranks only against the prior 24 hours, collapsed. Four green folds were not evidence of anything.

Going into the holdout, the honest summary was “maybe +3% on a good day, with a lower bound below zero.”

7. The holdout

The window closed on November 1. The pull had to wait until November 2, so every token would have 24 hours of bars after graduation. I ran it today exactly as pre-registered. Cheaper shortcuts (curve bars for graduates only, a shorter window) were considered and not taken. The pull used 6,676.6 Dune credits against a ~9.9k estimate. No days were excluded.

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.

It isn’t close. v2-R1, the development favorite, traded about 41 times a day against about 22 in development, and hit 2x on 20% of trades instead of 27%. The model kept firing on a market that no longer rewarded it.

One number from the evaluation looks good, so here it is with its label. The pre-registration listed an exploratory “top 2 per day” variant as reported, not judged. It shows +10.3% for v2 and v2-R1, on 42 trades. It ranks within the whole UTC day, the same look-ahead as R7, so it isn’t a tradeable result. The pre-registration is why it can’t be promoted after the fact.

Per PREREG.md: no live spend, record and stop. Any new model is a new pre-registration on a later window.

8. After the verdict

The holdout settled the question it was built for. Three loose ends were worth finishing before I closed the project, and each one had its rule written before I looked.

8.1 Parity: 55 of 55

A model that passes on paper is useless if the code that would trade it behaves differently. The decision engine (src/decision/) replays historical 1-minute bars as if they were arriving live, and its trades are compared one by one with the backtest’s. The first replay matched 10 of 11. Getting to an exact match took two fixes:

  • Ticking. The replay only woke up when a token printed a bar, but a token stays eligible for a couple of minutes after its last bar. On a quiet token, the engine could miss the minute the backtest traded. The fix is to tick every minute, which is what a live runtime has to do anyway.
  • Re-entry timing. This was the real cause of the mismatch. When a position closed, the engine returned without assessing that same minute. The backtest’s one-position-per-token rule frees the token at its exit time, so it could re-enter immediately. The engine entered 30 minutes later. The fix is to fall through to assessment in the same tick.

After both fixes: 11 of 11 on 50 tokens, then 55 of 55 on 300 tokens, with a maximum return difference of 0.0. The engine was ready to run a frozen contract forward in paper mode. No contract ever earned that run.

8.2 A better exit (exploratory)

Every model so far sold everything at 2x. I had an idea for an exit that lets winners run while cutting losers early. It became E3:

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.

Applied to v2-R1’s holdout entries, E3 was the biggest single improvement of the project. I’m labeling it exploratory, because the holdout had already been judged and any adoption would need a fresh window:

v2-R1 entries, holdout days Old exit (2x / −50% / 6h) E3
Mean net per trade −5.4% −0.7%
Trades that made money 30% 21%
Trades 867 866

E3 wins less often but cuts its losers at −20% instead of −50%. Its lower bound was still −4.2%, so it’s better but not an edge.

The same comparison on the days the model trained on gave a number worth framing:

Same entries + E3 Mean net per trade
Days the model was trained on +58%
Holdout days it had never seen −0.7%

Same model, same rule, same code. The only difference is whether the model had seen the days before. That’s the clearest picture I have of why an in-sample backtest tells you nothing.

8.3 v5: one last pre-registered try

If E3 is the better exit, maybe the model should learn it. Before running anything, I wrote v5_plan.md with three changes:

  • train on the E3 net return instead of the triple-barrier label;
  • add 11 market-wide context features, such as launches and graduations per hour, the recent 2x rate among graduates, and market volume;
  • use more history, 49 days instead of 28.

It compared v5 with a baseline, B0 (v2’s features and target with the same top-2% cutoff), with both judged on E3 net over 6 weekly walk-forward folds. The plan also said up front that these days had been looked at many times, so this step could only reject v5 or promote it to a new forward test. To be frozen, v5 had to clear four bars: a higher pooled mean than B0, a higher lower bound, a win in at least 4 of 6 folds, and a pooled mean above zero.

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%

v5 lost on every condition, winning only 2 of 6 folds. The E3 target has rare outcomes near +280%, and chasing them made the model less selective: about 3.7 times as many trades, mostly stop-outs. The market features didn’t make up for it. Per the plan, there was no tuning afterwards. On November 23 v5 was rejected, and with it the project closed.

9. Discussion: what the market said

Here’s the final picture:

  • Every version from v1 to v5 landed between −8% and 0% per trade out of sample. No change I tried, whether a feature, a cutoff, a target or an exit, moved it above zero.
  • The entries carry real signal, just not enough. Buying every candidate with E3 averages about −8.0% per trade; the model’s picks sit about 8 points better. That doesn’t clear 2.5–3.5% of round-trip fees by enough to show up.
  • The best out-of-sample result is break-even. v2-style entries with the E3 exit: −0.09% over 6 walk-forward weeks, and −0.7% on the holdout.
  • The edge near launch belongs to speed. Within 1–15 minutes of launch, entries at the last completed bar’s price came out at −0.69% per trade. Re-pricing half of them one bar later, at the price you’d actually get after deciding, dropped the result to −4.49%. The stale price was worth about 3.8 points. That “signal” is latency, and it belongs to the slot-level snipers, which is what BIA was. The fees go to the venues. A model a minute behind gets what’s left, and after costs that’s negative.

Key things I learned:

  • Write the pass rule first, and keep a budget of tries. Without it, R7’s four green folds, the +10.3% variant or E3’s +58% in-sample would have been easy to believe.
  • Stress tests before celebrations. Capped returns, the result without the top 1%, the median, and a one-bar delay each caught something a mean would have hidden.
  • The holdout is the product. The pipeline, the features, the models and the parity-tested engine were all built so a single test could be trusted.

Two ideas are written up and not started: point-in-time social data, and tracking wallets with a known history. Each would need its own pre-registration and a window nobody has seen.

I built a system designed to tell me the truth, and it did.

A note on how it was built

I built LAWRENCE solo, with Claude as a pair programmer working through a scoped shell, file access and a read-only browser. The agent drafted code, SQL and tests and kept the decision log, which grew to almost 2,700 lines. I set the constraints, ran every notebook, approved every paid data pull, and reviewed every commit. One standing instruction mattered more than the rest: push back rather than agree.

Timeline

Date
Sep 13 First commit; DEX-only ingestion into Bronze
Sep 15 Bitquery’s historical API returns 403; move to Dune
Oct 1 Silver 1-minute bars across curve and post-graduation
Oct 2 First “profitable” model; stress tests show it’s the fat tail
Oct 16 v1’s pre-registered out-of-sample test: FAIL
Oct 17 Contract v1 frozen; parity fixture
Oct 18 v2 frozen; PREREG.md committed
Oct 22 Amendment 1 adds v2-R1; α → 0.10 / 3
Oct 24 Paper-trading engine; first replay matches 10 of 11 trades
Nov 22 Holdout pulled and scored: three FAILs; parity bug fixed, 11/11 then 55/55; E3 explored; v5 plan written
Nov 23 v5 rejected by its pre-declared rule; project closed

Not financial advice. Nothing here recommends trading anything, and no strategy in this post was shown to make money.