<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Kareliya Bhakti</title>
    <description>The latest articles on DEV Community by Kareliya Bhakti (@kareliya_bhakti_78f0fdb58).</description>
    <link>https://dev.to/kareliya_bhakti_78f0fdb58</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4207181%2Fc1d48f35-9d59-47d6-b020-2f7014066adf.jpg</url>
      <title>DEV Community: Kareliya Bhakti</title>
      <link>https://dev.to/kareliya_bhakti_78f0fdb58</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kareliya_bhakti_78f0fdb58"/>
    <language>en</language>
    <item>
      <title>On 21 Nov 2024 Adani fell 22.61%. My model didn't know why, and it wasn't allowed to guess.</title>
      <dc:creator>Kareliya Bhakti</dc:creator>
      <pubDate>Sun, 01 Nov 2026 06:30:33 +0000</pubDate>
      <link>https://dev.to/kareliya_bhakti_78f0fdb58/on-21-nov-2024-adani-fell-2261-my-model-didnt-know-why-and-it-wasnt-allowed-to-guess-ced</link>
      <guid>https://dev.to/kareliya_bhakti_78f0fdb58/on-21-nov-2024-adani-fell-2261-my-model-didnt-know-why-and-it-wasnt-allowed-to-guess-ced</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/hacktoberfest-week4-2026-10-26"&gt;Hacktoberfest Open-Source AI Challenge: Week 4: Ghost in the Machine&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;In our house, the stock market is dinner-table conversation. And after every truly ugly red day, I hear the same sentence:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;"Nobody could have seen that coming."&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I always wanted to ask: &lt;strong&gt;how&lt;/strong&gt; unexpected was it, really? Not "it fell a lot", but how far outside normal it was &lt;em&gt;for that stock&lt;/em&gt;, given everything it had done before.&lt;/p&gt;

&lt;p&gt;So I built something that answers exactly that question. It doesn't read the news. All it knows is a stock's own past.&lt;/p&gt;

&lt;p&gt;Then I pointed it at &lt;strong&gt;21 November 2024&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;That day, Adani Enterprises fell &lt;strong&gt;22.61%&lt;/strong&gt;. Going in, my model had studied 750 days of the stock's history and drawn the line for a truly terrible day at about &lt;strong&gt;−10%&lt;/strong&gt;. The real day went more than twice as far. The model couldn't say why. It could only say: &lt;em&gt;this day should not have been possible.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;That's a ghost. I built a machine to hunt them.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Ghost Candles&lt;/strong&gt; looks back through any Indian stock's history, finds the days its own past could not explain, and gives each one a ghost story.&lt;/p&gt;

&lt;p&gt;It has two AI models with very different jobs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The Oracle (&lt;a href="https://github.com/PriorLabs/TabPFN" rel="noopener noreferrer"&gt;TabPFN-3.5&lt;/a&gt;, running on my laptop):&lt;/strong&gt; for every trading day, it looks only at the days &lt;em&gt;before&lt;/em&gt; it and predicts a range of likely moves, like a weather forecast for a stock: &lt;em&gt;"98% sure tomorrow lands between −10% and +9%."&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The ghosts:&lt;/strong&gt; if the real move lands far outside that range, with odds of 1 in 100 or worse, the day becomes a &lt;strong&gt;Poltergeist&lt;/strong&gt;. If it breaks past the very edge of the forecast, it's a &lt;strong&gt;Wraith&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Medium (Google's Gemma, running locally through Ollama):&lt;/strong&gt; writes a short ghost story for each one. It gets the numbers and one unbreakable rule: &lt;em&gt;you do not know why this happened, so you may never give a reason.&lt;/em&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Everything ends up in one web page: a chart with glowing ghosts, a card and story for each, and an honesty check on the Oracle.&lt;/p&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Click a glowing dot and read its ghost:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Adani Enterprises:&lt;/strong&gt; &lt;a href="https://bhaktika.github.io/ghost-candles/out/ADANIENT_NS.html" rel="noopener noreferrer"&gt;https://bhaktika.github.io/ghost-candles/out/ADANIENT_NS.html&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reliance Industries:&lt;/strong&gt; &lt;a href="https://bhaktika.github.io/ghost-candles/out/RELIANCE_NS.html" rel="noopener noreferrer"&gt;https://bhaktika.github.io/ghost-candles/out/RELIANCE_NS.html&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fib8zhhx3qn352ud46h5n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fib8zhhx3qn352ud46h5n.png" alt="Ghost Candles journal for ADANIENT.NS: price chart with glowing dots marking the ghost days, including the 21 November 2024 crash" width="800" height="344"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  The night the Wraith walked
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbg19znb4f6upt9uh5zb0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbg19znb4f6upt9uh5zb0.png" alt="Wraith ghost card for 21 November 2024: Adani Enterprises fell 22.61% against TabPFN's 98% range of -9.92% to +8.98%, odds 1 in 1,000+, volume 19.8 times normal, with Gemma's ghost story" width="800" height="343"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;TabPFN expected 21 November 2024 to land somewhere between &lt;strong&gt;−9.92% and +8.98%&lt;/strong&gt;. It fell &lt;strong&gt;22.61%&lt;/strong&gt;, on &lt;strong&gt;19.8 times&lt;/strong&gt; the usual trading volume.&lt;/p&gt;

