DreamFly
DreamFly is a ready-made bot you deploy from the dreamBot Builder with Deploy DreamFly. A model of a fruit fly's learning circuit, the mushroom body wired from the Male CNS v1.0 connectome, decides for each market which strategy to run next, or to sit out, and learns from how that went. It comes with a dashboard where you watch the fly trade.
It is built to adapt, not to promise returns. No edge is claimed.
The code is open source: somnia-chain/dreamdex-dreamfly.
How it decides
- It picks, it doesn't invent. Every hour the fly reads the market (volatility, trend, time of day and so on) and chooses one of a fixed set of strategies, or flat. It never makes up a strategy of its own.
- It learns from the result. Each finished hour returns its risk-adjusted profit as the reward, and the fly updates which strategy it trusts in that kind of market.
- One fly per market. Each spot or perp market gets its own fly with its own memory, and they don't share what they learn.
- It starts warm. The tuned settings and warm-started brains ship with the code, so a new bot doesn't start from nothing.
The fly learns from a simulated hour that runs against the live order book, even when its orders are live. Real fills can differ from the simulation because of queue position, latency and fees.
Pick a run
DreamFly trades one network per run. In the builder, pick the run that matches the markets you want; to cover another network, start a second bot.
| Run | What the fly chooses between | Network | Main settings |
|---|---|---|---|
| Spot | Maker, grid, trend, or sit out, for each spot market you list. Turn on Event contracts to add the BTC and ETH Up/Down windows to the same run | Testnet or mainnet | Spot markets, event contracts on or off, live stake per market |
| Event contracts | For each BTC and ETH Up/Down window, back the favourite near the close or sit out. No spot markets | Testnet or mainnet | Live stake per window |
| Perps | Maker, trend, funding carry, or sit out, for every perp market or a list you give | Testnet only, on the testnet app | Perp markets, the DreamDEX account it trades, live margin per market |
Every run needs a dashboard password, and the builder won't let you continue without one.
Dry run and live
A new DreamFly bot starts on testnet in dry run: it writes down every order it would place and sends nothing. In live mode it sends real orders.
- Spot: real orders on the network you chose. Once the wallet is down 50 USDso in a UTC day, the spot flies stay flat until the next day.
- Event contracts: one immediate-or-cancel bet per window it picks, at the live stake: tUSDC test money on testnet, USDso on mainnet. A bet can't be sold back before the window closes, and the fly claims the winnings once the window settles.
- Perps: testnet only. The fly trades your app wallet through a linked bot key, the same way as a kit Perps bot. See Run Your Bot.
Live on mainnet needs one more setting. Set Confirm mainnet live orders to yes under Show advanced settings as well as choosing Live. Without it the bot refuses to start, so a half-configured mainnet run can't send orders by accident.
The dashboard
The dashboard shows the fly at its desk, the market it trades and the strategy it picked, with a tab for each market you run. On a phone it shows the market only.
It opens on the port you set (8765 by default), and asks for your dashboard password with any user name. Without a password, anyone with the link could watch the bot's markets and orders, which is why the builder requires one.
Deploy it
The Deploy step gives you two ways to run DreamFly. Both take the .env the builder generates.
On Railway. Each run has its own one-click template on Railway, with a volume at /data so the fly keeps what it has learned across redeploys. Click Deploy on Railway, paste your .env into Variables → RAW Editor, add your key on the PRIVATE_KEY line, and deploy. Generate a domain for the service (Settings → Networking) and open it to see the dashboard. The full guide is docs/railway.md in the repository.
On your own machine. You need Python 3.11 or later, and Node.js 20 or later for perps and event contracts. The builder prints these lines:
git clone https://github.com/somnia-chain/dreamdex-dreamfly
cd dreamdex-dreamfly
python3 -m venv .venv && .venv/bin/pip install -e ".[live]"
(cd perp && npm install) # Node, for perps and event contracts; skip for a spot-only run
# save the .env from the builder into this folder, then:
.venv/bin/dreamfly doctor
.venv/bin/dreamfly start
dreamfly doctor is a read-only check of your settings and the dreamDEX API, and sends nothing. Add --wallet to also check the wallet's gas and balances, and for perps the link and the margin.
Learn more
The repository's own guides go further: getting started, configuration, live trading and architecture. Read its DISCLAIMER before going live.