hiekkalaatikko.pro · published updates · build 20260723a

All significant additions and fixes to the live simulator. Newest first.

Jul 27, 2026

  • Fix silent rate-limit failure in setup history backfill The weekly history backfill fetches candles in two back-to-back phases (market + setup) for the same ~40 cryptos — the setup phase started right after the market phase, so Bitfinex's candle endpoint rate limit (429) often hit the entire setup phase, silently returning empty data every week. fetch_candles now retries with a backoff delay after a 429 instead of giving up immediately.
  • Tighter stop-loss cap to limit worst-case losses The stop-loss cap (largest loss tolerated before a forced sell) was noticeably looser than the profit-take triggers — up to -9% (bull) / -8% (neutral) / -5.5% (bear), while profit-taking only ranges +1.2–5%. Caps were tightened (-7.0 / -6.5 / -5.0%), plus a new absolute -7.5% backstop that applies regardless of regime or learning-based tuning. All values are env-configurable.
  • Bear-freeze exception threshold made env-configurable BEAR_FREEZE_EXCEPTION_MIN_ADJUST (the threshold letting an exceptionally strong shadow-learned setup through the bear-market buy freeze) was hardcoded at 3.0. Made env-configurable, default loosened to 2.0. In practice only affects the Gemini-active buy path — the technical (non-Gemini) path can't pass through in bear regime regardless of this threshold, since its own mtf condition is unreachable (documented as a known limitation, not fixed here).
  • Wire Kelly/ATR shadow sizing into entry size (off by default) entry_diagnostics_shadow.py already computed a Kelly-expectancy and ATR-weighted buy size for every trade, but never used the result. New ENTRY_SIZE_KELLY_BLEND_WEIGHT/ENTRY_SIZE_ATR_BLEND_WEIGHT blends these into the real eur_amount — sizing winners bigger, losers smaller. Defaults to 0.0 (no effect) until the shadow data shows enough samples; the blend always preserves total capital deployed and never bypasses any entry gate.
  • Wire trained scikit-learn model into live scoring (flagged, off by default) setup_model.py's win-probability model (manage.py train_setup_model, BotState pk=5) was trained but completely disconnected from live decisions. SETUP_MODEL_LIVE_ENABLED=1 now wires it into scoring alongside condAdjust as a new modelAdjust term (modest weight, no effect if holdout AUC is too low). Off by default — the riskiest of today's four changes, requires training the model first. Also fixed a latent feature-schema bug: live analysis never had an emaSpreadPct key, so the model would always have received it blank without this fix.

Jul 26, 2026

  • Experimental scikit-learn model on top of setup history data Historical backfill (setup_historical_backfill.py) now also collects row-level feature samples alongside the bucketed stats, and a model can be trained on them (new manage.py train_setup_model / /api/admin/train-model/) to predict trade win probability. Offline training pipeline only for now — the model doesn't yet affect live buy/sell decisions.
  • Bigger automatic weekly history backfill The weekly background backfill now fetches 40 cryptos instead of 20, and 10,000 candles per crypto (~416 days, up from 5,000 ≈ 208 days) — more data for both shadow learning and the new scikit-learn model every week with no manual trigger needed.

Jul 23, 2026

  • Fixed candle-history fetch for 4+ letter cryptos Cryptos with a ticker other than 3 letters (e.g. AAVE, LINK) weren't fetching any candle, order-book, or trade history from Bitfinex at all — the API requires a colon form for these (tAAVE:USD). Fixed everywhere, including in Strategy Explorer.
  • Strategy Explorer now in the main navigation, and in English A new hamburger menu and share buttons at the top of every page (home, changelog, Strategy Explorer). An English version of Strategy Explorer was published (/strategy-explorer/en/), and the page is now discoverable by search engines.

Jul 22, 2026

  • New "Bot decisions" timeline The bot's most recent decisions (buys, sells, holds, watches, Gemini scans) now appear as their own larger, browsable timeline between Trade history and the Learning report — more transparent and informative than a plain trade list. The AI decisions panel now shows only the latest cycle's headline.
  • Five new shadow-tracking diagnostics in the learning report The learning report now shows three new "test data" cards: entry-time correlation and sizing diagnostics, a price-spike sanity check against the order book, and a rolling multi-day drawdown flag in the shadow policy. These collect data in the background — they don't affect real trades yet.
  • Gemini 3.5 Flash Lite as default model AI analysis and the learning narrative now use the gemini-3.5-flash-lite model (previously 2.5 Flash Lite).
  • Social share preview image, plus SEO title/description tuning Sharing the link on WhatsApp, Facebook, X and LinkedIn now shows a proper preview image (og:image). Also refined the home page and Changelog page titles/descriptions for search engines: the "Crypto Simulator" brand name now appears in the title, and descriptions include keywords like "paper trading".

