[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-96751":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":14,"subscribersCount":14,"size":14,"stars1d":15,"stars7d":15,"stars30d":15,"stars90d":14,"forks30d":14,"starsTrendScore":16,"compositeScore":17,"rankGlobal":9,"rankLanguage":9,"license":18,"archived":19,"fork":19,"defaultBranch":20,"hasWiki":21,"hasPages":19,"topics":22,"createdAt":9,"pushedAt":9,"updatedAt":23,"readmeContent":24,"aiSummary":9,"trendingCount":14,"starSnapshotCount":14,"syncStatus":25,"lastSyncTime":26,"discoverSource":27},96751,"SETS","Shelpid\u002FSETS","Shelpid","Self Improving Trading Machine",null,"JavaScript",210,63,1,0,41,123,89.48,"Other",false,"main",true,[],"2026-09-25 04:01:33","\u003Cdiv align=\"center\">\r\n\r\n\u003Cimg src=\"docs\u002Fimages\u002Flogo.png\" width=\"96\" alt=\"SETS MACHINE pixel computer logo\">\r\n\r\n# SETS MACHINE\r\n### Self Evolving Trading System\r\n\r\nA genetic algorithm breeds grid-DCA trading strategies on real BTC candles, kills everything that fails on data it has never seen, and paper-trades the survivor. Live, in your browser.\r\n\r\n[**Run it locally →**](#run-locally) · [How it works](#how-it-works) · [Honest results](#honest-results) · [Promo video](docs\u002Fmedia\u002Fsets-machine-promo.mp4)\r\n\r\n![SETS MACHINE dashboard: evolution loop, fitness history and the live gene pool](docs\u002Fimages\u002Fhero.png)\r\n\r\n**96 configs per generation · 8 genes · 4 species · 2 399 real BTCUSDT hours · No build, no npm install, no API keys**\r\n\r\n\u003C\u002Fdiv>\r\n\r\n## Watch it evolve\r\n\r\nEvery 4.8 seconds a new generation is born. Immigrants and offspring appear in the gene pool, get backtested, face the out-of-sample gate, and everything that is not an elite dies. The best config that survives the gate takes over the paper grid.\r\n\r\n![Gene pool during one generation: births, lineage pulses and deaths](docs\u002Fimages\u002Fgenepool.gif)\r\n\r\n| Evolve | Select | Trade |\r\n| --- | --- | --- |\r\n| Crossover and mutation over 8 genes. Species quotas stop one lucky family from wiping out the rest. | Train on 70% of the tape, then gate on the unseen 30%. Only configs that stay profitable with low drawdown survive. | The leader runs a real grid-DCA bot on the out-of-sample candles: fills, take-profit, stop, fees. |\r\n\r\n![Evolution loop and best-of-generation fitness](docs\u002Fimages\u002Fevolution.gif)\r\n\r\n![Genome of the leader, natural selection funnel and Kelly sizing](docs\u002Fimages\u002Fselection.png)\r\n\r\n![Paper grid engine with order levels and execution log](docs\u002Fimages\u002Ftrading.png)\r\n\r\n## Explore your way\r\n\r\n- **Run \u002F Pause**, **Step** to the next generation, and **1× 2× 4× 8×** speed.\r\n- **Click any node** in the gene pool to inspect its genome, train and out-of-sample results. Click empty space or press **Esc** to return to the leader.\r\n- Change the **seed** to grow a completely different evolution. Same seed, same result, every time.\r\n- Keyboard: **Space** pause, **→** step, **1–4** speed.\r\n- URL options: `?seed=42`, `?speed=4`, `?warm=50` (evolve 50 generations instantly on load), `?paused`.\r\n- Works on phones: panels stack, nothing scrolls sideways.\r\n\r\n\u003Cp align=\"center\">\u003Cimg src=\"docs\u002Fimages\u002Fmobile.png\" width=\"300\" alt=\"SETS MACHINE on a 390 px wide phone screen\">\u003C\u002Fp>\r\n\r\nFull-page screenshot: [docs\u002Fimages\u002Fdashboard.png](docs\u002Fimages\u002Fdashboard.png)\r\n\r\n## Promo\r\n\r\n\u003Cp align=\"center\">\u003Ca href=\"docs\u002Fmedia\u002Fsets-machine-promo.mp4\">\u003Cimg src=\"docs\u002Fimages\u002Fpromo-poster.jpg\" width=\"360\" alt=\"SETS MACHINE promo video: click to play\">\u003C\u002Fa>\u003Cbr>\u003Csub>25 s promo video · click to play\u003C\u002Fsub>\u003C\u002Fp>\r\n\r\n## Run locally\r\n\r\nRequires Python 3 (to serve the files) and any modern browser.\r\n\r\n```bash\r\ngit clone https:\u002F\u002Fgithub.com\u002FYOUR_GITHUB_USERNAME\u002Fsets-machine.git\r\ncd sets-machine\r\npython -m http.server 8000 --directory dist\r\n```\r\n\r\nOpen **http:\u002F\u002Flocalhost:8000**. That is all: no npm install, no build step, no keys, no database. Everything runs client-side in plain ES modules.\r\n\r\n**Host it for free on GitHub Pages:** Settings → Pages → *Deploy from a branch* → `main` \u002F `(root)`. The root `index.html` forwards visitors to `dist\u002F`.\r\n\r\n**Run the tests** (Node 18+, no dependencies):\r\n\r\n```bash\r\nnode --test tests\u002F*.test.mjs\r\n```\r\n\r\n**Refresh the market data** from Binance's public API (standard library only, no key):\r\n\r\n```bash\r\npython tools\u002Ffetch_data.py --hours 2400\r\n```\r\n\r\n## How it works\r\n\r\n### The genome\r\n\r\nEach strategy is a long-only grid-DCA bot described by 8 genes:\r\n\r\n| Gene | Range | What it does |\r\n| --- | --- | --- |\r\n| `family` | 4 species | Entry logic: **Momentum** (z-score above +Z), **Mean revert** (below −Z), **Vol breakout** (close above the previous N-bar high), **Range grid** (inside a quiet band) |\r\n| `lookback` | 10–200 h | Window for the rolling mean, deviation and breakout high |\r\n| `entryZ` | 0.2–2.5σ | How far price must stretch before the bot enters |\r\n| `levels` | 2–8 | Number of buy orders in the grid |\r\n| `spacing` | 0.3–3% | Distance between grid levels |\r\n| `mult` | 1–2× | Size multiplier per deeper level |\r\n| `tp` | 0.3–4% | Take-profit above the average entry |\r\n| `stop` | 1–12% | Stop below the deepest level; closes everything |\r\n\r\n### The loop\r\n\r\n| Stage | In the code |\r\n| --- | --- |\r\n| **Observe** | Read volatility of the current tape window |\r\n| **Hypothesize** | Inject 8 random immigrants |\r\n| **Mutate** | Tournament selection inside each species, uniform crossover, Gaussian mutation (p = 0.18) |\r\n| **Backtest** | Every newcomer is backtested on train (70%) and out-of-sample (30%) |\r\n| **Select** | Keep the top 4 overall plus the best of each species; everyone else dies |\r\n| **Deploy** | Best train fitness among configs that pass the gate becomes the paper-trading leader |\r\n\r\n**Fitness:** `train return − 0.6 × max drawdown`, with a penalty below 4 trades.\r\n**Gate:** out-of-sample return > 1%, drawdown \u003C 10%, at least 3 trades, win rate ≥ 50%.\r\n\r\n### No peeking\r\n\r\n- Signals are computed on the **close of bar j** and executed at the **open of bar j + 1**. A test proves that changing a future candle cannot change a past signal.\r\n- Inside a bar, fills are processed **adverse-first**: grid fills, then stop, then take-profit.\r\n- Every fill and exit pays a **0.04%** fee. Open positions are marked out at the end of a test window.\r\n- The paper-trading panel replays the out-of-sample candles with the **same `GridBot` class** that the backtests use, so what you see is what was scored.\r\n\r\n## Honest results\r\n\r\nA sample of runs after 50 generations on the bundled data (train 2026-06-23 → 08-23, out-of-sample 08-23 → 09-22):\r\n\r\n| Seed | Leader species | Train return \u002F DD | Out-of-sample return \u002F DD | OOS trades | Buy & hold (same 30 days) |\r\n| --- | --- | --- | --- | --- | --- |\r\n| 2026 | Range grid | +28.8% \u002F 4.5% | **+8.4% \u002F 5.3%** | 5 | +11.4% \u002F 7.7% |\r\n| 7 | Vol breakout | +28.6% \u002F 4.3% | **+8.3% \u002F 7.7%** | 4 | +11.4% \u002F 7.7% |\r\n| 42 | Mean revert | +30.8% \u002F 2.9% | **+7.3% \u002F 3.9%** | 54 | +11.4% \u002F 7.7% |\r\n\r\nRead this before getting excited:\r\n\r\n- On this window **buy & hold made more money**. The evolved grids made less, with a smaller drawdown in two of three runs.\r\n- The out-of-sample window is 30 days with a handful of trades. That is a sanity check, not proof of an edge.\r\n- Picking the leader from configs that passed the gate reuses the out-of-sample data, so its numbers are optimistic.\r\n- High win rates come from wide stops that were never hit in this window. That is exactly the risk a grid carries.\r\n\r\nSETS MACHINE is a transparent research toy for watching evolutionary search work. It is **not** a trading bot to connect to real money.\r\n\r\n## Under the hood\r\n\r\n```text\r\nindex.html            Redirects to dist\u002F (for GitHub Pages)\r\ndist\u002F\r\n  index.html          Dashboard shell and controls\r\n  app.js              Controller: generation timeline, paper trading, UI state\r\n  style.css           Responsive blue-and-white interface\r\n  engine\u002F\r\n    series.js         Causal rolling mean \u002F deviation \u002F breakout high\r\n    bot.js            GridBot: signals, grid fills, TP, stop, fees, metrics\r\n    evolution.js      Genome, crossover, mutation, species quotas, gate\r\n    rng.js            Seeded randomness\r\n  ui\u002Fdraw.js          Canvas painters: logo, ring, fitness, gene pool, Kelly, chart\r\n  data\u002Fcandles.js     2 399 hourly BTCUSDT candles from Binance\r\n  assets\u002F             Fonts, logo, favicon\r\ntools\u002Ffetch_data.py   Refreshes dist\u002Fdata\u002Fcandles.js from Binance's public API\r\ntests\u002F                Node test runner: data, indicators, bot mechanics, GA\r\ndocs\u002F                 README images, GIFs and the promo video\r\n```\r\n\r\nBuilt with plain HTML, CSS and JavaScript modules on `\u003Ccanvas>`. No frameworks and no external requests at runtime.\r\n\r\n## Credits & licence\r\n\r\n- Market data: [Binance public market data API](https:\u002F\u002Fdevelopers.binance.com\u002Fdocs\u002Fbinance-spot-api-docs\u002Frest-api\u002Fmarket-data-endpoints), BTCUSDT 1h klines.\r\n- Fonts: [JetBrains Mono](https:\u002F\u002Fgithub.com\u002FJetBrains\u002FJetBrainsMono) and [Space Grotesk](https:\u002F\u002Fgithub.com\u002Ffloriankarsten\u002Fspace-grotesk), both under the SIL Open Font License 1.1.\r\n- Kelly criterion: J. L. Kelly Jr., *A New Interpretation of Information Rate* (1956).\r\n\r\nCode is MIT licensed, see [LICENSE](LICENSE). Test results are in [VALIDATION.md](VALIDATION.md).\r\n\r\n> **Not financial advice.** Paper trading on historical data only. No exchange connection, no keys, no real orders. Past performance, simulated or not, does not predict future results.\r\n",2,"2026-09-24 02:30:14","CREATED_QUERY"]