&lt;p&gt;I know what happened that day: the group's shares crashed after news that US prosecutors had charged its chairman. The model doesn't know that, and Gemma isn't allowed to guess. Ghost Candles doesn't explain the past. It points at the exact moment an explanation was needed.&lt;/p&gt;

&lt;p&gt;It happened with Reliance too, two nights in a row:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Monday, 3 June 2024: +5.59%&lt;/strong&gt;. TabPFN rated it 1 in 215.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tuesday, 4 June 2024: −7.49%&lt;/strong&gt;. TabPFN rated it 1 in 327.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Those are the exit-poll rally and the results-day crash of India's 2024 general election. The model has never heard of an election. It just knew both days were wrong.&lt;/p&gt;

&lt;p&gt;Here's a piece of what Gemma wrote for the Wraith:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;The candle, a fractured thing of obsidian, plummeted. The model, a pale imitation of prediction, shuddered with an impossibility.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The record: -22.61% on 2024-11-21, with a model's odds of approximately 1 in 1,000+ that the move would occur.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The story can be dramatic. "The record" line always states the plain facts.&lt;/p&gt;

&lt;h2&gt;
  
  
  The First Reader: Our Dinner Table
&lt;/h2&gt;

&lt;p&gt;I showed the live Adani page to the person at our dinner table who trades every day, the one who usually says &lt;em&gt;"nobody could have seen that coming."&lt;/em&gt; Here's what they told me (paraphrased):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;On 21 November 2024:&lt;/strong&gt; Of course they remembered it. Next to TabPFN's −9.92% to +8.98% range, the real −22.61% made them agree: the model was right to call it impossible. The catch: a seasoned quant would shrug, because ranges built from history always break in a panic.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;On the quiet 23 July 2026 ghost:&lt;/strong&gt; Not impressed. Sleepy low-volume dips happen all the time in Indian markets; flag too many and people close the tab.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;On using it every week:&lt;/strong&gt; They wouldn't. If your stock falls 22%, you already watched it happen. Unless it warns you &lt;em&gt;before&lt;/em&gt;, it's a clever post-mortem.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All three are fair. The big ghosts are where it earns its keep: it measures &lt;em&gt;how&lt;/em&gt; abnormal a day was, without hindsight, even though it can't say &lt;em&gt;why&lt;/em&gt;. Quiet ghosts need a higher bar, so the next version should require a minimum move or a volume spike. And yes, it's a post-mortem; I'm not claiming otherwise.&lt;/p&gt;

&lt;h2&gt;
  
  
  How I Built It
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Turning candles into a table
&lt;/h3&gt;

&lt;p&gt;TabPFN is built for tables, so each trading day becomes one row of 17 columns describing the stock &lt;em&gt;up to the night before&lt;/em&gt;: recent returns, how jumpy it had been, how busy trading was, how far it sat from its 50-day average, and so on. That "night before" rule matters most: if the model could see even a hint of the day it's predicting, nothing would look surprising, and there would be no ghosts.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Never letting it peek at the future
&lt;/h3&gt;

&lt;p&gt;The Oracle learns from the previous 750 trading days, forecasts the next 20, then slides forward: 34 rounds and 671 forecast days per stock, each one a forecast it could really have made at the time.&lt;/p&gt;

&lt;p&gt;TabPFN makes this cheap. It's pretrained on millions of made-up tables and learns a new table just by reading it, so there's no training and I didn't tune a single setting. With TabPFN-3.5-Fast it ran on my &lt;strong&gt;i3 laptop with no GPU&lt;/strong&gt;: about 11 minutes for Adani, 18 for Reliance.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. A range, not a single guess
&lt;/h3&gt;

&lt;p&gt;This one line is what the whole project stands on:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;quantiles&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;predict&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;X_test&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;output_type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;quantiles&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;quantiles&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;LEVELS&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Most models give one number: "tomorrow: +0.3%". You can't call a day &lt;em&gt;impossible&lt;/em&gt; without knowing what was &lt;em&gt;possible&lt;/em&gt;. TabPFN gives the whole spread, from the 0.1% worst case to the 99.9% best case. Where the real day landed in that spread becomes its odds.&lt;/p&gt;
&lt;h3&gt;
  
  
  4. Can the Oracle be trusted?