Jul 20, 2026

  • Tax on the tax year's net result, not gross wins Tax was previously calculated per winning sale without netting the same year's losses. Tax is now calculated on net capital gains, with unused losses carried forward against the next 5 years' gains — the downloadable Excel tax report was fixed to match.
  • Exit reason categories: three new groups split out of “other” Bear cash-reserve trims, loser releases, and bad-setup exits now show up as their own categories in learning and reports instead of being lumped into “other” (previously the biggest losing group, 16% win rate).
  • Gemini confidence: hard block for losing levels A mildly losing confidence level previously only halved the buy size — now any negative expected value blocks the buy entirely instead of just slowing the loss.
  • Symbol memory: persistent net loss blocks new buys too The block previously only forced a fast exit on an existing position — the same threshold (score ≤ −2.0) now also blocks new buys until the symbol's net result turns positive.
  • Bear freeze: narrow exception for the best learned setup Shadow learning's best-found setup has specifically been in a bear regime (+3.19% / 1h), but the freeze blocked it entirely. Buys are now allowed when the learned signal is strongly positive.
  • Symbol memory: forced exits excluded from block/ranking calculation Bear cash-reserve trims, time-stops, and loser releases are portfolio risk management, not a signal about a symbol's quality — but they were still counted in the per-symbol win/loss memory, so a handful of cent-sized forced sells during a bear regime could brand an otherwise good symbol a chronic loser. These three categories are now excluded from the symbol memory's net and block calculation — tested against production data, the split sharpened noticeably in both directions (one symbol went from a hidden breakeven result to the memory's best performer).
  • Buys now blocked in neutral regime too when crowd is already long Buys have already been blocked in a bear regime when positioning data shows the crowd is already long (≥85%) — the data showed the same pattern just as clearly in the neutral regime (122 trades, net −€34.63), whereas the same setup has been profitable in a bull regime (156 trades, net +€33.68) and is therefore left untouched. The block now extends to the neutral regime without touching bull.

Jul 18, 2026

  • Fix: long hold blocks Gemini partial sells before trailing When ≥4 h + fade skips tier 1, tier1Taken is set immediately so Gemini cannot trim the position in that window.
  • Peak sell: long hold × partial profit-take ≥2 h + fading momentum → larger tier-1 take and remainder armed for trailing. ≥4 h + fade → skip tier 1 and trail the full position tightly.
  • Peak sell: earlier arm for long holds When a position is held ≥2–4 h and 1h change/flow fades, profit-take arms earlier and trailing tightens. Holdings also get trade flow on the exit path.
  • English pages: regime, satellite and changes cards Remaining learning-report cards and “changes since previous” lines are translated on /eng.
  • English pages: trade history and learning cards Gemini trade reasons and learning-report card lines are translated on /eng.
  • English pages: learning notes and Gemini narrative Finnish fragments in the learning chip are translated. Opening /eng backfills English fields on the existing Gemini narrative in the background.
  • English pages: trade reasons and Gemini narratives /eng fetches state with ?lang=en — reasons, AI reports and the learning report are localized. New Gemini signals and narratives are stored bilingually (reason_en / *_en).
  • English pages (/eng, /changelog) Home and changelog available in English; language switcher in the header and footers.
  • Profit strategy: bear freeze + rotation + symbol memory No new buys in a bear market (live: bear −€239 vs bull +€235). “Not in picks” rotation only when in profit and with a clear edge. Net-positive symbols are not blocked in symbol memory.

Jul 14, 2026

  • Empty portfolio idle-cash deploy When the portfolio is empty and cash is over 35%, the bot can buy the best ranked_buyable target even if the Gemini top pick is blocked. Score penalty (symbol memory) is eased — chronic losers and cooldown remain blocked.

Jul 12, 2026

  • Gemini pick filtering: micro fail-closed Picks and scan leaders use the same blocks_entry logic as live buys — without a microChecked check, a suggestion is not shown.
  • Changelog link in the homepage footer Clear “Changes and updates” link at the bottom of the page.
  • Changelog page (/muutokset) New page listing all published changes by date.
  • Learning roadmap script updated In sync with production metrics — shows which learning stages are complete.

Jul 11, 2026

  • Deploy C — setup learning in Gemini’s trading prompt Blocked setups, winners/losers, and pick_scorecard micro-buckets (book/flow/crowd).
  • Deploy B — microstructure in Gemini’s selection prompt Order book, trade flow, and crowd fields in market data; micro-blocked picks are filtered out.
  • Deploy A — shadow learning before Gemini Gemini sees the same condAdjust/condBlocked data as the engine; top_picks are filtered by volume and price.

Jul 7, 2026

  • Security hardening ALLOWED_HOSTS, SECRET_KEY checks, and rate limits on export endpoints.
  • Contact details in the header Email link instead of the bot URL.
  • CI fix GitHub Actions Django check works with the production SECRET_KEY setting.

Jul 6, 2026

  • GitHub Actions CI Automatic Django check and tests on every push.
  • Microstructure fail-closed Buys are not allowed without an order book check; tests and regression guards.
  • Bitfinex trade flow Aggressive buy/sell flow (1 min / 5 min) for entry scoring and setup keys.
  • Shadow portfolio for shadow policy More reliable comparison of live vs. simulated day policy.
  • Minimum volume €200k Higher liquidity threshold for new buys; order book depth blocks illiquid-trap buys.
  • Gemini narrative Retry every 10 minutes after API errors; race-condition fixes.
  • State management hardening Concurrent saves and recovery after price errors.

Jul 5, 2026

  • SEO and discoverability robots.txt, sitemap.xml, improved meta tags, llms.txt, Schema.org JSON-LD.
  • Bear defense Cutting losing rotation and trimming the cash reserve in a down market.
  • Microstructure in profit-taking Order book and shadow learning tighten peak sells on holdings.

Jun 16, 2026

  • Gemini narrative Improved handling of quota and retry errors.

Jun 15, 2026

  • Bull satellite Cash is split 65% core + 35% best momentum target without rotation in a bull market.
  • Position count by regime Bear/neutral max 2, rising max 3 cryptos at a time.

Jun 14, 2026

  • Regime foresight Transition phases (bull→bear etc.) affect rebalancing and profit-taking; chip in the UI.
  • Sell outcome learning Win/loss categories in the report and Gemini narrative.
  • Peak-sell learning Exit setups and giveback analysis after sells.
  • Gemini pick FIFO linking Pick_scorecard uses realized trade P/L instead of hypothetical.
  • 1 h change on the market list Top-15 pairs update every round.

Jun 13, 2026

  • Bitfinex microstructure Order book (spread, imbalance, depth) and long/short crowd signals for buys.
  • Shadow policy (day stop & profit lock) Collects counterfactual data without live impact; five-column UI panel.
  • Historical setup backfill 5000 candles, round-trip simulation for setup learning (30% weight).
  • Gemini narrative history Modal for browsing previous 6 h reports.

Jun 12, 2026

  • Learning report Rule-based panel + 6 h Gemini narrative in the background.
  • Gemini pick tracking Scorecard: how previous top_picks performed vs. skipped candidates.
  • Market learning backfill Historical candles for shadow learning; admin endpoint for Railway.
  • Health check /api/health/ DB, worker, and portfolio status for diagnostics.
  • Sentry Optional error tracking for production (SENTRY_DSN).
  • Tax display Taxes do not reduce the portfolio; year-by-year breakdown.
  • Trading fees at zero Bitfinex removed spot fees — rotation is free.

Jun 11, 2026

  • Learning report and Gemini narrative First version of the learning panel; new narrative every 6 hours.
  • Regime and setup learning Per-trade metadata, regime-specific tuning, bad setups blocked.
  • Symbol memory Repeat losers are blocked; winners are favored.
  • Win/loss breakdown Year/month/24 h panel of realized trades.
  • Max 5 positions Gemini and the engine support up to five cryptos.

Jun 10, 2026

  • Full-market shadow learning All pairs: condition → realized 1 h/4 h return; feeds ranking and Gemini.
  • Profit logic v2 ATR stops, regime filter, MTF confirmation, fee-aware rotation.
  • Profit-take trailing Wait after the peak and pullback sell (+3% rule).
  • Gemini cost savings Throttle, lighter model, and condensed prompt.

Jun 9, 2026

  • Crypto Simulator — first release Django + Railway + MySQL; Bitfinex prices, €1000 paper portfolio, 24/7 bot.
  • Gemini AI for trading Top picks, signals, allocations, and Finnish-language rationale.
  • Technical analysis RSI, EMA, momentum, stop-loss, stablecoin blocks.
  • Tax report and Excel export 30% tax on profits; trade history with dates.
  • Live UI Portfolio, markets, trade log, and bot status in real time.