A Fruit Fly Is Learning To Trade. 139,255 Neurons. Real Synapses. Real Markets. Open Source. Open Brain. No Stopping.
The complete adult Drosophila connectome, wired to a memecoin tape and trained on the money.
One brain, 128 tokens, one second at a time
fly-trader does not use a neural network shaped like a brain. It uses the brain: the synapse-level wiring diagram of an adult fruit fly, run as a recurrent policy whose only trainable freedom is how strongly each real synapse fires.
The brain
The wiring comes from FlyWire FAFB v783, the first complete synaptic connectome of an adult animal brain (Dorkenwald et al., 2024; annotations from Schlegel et al., 2024). Every neuron is present. Every connection between them is a real, electron-microscopy-reconstructed synapse. Neurotransmitter signs follow Shiu et al. (2024): GABA and glutamate inhibit, everything else excites. The build reproduces the MIT-licensed flybrain export edge for edge.
Whole brain, both hemispheres, optic lobes included
Distinct pre→post pairs; ≈33.9 M individual synapses
Sparse odor code of the mushroom body
Approach and avoid readouts of the mushroom body
307 PAM (reward) · 16 PPL1 (punishment)
Antennal-lobe channels the encoder writes into
Sensory, mushroom body, central complex, descending
FlyWire consortium, Nature 2024
How it works
Sensing. Every second the system watches up to 128 recently graduated pump.fun tokens at once. For each one it computes a 45-dimensional market observation: returns and realized volatility over one minute to three hours, buy/sell imbalance, volume, trade counts, unique signers, burstiness, liquidity, drawdown, exit cost, and holder statistics. A small learned encoder writes that observation into the fly's afferent neurons, the populations that in a living fly carry smell, taste, touch, and temperature.
Propagation. Activity then flows through the connectome exactly as the wiring allows: a neuron can only influence the neurons it actually synapses onto. The sign of every synapse is fixed by its neurotransmitter (Dale's law) and the topology never changes. What training adjusts is the magnitude of each connection, plus a gain and bias per neuron. This follows the FlyGM approach (arXiv 2602.17997) in which a whole connectome is trained end to end as a graph model and outperforms both size-matched multilayer perceptrons and random graphs of the same density.
Acting. A decoder reads the 1,303 descending neurons, the fly's motor output, and produces a target exposure between 0 and 1 for each token. Exposure is a fraction of the maximum position size; the runner buys, resizes, or sells to match it, and a trade only fires when the target moves by at least a quarter of a position.
Learning. Training runs in three stages: a rule-based expert generates demonstrations, the connectome is warm-started by imitation with DAgger correction, then recurrent proximal policy optimisation (PPO) refines it against net profit and loss after Jupiter fees, pool fees, and constant-product price impact. Gradients flow back through time and through every synapse of the graph.
The optic lobes (97,499 neurons) are excluded from the trained policy; the market has no photoreceptors to speak to them. The full 139,255-neuron graph is retained for the spiking mode.
An earlier design runs the full brain as leaky integrate-and-fire neurons with dopamine-gated three-factor plasticity confined to the Kenyon-cell → MBON synapses, the site of associative learning in the real fly. It remains available behind a flag and is retained for research, but the trained policy is the default.
Training data
The fly learns from the post-graduation life of pump.fun tokens on Solana: candles and per-trade rows pulled from pump.fun's own swap API, an hourly historical replay archive, and a live tape of every swap on watched pools streamed through Helius. Token metadata and holder statistics come from Jupiter. All of it is stored in Postgres and Parquet and every decision is replayable from journaled inputs.
Per token per beat, over 1 m · 5 m · 15 m · 1 h · 3 h windows
1-minute candles for the first 12 h, 5-minute to 7 days; 31 GB
One row per traded minute per token
Replay archive, every pump.fun trade, hour by hour
Helius websocket tape on watched pools
Behind the measured eligibility gates
Measured rate of new pump.fun migrations
What we taught the fly
A connectome does not come with a trading strategy. The expert that demonstrates one for it is deliberately simple and every threshold in it was measured on the fly's own data before it was allowed to teach.
Graduated pump.fun tokens only
- Mint and freeze authority must be disabled
- At least 1 SOL of swap volume in the last 3 hours
- Watched for up to 7 days after graduation
- Everything else (liquidity, age, holders) is sensory input, never a filter
Measured on 472 k observations
- At least 6 hours since graduation: younger tokens averaged −0.7 % forward return
- Buy imbalance ≥ 0.2 over both 5 and 15 minutes
- Within 5 % of the one-hour high, and rising
- Each condition independently raised the 5- and 15-minute forward return
Four demonstrations, walk-forward tested
- Breakout with volume confirmation
- Participation flow from per-trade rows
- Quality survivor and graduation survivor
- Exit grid: trailing 5–20 %, hard stop 3–8 %, max hold 30–120 min
What smells good before learning
- Rank score over short-horizon momentum and buy/sell flow
- Penalty on bot-inflated volume: a low organic score smells bad
- Backtest: top-versus-bottom decile spread of +0.75 % over 5 minutes
Exits the fly cannot unlearn
- Bitter: exit at −2 % unrealized
- Turned: was up 1 % or more, now flat or below
- Satiety: a gain held long enough is taken, if it clears the round-trip fee
- Hard stop at −50 %; dead-bag sweep after 3 hours without a swap
Capital protection outside the brain
- 0.1 SOL maximum per position, valence-proportional sizing
- 10 SOL rolling 24-hour notional cap
- Kill switch at −30 % from peak wealth blocks new entries
- Gas reserve, circuit breaker on failed executions, stale-feed halt
fly-trader is an experiment. The policy is still in training and its out-of-sample results are unproven; no performance is claimed here or anywhere else. Live trading is default-deny. Paper books run first, every observation, decision, and fill is written to Postgres, and the whole history is replayable. Read the code before you trust it, and never fund it with money you cannot lose.
$FLY
A Solana token launching on Pump.fun alongside the software. It exists to gather the community around the experiment. It has no utility today.
TBA
Contract address and buy link are published here and on the X community at launch. Anything elsewhere is not us.
Coming soon!
Ties between $FLY and the fly-trader software are forthcoming and will be announced on this page and in the X community. Until they are announced, the token does nothing and confers nothing.
$FLY is a memecoin. It is not an offer or solicitation to buy securities, and nothing on this site is investment, financial, legal, or tax advice. There is no expectation of profit from the efforts of others; the token may lose all of its value. It confers no ownership, revenue, governance, or other rights, and no utility is promised. Do your own research, understand the risks of Pump.fun and Solana tokens, and comply with the law where you live. Only spend what you can afford to lose.
Run your own fly
The whole system is open source under the MIT license: connectome build, data ingest, training, the trading runner, and the operator console. It runs on a single Mac.
You will need
- A Mac with Apple SiliconThe brain runs on the Metal GPU through PyTorch. M-series with 32 GB or more is comfortable.
- Python 3.13 and uvuv installs everything else. No other runtime is required.
- PostgreSQLLocal database for the tape, decisions, fills, and brain snapshots. Homebrew's works.
- A Helius API keyStreams swaps and resolves transactions. The free developer tier is enough to watch.
- A Solana wallet (optional)Only for live trading. The bot creates its own; you fund it with what you are willing to lose.
- PatienceThe connectome build downloads about 100 MB of FlyWire data and the first training run takes hours.
Steps
-
Clone and install
git clone https://github.com/bryceweiner/fly-trader.git cd fly-trader uv sync
-
Configure
Copy the template and paste your Helius key. Leave
LIVE_ENABLED=0; paper books run by default.cp .env.example .env
-
Create the database
createdb fly_trader uv run fly-trader init-db
-
Build the brain
Downloads the FlyWire export, checks it against the published neuron and edge counts, and writes the connectome artifact.
uv run fly-trader build-connectome
-
Open the console
One Streamlit app starts and supervises every worker: discovery, capture, training, and the trading runner. Nothing runs outside it.
uv run fly-trader ui
Then open
http://localhost:8501, start the discover and capture workers, and let the tape fill for a few hours before training. -
Train, then trade on paper
Build a dataset from the captured tape and train the policy from the Training tab or the command line. Promote the checkpoint you like. Watch the paper books before you consider anything else.
uv run fly-trader build-dataset uv run fly-trader train-policy
-
Go live only if you mean it
Create the bot wallet, fund it modestly, set
LIVE_ENABLED=1with your capital caps, and run the swap smoke test first. Every cap in the About section is enforced in code, and the kill switch is yours.uv run fly-trader wallet new uv run fly-trader swap-smoke --sol 0.01