&lt;/h3&gt;

&lt;p&gt;A ghost detector is only as good as its sense of "normal". If its ranges are too narrow, everything looks haunted. So I compared TabPFN against the textbook shortcut almost everyone uses: assuming daily moves follow a bell curve.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkcylvybzfu6hbtmc585j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkcylvybzfu6hbtmc585j.png" alt="TabPFN's forecast band for ADANIENT.NS: a shaded 98% range for every day, with each day's actual return as a dot and the ghost days standing outside the band" width="799" height="293"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Adani Enterprises, 671 forecast days:&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;TabPFN&lt;/th&gt;
&lt;th&gt;Bell curve&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Ghosts flagged (pure luck would give about 7)&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;4&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;24&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Its "98% sure" range actually held&lt;/td&gt;
&lt;td&gt;99.0%&lt;/td&gt;
&lt;td&gt;95.1%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Overall forecast error (lower is better)&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;34.7&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;36.5&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Reliance Industries, 671 forecast days:&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;TabPFN&lt;/th&gt;
&lt;th&gt;Bell curve&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Ghosts flagged (pure luck would give about 7)&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;5&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;16&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Its "98% sure" range actually held&lt;/td&gt;
&lt;td&gt;98.4%&lt;/td&gt;
&lt;td&gt;96.4%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Overall forecast error (lower is better)&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;20.3&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;20.4&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;In plain words:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The bell curve panics.&lt;/strong&gt; On Adani it shouted "1 in 100!" 24 times, more than three times what luck alone would produce. Its "98% sure" range was really about 95% sure, so it's overconfident exactly where ghosts live.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;TabPFN stays calm, and is right to.&lt;/strong&gt; It flagged 4 and 5 ghosts, close to what an honest forecaster should.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It wins clearly on the wild stock and only barely on the calm one.&lt;/strong&gt; On Adani its overall error is about 5% lower. On Reliance it's essentially a tie.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It's slightly too careful.&lt;/strong&gt; Its ranges ran a little wide (99% instead of 98%), so it may miss a ghost rather than invent one. That's the right mistake.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It sees things the bell curve can't.&lt;/strong&gt; On 23 July 2026, Adani dipped 4.37% on a quiet day. The bell curve said 1 in 27; TabPFN, knowing how calm the stock had been, said 1 in 102. (My first reader wasn't convinced that kind of ghost matters. Fair.)&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  5. The storyteller needed a fact-checker
&lt;/h3&gt;

&lt;p&gt;My first storyteller, the tiny &lt;code&gt;gemma3:1b&lt;/code&gt;, never invented a reason, but it was terrible with numbers. It turned a +5.26% day into &lt;em&gt;"nearly eight percent"&lt;/em&gt; and a −10.65% crash into &lt;em&gt;"a single negative percentage point"&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;So before any story reaches the page, a small checker reads it and sends it back if it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;uses any number that wasn't in the facts it was given,&lt;/li&gt;
&lt;li&gt;spells a number out in words (which can't be checked),&lt;/li&gt;
&lt;li&gt;names a possible cause like earnings, an election or news,&lt;/li&gt;
&lt;li&gt;runs too long, or&lt;/li&gt;
&lt;li&gt;forgets the plain "The record:" line at the end.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Gemma gets three tries. If it still fails, the page shows a plain factual summary instead.&lt;/p&gt;

&lt;p&gt;Even with the bigger &lt;code&gt;gemma3:4b&lt;/code&gt;, the checker rejected &lt;strong&gt;12 of 17 drafts&lt;/strong&gt;. Many were just too long, but some were sneaky:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It &lt;strong&gt;invented share prices&lt;/strong&gt; ("the open price was 188.73, the close 199.33") that appear nowhere in its facts.&lt;/li&gt;
&lt;li&gt;Told not to write numbers as words, it turned &lt;em&gt;"8.6x normal volume"&lt;/em&gt; into &lt;em&gt;"eight hundred and sixty unseen hands"&lt;/em&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Gemma wrote 5 of the 9 stories; the other 4 are plain summaries. A boring true sentence beats a spooky false one.&lt;/p&gt;
&lt;h3&gt;
  
  
  6. The page
&lt;/h3&gt;

&lt;p&gt;The journal is one HTML file with no outside scripts, hosted free on GitHub Pages. I used an AI coding assistant to help write and debug the code; every run, number and story here comes from running it myself.&lt;/p&gt;
&lt;h2&gt;
  
  
  Why Does Open Innovation Matter?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;It's free to run, again and again.&lt;/strong&gt; Hundreds of model calls across my testing, with no API bill and no rate limits.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Your watchlist stays yours.&lt;/strong&gt; The stocks you look up say a lot about you. Here nothing leaves the laptop.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;I can open up every part.&lt;/strong&gt; TabPFN gives me its full range of outcomes. When the small Gemma got numbers wrong, I swapped in a bigger one with one flag and wrapped it in my own checker, and I can read every rejected draft.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It can't be switched off.&lt;/strong&gt; Both models are files on my disk, which felt right for a project about things that refuse to stay dead.&lt;/p&gt;
&lt;h2&gt;
  
  
  Who Could Use This, and How It Would Scale
&lt;/h2&gt;

&lt;p&gt;Under the ghost stories is a useful idea: a &lt;strong&gt;surprise score for every stock, measured against its own normal&lt;/strong&gt;. A 3% drop in a sleepy stock can mean more than 6% in a wild one, and a "top losers" list can't tell the difference. Investors could check which holdings did something truly abnormal; analysts could find the strange days first, then read the news for just those; surveillance teams look for exactly the shape of 21 November 2024, a huge unexpected move on heavy volume.&lt;/p&gt;

&lt;p&gt;My first reader is right that nobody opens a post-mortem weekly. The version worth building is a nightly scan: one forecast per stock ("was today a ghost?") across a watchlist or a whole exchange, with Gemma writing only for the few ghosts.&lt;/p&gt;

&lt;p&gt;What stands in the way: TabPFN-3.5's weights are non-commercial, so a paid product would need a commercial licence, and two stocks is far too little evidence.&lt;/p&gt;
&lt;h2&gt;
  
  
  What It Isn't
&lt;/h2&gt;

&lt;p&gt;Not a trading signal and not financial advice. It tells you a day &lt;em&gt;was&lt;/em&gt; strange, not that tomorrow will be. Moves past the forecast's edge show as "1 in 1,000+", not a precise number the model can't back up.&lt;/p&gt;
&lt;h2&gt;
  
  
  Code
&lt;/h2&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://assets.dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/BhaktiKa" rel="noopener noreferrer"&gt;
        BhaktiKa
      &lt;/a&gt; / &lt;a href="https://github.com/BhaktiKa/ghost-candles" rel="noopener noreferrer"&gt;
        ghost-candles
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;Ghost Candles&lt;/h1&gt;
&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Find the days a stock did something its own past said was nearly impossible, and let a local model tell their ghost stories.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Built for the DEV Hacktoberfest Open-Source AI Challenge, Week 4: &lt;em&gt;Ghost in the Machine&lt;/em&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The Oracle:&lt;/strong&gt; &lt;a href="https://github.com/PriorLabs/TabPFN" rel="noopener noreferrer"&gt;TabPFN-3.5&lt;/a&gt;, an open-weight tabular foundation model, runs locally. For every trading day it forecasts a full probability distribution of that day's return, using only data from before that day (walk-forward, refit every 20 days on the previous 750).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Ghosts:&lt;/strong&gt; any day whose actual move had odds of 1 in 100 or worse under the Oracle's forecast. Beyond the 0.1% / 99.9% quantiles it becomes a &lt;em&gt;Wraith&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Medium:&lt;/strong&gt; a local open-weight LLM (default Google Gemma &lt;code&gt;gemma3:4b&lt;/code&gt; via &lt;a href="https://ollama.com" rel="nofollow noopener noreferrer"&gt;Ollama&lt;/a&gt;) writes a short ghost story for each one. It only gets the numbers and is told it does &lt;strong&gt;not&lt;/strong&gt; know why the move happened, so it…&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/BhaktiKa/ghost-candles" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;Try it on any NSE or BSE stock:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python haunt.py TATAMOTORS.NS &lt;span class="nt"&gt;--version&lt;/span&gt; v3.5-fast
python renarrate.py out/TATAMOTORS_NS.json &lt;span class="nt"&gt;--llm&lt;/span&gt; gemma3:4b
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  Prize Categories
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Best Use of TabPFN:&lt;/strong&gt; TabPFN-3.5 is the Oracle. It runs locally in a no-peeking forecasting loop, its full range of outcomes decides what counts as a ghost, and it's tested honestly against a bell-curve baseline on two stocks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Best Use of Gemma:&lt;/strong&gt; Gemma runs locally via Ollama as the storyteller, inside a fact-check-and-retry loop that keeps its stories truthful.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>devchallenge</category>
      <category>hf26challenge</category>
      <category>ai</category>
      <category>machinelearning</category>
    </item>
  </channel>
</rss>
