<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Sebastien M. Laignel on Medium]]></title>
        <description><![CDATA[Stories by Sebastien M. Laignel on Medium]]></description>
        <link>https://medium.com/@sl_mar?source=rss-37df43070e7c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*EOZJbypl_QQjFK5lXlbsMA.jpeg</url>
            <title>Stories by Sebastien M. Laignel on Medium</title>
            <link>https://medium.com/@sl_mar?source=rss-37df43070e7c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 11:13:59 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sl_mar/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Building a full Quant Research Stack]]></title>
            <link>https://wire.insiderfinance.io/building-a-full-quant-research-stack-7cea9518eec1?source=rss-37df43070e7c------2</link>
            <guid isPermaLink="false">https://medium.com/p/7cea9518eec1</guid>
            <category><![CDATA[python-eodhd-apis]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[fintech]]></category>
            <dc:creator><![CDATA[Sebastien M. Laignel]]></dc:creator>
            <pubDate>Thu, 06 Nov 2025 16:01:55 GMT</pubDate>
            <atom:updated>2025-11-24T10:23:37.016Z</atom:updated>
            <content:encoded><![CDATA[<h3>Building a Full Quant Research Stack</h3><h4>What we can build with EODHD APIs</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J0oYFOufi7qNlMt2E3OxLA.png" /></figure><h4>Introduction</h4><p>Quantitative trading continues to evolve rapidly, with AI now deeply integrated into every layer of research and execution. From automating data ingestion to generating real-time trading insights, modern tools allow researchers to build powerful, end-to-end systems faster than ever before.</p><p>I’ve previously discussed the <em>MarketSense AI</em> framework, but the pace of evolution is accelerating. Today, coding assistants and AI-driven development tools dramatically shorten the path from idea to prototype.</p><p>However, as AI-assisted development accelerates, commercial differentiation becomes harder to sustain. For example, the first release of <em>Chat with Fundamentals</em> was quickly eclipsed by new integrations from providers like FMP and Morningstar through platforms such as Perplexity.AI. Similarly, <em>quantcoderFS</em> now faces fresh competition from <em>QuantConnect</em> and its MCP features, which leverage advanced LLMs like Claude Code for collaborative coding and strategy design.</p><p>Despite the shifting landscape, there remain under-explored opportunities in data architecture, research automation, and AI integration. This article introduces a new, full-stack quant research prototype built around the EODHD API suite. It outlines the development phase — deeper empirical validations and case studies will follow in later posts.</p><h4>Step 1. Choosing the data provider</h4><p>This decision is straightforward: as I’m affiliated with EODHD, I naturally use its APIs. But even from an objective standpoint, EODHD offers one of the most comprehensive collections of endpoints available, more than sufficient for large-scale quantitative analysis.</p><h4>Step 2. Design the ingestion pipeline</h4><p>The core data architecture relies on <strong>PostgreSQL</strong> combined with <strong>TimescaleDB</strong>, forming a robust and scalable backbone for financial analytics.</p><ul><li><strong>PostgreSQL</strong> stores structured data — portfolios, metadata, and reference information.</li><li><strong>TimescaleDB</strong>, as a Postgres extension, handles high-frequency time-series data such as prices, intraday bars, and other timestamped records.</li></ul><p>TimescaleDB’s hypertables, continuous aggregates, and compression capabilities enable fast, SQL-compatible analytics across large historical datasets — essential for any quant research workflow. This hybrid approach delivers both flexibility and performance for complex, time-sensitive financial models.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zBBTdwqwGgXyGkiJnLp7gw.png" /></figure><h4>Step 3. Defining assets classes and designing EOD data viewer</h4><p>The application supports <strong>stocks, ETFs, and currencies</strong>, providing unified access to price histories, fundamentals, and related datasets.</p><p>The main dashboard integrates PostgreSQL and TimescaleDB to serve interactive analytics:</p><ul><li><strong>Candlestick charts</strong> with overlays such as SMA and Bollinger Bands.</li><li><strong>Insider transactions</strong>, dynamically updated from timestamped SQL queries.</li><li><strong>News and metrics</strong>, pulled from structured datasets for rapid retrieval.</li></ul><p>This cohesive dashboard architecture allows researchers to perform multi-source market analysis in real time. ETF and FOREX modules (in progress) add category and sector filters for targeted exploration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ABjcLJ7uHMosfdeq7LNdRA.png" /></figure><p>These views below present the ETF and FOREX analytics dashboard, still in development, enabling users to search, filter, and quickly access key details on popular exchange-traded funds by category or sector.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CbcbUKShoe3yxPwy7kPzug.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kbd5hFrXFD98fun50PNSbw.png" /></figure><p>On the stocks analysis module, the full range of fundamental metrics is accessible:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qGun84XCYqC4jNdMOijcew.png" /></figure><p>Sentiment analysis is alsoavailable :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UnUG4e3Mcp4rGxYWDTbf2g.png" /></figure><h4>Step 4. Implementing a MarketSense AI-like analysis</h4><p>The <strong>Agent Console</strong> coordinates multiple specialized AI agents that independently assess fundamentals, sentiment, price dynamics, and macroeconomic signals.</p><p>Each agent contributes a weighted score that combines into a final synthetic signal — for example, a high-confidence <em>HOLD</em> recommendation. The console logs all steps and reasoning for transparency.</p><blockquote><strong>Disclaimer:</strong> The generated signal has not been externally validated and should not be interpreted as financial advice or relied upon as a sole source for trading decisions.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vvnHwnY82FjgEMW4xWoAEg.png" /></figure><h4>Step 5. Comparing with peers</h4><p>The <strong>Peer Comparison Tool</strong> enables users to evaluate relative stock performance. For example, comparing NVIDIA (NVDA) and Microsoft (MSFT), the dashboard normalizes price movements to a base value of 100 — simplifying relative trend analysis across periods. Market caps and other context metrics are displayed alongside, providing clear performance benchmarking.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-imAvIHBXhzLfRR2J68mXg.png" /></figure><h4>Step 6. Analysing daily return</h4><p>This module visualizes the <strong>distribution of daily returns</strong> over the past three years, supporting statistical validation and volatility analysis of asset behavior.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CSEoWEN6GY71ByvG4Gp-HA.png" /></figure><h4>Step 7. Adding deep research function</h4><p><strong>GPT-Researcher</strong> is integrated as a tool for automated, comprehensive report generation — ideal for synthesizing multi-source information into readable insights.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-YHTaW5eeTRK08eX5jzcJA.png" /></figure><h4>Step 8. Analysing SEC filings</h4><p>A <strong>Retrieval-Augmented Generation (RAG)</strong> system extracts insights directly from SEC filings, combining vector search and language models to summarize company disclosures and risk factors efficiently.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*31VQoMWzvRf7boB1Exm2-w.png" /></figure><h4>Step 9. About pair-trading</h4><p>The <strong>Pair Trading Dashboard</strong> implements statistical arbitrage using cointegration and z-score mean reversion tests.</p><ul><li>Configurable tickers, time frames, and entry/exit thresholds.</li><li>Key analytics include cointegration status, hedge ratio, and z-score.</li><li>Backtesting outputs metrics such as win rate, total return, and Sharpe ratio.</li><li>Visualizations include price spreads, z-score dynamics, and trade histories.</li></ul><p>This view enables rapid evaluation of systematic pair-trading strategies.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*piS8j1AwgJ_8jnasKpeE9Q.png" /></figure><h4>Step 10. Adding macro-indicators</h4><p>The <strong>Macro Indicators Module</strong> compares global financial conditions — for instance, 10-year government bond yields and short-term rates across countries. These trend comparisons help contextualize monetary policy, risk sentiment, and regional market divergences.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l-F6aRqZPYEzPY0xYGWulg.png" /></figure><h4>Step 11. Portfolio analysis</h4><p>The <strong>Portfolio Optimization Module</strong> compares performance across strategies such as Equal Weight, Mean-Variance Optimization (MVO), Minimum Variance, and Black-Litterman.</p><p>The system supports:</p><ul><li>Growth trajectory comparisons.</li><li>Risk metrics: volatility, Sharpe ratio, and maximum drawdown.</li><li>Rolling Sharpe analysis over multiple time windows.</li><li>Monte Carlo simulations (1,000 runs) projecting potential portfolio paths over one year.</li></ul><p>This framework supports both diagnostic review and forward-looking risk modeling.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/979/1*JJCQOnzorHq2SHoO2hkzeA.png" /></figure><p>This screenshot displays rolling Sharpe ratio analysis for multiple portfolio optimization strategies over short (20-day) and medium (60-day) windows. The table summarizes risk-adjusted returns for Equal Weight, MVO, Min Variance, Black-Litterman, and the Actual Portfolio, highlighting notable differences in recent performance. The chart below tracks how the actual portfolio’s Sharpe ratio evolves over time, helping users visualize periods of heightened or diminished risk-adjusted returns for informed portfolio management.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/944/1*3SHDP3IQohRaeQWGldD35g.png" /></figure><p>This screenshot displays a Monte Carlo simulation for portfolio value over a one-year (252 day) horizon. The simulation runs 1,000 scenarios starting from an initial value of $10,000, with 100 sample paths visualized to illustrate the range of possible outcomes. The red lines indicate the 5th and 95th percentiles, providing insight into both the likely trajectory and extreme scenarios for portfolio growth or loss under stochastic assumptions. This tool helps quantify risk and evaluate the robustness of investment strategies against simulated market uncertainties.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/948/1*0JnAolOCQ8RPm7ZsY9_xQg.png" /></figure><h4>Step 12. Adding a screener</h4><p>A <strong>basic stock screener</strong> is under development — a foundation for filtering by valuation ratios, performance, or sentiment metrics.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fTDTGg-HLZ_na0NbkKE4_g.png" /></figure><h4>Step 13. Add a dynamic assistant to generate view by Chat (openBB inspired)</h4><p>An <strong>interactive chat assistant</strong>, inspired by OpenBB, allows users to generate new analytics views or visualizations conversationally — bridging natural language and structured data querying.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*17IgUpVPqIW2aUxtL-YH9w.png" /></figure><h4>Step 14. Extend the RAG to finance articles</h4><p>This in-progress feature expands the RAG pipeline to ingest and summarize financial media sources for real-time market intelligence.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mlYTNWCXudYUqkwDk1gYdw.png" /></figure><h4>Conclusion</h4><p>This full-stack quant research platform demonstrates how <strong>EODHD APIs</strong>, paired with <strong>TimescaleDB</strong> and <strong>AI-driven analytics</strong>, can deliver a scalable, agent-based environment for modern quantitative research.</p><p>The next stage will involve rigorous validation of analytics and performance benchmarks. But even at this stage, the framework already provides a strong foundation for automated research, backtesting, and data exploration. Its development will resume in February.</p><h4>References :</h4><ul><li><a href="https://eodhd.com/pricing?via=slmar">Free and paid plans for Historical Prices and Fundamental Financial Data API</a></li><li><a href="https://arxiv.org/abs/2502.00415">MarketSenseAI 2.0: Enhancing Stock Analysis through LLM Agents</a></li></ul><p>Happy coding.</p><p>S.M.Laignel</p><p>SL MAR</p><h4>A Message from InsiderFinance</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/301/0*QCVCC4NQvshiTPdI.png" /></figure><p>Thanks for being a part of our community! Before you go:</p><ul><li>👏 Clap for the story and follow the author 👉</li><li>📰 View more content in the <a href="https://wire.insiderfinance.io/">InsiderFinance Wire</a></li><li>📚 Take our <a href="https://learn.insiderfinance.io/p/mastering-the-flow">FREE Masterclass</a></li><li><strong>📈 Discover </strong><a href="https://insiderfinance.io/?utm_source=wire&amp;utm_medium=message"><strong>Powerful Trading Tools</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7cea9518eec1" width="1" height="1" alt=""><hr><p><a href="https://wire.insiderfinance.io/building-a-full-quant-research-stack-7cea9518eec1">Building a full Quant Research Stack</a> was originally published in <a href="https://wire.insiderfinance.io/">InsiderFinance Wire</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Build a Self-Hosted AI Automation Pipeline with Docker, n8n, Ollama, and Telegram]]></title>
            <link>https://aiadvances.org/how-to-build-a-self-hosted-ai-automation-pipeline-with-docker-n8n-ollama-and-telegram-65a411a8f161?source=rss-37df43070e7c------2</link>
            <guid isPermaLink="false">https://medium.com/p/65a411a8f161</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[ollama]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[localai]]></category>
            <dc:creator><![CDATA[Sebastien M. Laignel]]></dc:creator>
            <pubDate>Mon, 15 Sep 2025 11:13:24 GMT</pubDate>
            <atom:updated>2025-11-10T10:54:03.054Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X6tx4SmFSl2tAVB-eQRiPA.png" /><figcaption>A self-hosted AI with a public URL</figcaption></figure><p><strong><em>Last update : 10th November 2025 (Section 8 added — Testing local LLM with self-hosted chat application Katja)</em></strong></p><p>In my recent article, “<a href="https://medium.com/ai-advances/openai-on-your-desk-why-moving-to-local-models-ed81fb993aab">OpenAI on your desk: Why Move to Local Models</a>,” I explained the advantages of adopting <strong>local LLMs</strong> in proprietary workflows. Building on that, this article offers a practical guide to setting up an automation system powered by a local LLM on a GPU-equipped computer. For readers working with CPU-only machines or those who prefer to use a remote LLM provider API, the instructions include adaptations for those environments as well.</p><p>The core system is built on three Docker containers: <strong>n8n</strong> for workflow automation, <strong>Ollama</strong> for local large language model (LLM) serving, and <strong>ngrok</strong> for tunneling and providing public URL access. To demonstrate the end-to-end automation, a simple Telegram chat is set up to receive responses generated by the LLM running on the main computer. For this demonstration, the chosen model is a compact, specialized Slovene-language chat model downloaded from Hugging Face. While Telegram is used solely as an output feed in practical use cases — not for interactive dialogue — this guide includes a basic Telegram channel, accessible from a mobile phone, to showcase the full process end-to-end.</p><p>This guide is intended for readers with intermediate technical backgrounds, particularly those who are new to containerized deployments or workflow orchestration. The goal is to provide step-by-step instructions that not only describe how to build the system, but also explain the rationale behind each decision — helping readers avoid common pitfalls during the process.</p><h3>Table of Contents</h3><ol><li><strong>Introduction to Docker Containers and Commands</strong></li><li><strong>System Overview</strong></li><li><strong>Understanding ngrok and Tunnelling</strong></li><li><strong>Preparing the environment</strong></li><li><strong>Setting the Containers<br> 5.1. Setting up Ollama<br> 5.2. Configuring a Static Domain and Tunnel with Ngrok<br> 5.3. Setting up n8n</strong></li><li><strong>Testing a Minimal Workflow<br> 6.1. Connecting to the Telegram API<br> 6.2. Connecting the LLM to Ollama<br> 6.3. Setting up the LLM chain<br> 6.4. Configuring the output node</strong></li><li><strong>Using Notion as an alternative output</strong></li><li><strong>Testing local LLM with self-hosted chat application Katja</strong></li><li><strong>Manual Testing</strong></li><li><strong>Writing a Docker Compose File — Reboot Test</strong></li><li><strong>Configuring a Cloud LLM Instead of Ollama</strong></li><li><strong>Use Cases (and Next Articles Roadmap)<br> 10.1. Chat with Fundamentals (Revisited)<br> 10.2. QuantCoderFS (Revisited)<br> 10.3. Knowledge Extraction</strong></li></ol><p><strong>Conclusion</strong></p><p><strong>References</strong></p><h3>1. Introduction to Docker Containers and Commands</h3><p>A <strong>Docker container</strong> is a lightweight, standalone environment that packages an application together with all of its code, dependencies, and system tools. Containers ensure that software runs reliably and identically across different machines, eliminating the “it works on my machine” problem. Unlike virtual machines, containers share the host system’s kernel but remain isolated from one another for security and stability.</p><p>To use Docker, you typically work from the command line. Here are some basic commands:</p><ul><li>docker pull &lt;image&gt;: Download a container image, such as Ubuntu or ollama, from Docker Hub.</li><li>docker run &lt;image&gt;: Launch a new container using the specified image.</li><li>docker ps: List all currently running containers.</li><li>docker stop &lt;container_id&gt;: Stop a running container.</li><li>docker logs &lt;container_id&gt;: View the output logs from a container.</li></ul><p>These commands are the building blocks for launching and managing the n8n, Ollama, and ngrok containers in the setup described in this article.</p><h3>2. System Overview</h3><p>The architecture consists of three primary components, each encapsulated within a container:</p><ol><li><strong>Ollama</strong> — Provides a local inference server for large language models. It exposes an HTTP API on port 11434 that allows workflows to send prompts and receive generated text. GPU acceleration is supported, making it suitable for a laptop with a dedicated graphics card. To take an image, Ollama will serve as the ‘brain’ of the system.</li><li><strong>n8n</strong> — Serves as the workflow automation engine. It can be scheduled to execute tasks at defined intervals, query Ollama for results, and send these results to Telegram. <strong>n8n</strong> will expose port 5678 for its web interface and workflow API. To continue with the same image, n8n will serve as the ‘body’ of the system.</li><li><strong>Telegram</strong> — Serves as the output channel for the system. Unlike email or other messaging applications, Telegram provides a simple bot interface, immediate delivery, and support for text, images, and plots in a single chat stream. This makes it well suited for receiving automated analyses and insights in real time without the overhead of managing an inbox.</li><li><strong>ngrok</strong> — Required to connect n8n with Telegram when using webhooks. Because the system is self-hosted and runs on a private IP address, Telegram cannot access it directly. ngrok resolves this by creating a secure tunnel from the laptop to the internet and assigning a public HTTPS domain. By reserving a static domain, the webhook connection remains valid after system restarts.</li></ol><h3>3. Understanding ngrok and Tunnelling</h3><p><strong>Tunnelling </strong>is the process of creating a secure pathway from a local service running on a private network (such as localhost:5678) to a public address accessible over the internet. This is necessary when an external service, such as Telegram, needs to send events to your workflow engine.</p><p><strong>ngrok</strong> is a tunnelling agent. When installed and executed, it connects to the ngrok cloud service, which assigns a public HTTPS address (for example, https://abc123.ngrok-free.app). All requests sent to this address are forwarded through the secure tunnel to the local service running on the laptop.</p><h3>4. Preparing the Environment</h3><p>Before proceeding, ensure that the following prerequisites are satisfied:</p><ul><li>A computer equipped with a GPU (preferably NVIDIA for optimal Ollama support), or an access to a LLM provider API to replace Ollama inference by a suitable LLM node.</li><li>Docker and Docker Compose installed.</li><li>A Telegram bot token created using @BotFather.</li><li>An ngrok account</li></ul><h3>5. Setting the containers</h3><p>For demonstration purposes, I will build each of the 3 containers before writing the docker-compose file. As explained in the first paragraph, isolating key applications inside containers prevent conflicts, increase portability and scalability. However, to allow data exchange between these 3 applications it is required to attach them to a common network, called here <strong>projects_n8n-network,</strong></p><p>created by the following command :</p><pre>docker network create projects_n8n-network</pre><h4>5.1. <strong>Setting up Ollama</strong></h4><p>With the network defined, we can now create the Ollama container :</p><pre>docker run -d --name ollama \<br>  --network projects_n8n-network \<br>  --gpus all \<br>  -p 11434:11434 \<br>  -v /home/slmar/ollama_llm:/root/.ollama \<br>  ollama/ollama:latest</pre><p>This command launches Ollama, attaches it to the project’s Docker network, enables GPU acceleration (if available), and ensures all language models and configuration data are stored persistently in the ollama_llm Docker volume.</p><p><strong>Supported Models and the Modelfile Workflow</strong></p><p>Ollama supports only <strong>GGUF quantized models</strong>, a highly efficient format optimized for running large language models on local hardware. Official Ollama models can be pulled and used directly, but if you wish to use an external GGUF model (for example, one downloaded from Hugging Face or created yourself), you must provide a <strong>Modelfile</strong> — even if the file format already matches requirements. The Modelfile tells Ollama how to load and register the model internally.</p><blockquote><strong>Example: Registering a Custom Slovene Chat Model</strong></blockquote><blockquote>In this example, the file SambaLingo-Slovenian-Chat.Q2_K.gguf is stored in the local directory ~/ollama_llm:</blockquote><pre>slmar@slmar-Predator-PH16-72:~/ollama_llm$ ls<br>models                               Slovene_Q2<br>SambaLingo-Slovenian-Chat.Q2_K.gguf</pre><blockquote>The Slovene_Q2 file is the Modelfile. Its sole role is to map SambaLingo-Slovenian-Chat.Q2_K.gguf to Ollama’s internal stack, with contents like:</blockquote><pre>FROM /root/.ollama/SambaLingo-Slovenian-Chat.Q2_K.gguf</pre><blockquote><strong>Unified Procedure to Register Any LLM in Ollama</strong></blockquote><blockquote><strong>1. Download your GGUF model</strong> to the ~/ollama_llm directory.</blockquote><blockquote><strong>2. Create a Modelfile</strong> in the same folder, containing:</blockquote><pre>FROM /root/.ollama/your-model-file.gguf</pre><blockquote>You can add optional parameters (e.g., temperature) for customization.</blockquote><blockquote><strong>3. Register your model in the container:</strong></blockquote><pre>docker exec -it ollama ollama create &lt;model_alias&gt; -f /root/.ollama/&lt;Modelfile&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/801/1*25x_36vWuAo7bHthTxPIPw.png" /></figure><blockquote><strong>4. Verify model registration :</strong></blockquote><pre>docker exec -it ollama ollama list</pre><p>Once registered, the model becomes persistent and available under its alias in any Ollama workflow. This approach provides a consistent, repeatable way to add and manage both custom and external GGUF models.</p><p>With Ollama configured this way, a single model is registered — stored in the persistent host folder (~/ollama_llm) and linked inside the container. This setup ensures:</p><p>The model remains registered and visible in Ollama (as confirmed with ollama list).</p><p>All model data, Modelfiles, and configuration reside outside the container in ~/ollama_llm, so nothing is lost after a reboot, container removal, or upgrade.</p><p>After a system reboot or Docker restart, simply re-launch your Ollama container with the same volume mount. The model will be instantly available — no need to re-register or re-download. This gives a robust, production-friendly setup for serving local LLMs through Ollama.</p><h4>5.2. <strong>Configuring a Static Domain and Tunnel with Ngrok</strong></h4><p>Once registered in Ngrok, as free user you can create one single static domain :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Va8OL5qmlxI0JArcPWEb9w.png" /><figcaption>Domain creation in Ngrok</figcaption></figure><p>You need also to record you authentication token :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xBa3AvhCLalY6tVnTaZ1Xw.png" /><figcaption>Access to the authentication token in Ngrok</figcaption></figure><p>Once your url and token knows, you can define the 2 environment variables :</p><pre>export NGROK_AUTHTOKEN=&quot;your_ngrok_authtoken&quot;<br>export NGROK_DOMAIN=&quot;your_static_domain.ngrok-free.app&quot;</pre><p>and create the ngrok container :</p><pre>docker run -d --name ngrok \<br>  --network projects_n8n-network \<br>  -e NGROK_AUTHTOKEN=$NGROK_AUTHTOKEN \<br>  ngrok/ngrok \<br>  http --domain=$NGROK_DOMAIN n8n:5678</pre><blockquote>Important: The domain is publicly reachable, so <strong>anyone who obtains the URL can attempt to access your n8n instance</strong>. Although requests are routed to n8n’s login page, relying on the default credentials alone is not sufficient.</blockquote><blockquote><strong>Enable two-factor authentication (2FA) on your n8n account</strong> as a baseline safeguard.</blockquote><blockquote><strong>Add an ngrok traffic policy that requires OAuth sign-in (e.g., Google or GitHub)</strong> so every request is authenticated before it even reaches n8n, providing an extra layer of protection.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/395/1*z0BydslxhtgjLmo8L_fAig.png" /><figcaption>Activation of the traffic policy in Ngrok</figcaption></figure><p><a href="https://ngrok.com/docs/traffic-policy/examples/oauth-protection/?utm_campaign=2025_onboarding_nurture&amp;utm_medium=onboarding_4&amp;_hsenc=p2ANqtz-9Jdm9l4BmllDjCfXoRX355ssSCdA9jFlIN1QTCzTS7JDARbL0f_LmV0LLMBRw2hF3oBo-6dDYuFRYLq3mm7x3wRLnksw&amp;_hsmi=381901770&amp;utm_content=docs_traffic_policy_examples_explore_more&amp;utm_source=email#explore-more-and-fine-tune-with-traffic-policy">Using OAuth Traffic Policy on Endpoints | ngrok documentation</a></p><h4>5.3. Setting up n8n</h4><p>n8n is your workflow automation engine — responsible for connecting to Ollama for AI inference, managing tasks, and coordinating all automation logic.</p><p>To deploy n8n in Docker, use the following command:</p><pre>docker run -d --name n8n \<br>  --network &lt;your_docker_network&gt; \<br>  -p 5678:5678 \<br>  -v n8n_data:/home/node/.n8n \<br>  -e N8N_BASIC_AUTH_ACTIVE=true \<br>  -e N8N_BASIC_AUTH_USER=&lt;your_admin&gt; \<br>  -e N8N_BASIC_AUTH_PASSWORD=&lt;your_pw&gt; \<br>  -e NODE_FUNCTION_ALLOW_EXTERNAL=* \<br>  -e N8N_HOST=n8n \<br>  -e N8N_PORT=5678 \<br>  -e N8N_EDITOR_BASE_URL=https://&lt;your_ngrok_or_public_domain&gt; \<br>  -e WEBHOOK_URL=https://&lt;your_ngrok_or_public_domain&gt; \<br>  n8nio/n8n:latest</pre><p>This setup attaches n8n to the same Docker network as Ollama as explained above. All workflows and credentials are stored persistently in the ~/n8n_data directory. Automations and settings will therefore survive container restarts, upgrades, and host reboots, ensuring a reliable, production-ready environment.</p><h4>5.4. Conclusion</h4><p>If everything has gone smoothly, your system should now be running the following three containers:</p><pre>slmar@slmar-Predator-PH16-72:~$ docker ps<br>CONTAINER ID   IMAGE                  COMMAND                  CREATED          STATUS          PORTS                                             NAMES<br>6aceea75e882   n8nio/n8n:latest       &quot;tini -- /docker-ent…&quot;   3 seconds ago    Up 3 seconds    0.0.0.0:5678-&gt;5678/tcp, [::]:5678-&gt;5678/tcp       n8n<br>9a0a0d80af83   ngrok/ngrok            &quot;/nix/store/1qpvcjc0…&quot;   7 minutes ago    Up 7 minutes    4040/tcp                                          ngrok<br>687892fb03fd   ollama/ollama:latest   &quot;/bin/ollama serve&quot;      27 minutes ago   Up 27 minutes   0.0.0.0:11434-&gt;11434/tcp, [::]:11434-&gt;11434/tcp   ollama</pre><h3>6. Testing a minimal workflow</h3><p>Now it’s time to launch n8n and test the end-to-end workflow. Start by sending a message from your Telegram bot; this will act as the trigger for your automation. The workflow then routes the message through a basic LLM chain powered by Ollama and the Slovene_Q2 model. In this minimal example, a chat message sent from a mobile phone will trigger inference by the local Slovene language LLM, and the resulting reply will be delivered straight back to the same Telegram chat — demonstrating the entire process end-to-end.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/955/1*dnz4l-FIpp3nLIeaB37HAA.png" /><figcaption>Minimal test workflow of the LLM inference, communication channel and orchestration</figcaption></figure><h4>6.1. Connecting to the Telegram API</h4><p>The first step is to connect to the Telegram API using the authentication token generated by BotFather. This token uniquely identifies your bot and enables secure communication between n8n and your Telegram account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3n5AZrbrnLOEx3h3sU9jqA.png" /></figure><h4>6.2. Connecting the LLM to Ollama</h4><p>Once configured, your model should appear in the selection window of the Ollama node — ready to be integrated into your workflow. If everything is set up correctly, you’ll be able to select the model by its alias, confirming that Ollama is running and accessible for LLM-powered automation</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/423/1*lGp5dGb5MiPy_8PMddmJuw.png" /></figure><h4>6.3. Setting up the LLM chain</h4><p>To configure the LLM chain, the next step is to enter a system prompt as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/389/1*Bi2dW0E_-1aOQr8Axbjq5Q.png" /></figure><h4>6.4. Configuring the output node</h4><p>Configure the output node by specifying the destination chat ID and setting the message text to the LLM’s output :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BIU_zcQXwmVZrayMJJ48eg.png" /><figcaption>View of the output node with the 2 variables passed</figcaption></figure><h3>7. Using Notion as an Alternative Output</h3><p>Notion can serve as a structured alternative to Telegram for storing LLM-generated responses, particularly when building knowledge bases or maintaining research logs. It functions effectively as a lightweight database for organizing workflows — for example, tracking trading-related insights or automating daily summaries.</p><h4>Creating a Notion Integration</h4><ol><li>Navigate to <a href="https://www.notion.so/my-integrations">Notion Integrations</a></li></ol><p>2. Click <strong>“New integration”</strong> and assign a name (e.g., <em>n8n Automation</em>).</p><p>3. Copy the <strong>Internal Integration Secret</strong>, which serves as the API key for authentication.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k5Dylbu8DA0QkfMtCUvJbg.png" /><figcaption>Getting the Notion Internal Integration Secret in Notion</figcaption></figure><h4>Connecting n8n to Notion</h4><ol><li>In <strong>n8n</strong>, create new credentials for the Notion API.</li><li>Paste the Internal Integration Secret and verify the connection to confirm successful authentication.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A6gzMqpW28kXzyPprM8EeA.png" /><figcaption>Connecting Notion Account in Notion</figcaption></figure><h4>Sharing Notion Documents</h4><p>To grant n8n access to a specific Notion document or database:</p><ol><li>Open the desired page in Notion.</li><li>Click the <strong>three dots</strong> in the upper-right corner.</li><li>Choose your n8n integration from the available connections.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/266/1*Pu6m3SU7WJHviPMjSYAwmQ.png" /><figcaption>Sharing documents in Notion</figcaption></figure><h4>Using Notion Documents in n8n</h4><p>Once connected, you can automate various actions depending on your knowledge management structure. For instance, you can configure a workflow that creates a new database page each time a news summary is received.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/645/1*DOvrZ_VYTWQut7H6ban4WA.png" /><figcaption>Storing Financial News summary into Notion Database</figcaption></figure><p>Notion provides a structured and systematic environment for organizing information through databases, customizable properties, and interconnected pages. It supports advanced text formatting and embedded media, making it well-suited for comprehensive documentation and visually organized content.</p><h4>Example: Using a Notion Page for Daily Financial News</h4><p>By linking a Notion database to your n8n workflow, you can automatically log daily financial news, summaries, or analytics into structured pages — turning Notion into an evolving, searchable research archive.</p><h3>8. <strong>Testing local LLM with self-hosted chat application Katja</strong></h3><p>Alternatively, you can explore cutting-edge local LLMs using <a href="https://github.com/SL-Mar/Katja">my open-source application Katja (pronounced “Katia”)</a>. Initially developed for language learning, Katja now supports versatile chat and Q&amp;A in domains including general conversation, law, and medicine. The app is designed foremost for educational and research purposes, facilitating hands-on experimentation with advanced AI. While Katja offers robust legal and medical chat capabilities, it does not replace professional advice in these fields, and users should always consult qualified experts for critical decisions. System has 4 prompts specific to respectively language learning, general query, medical and legal chat. Prompts are centralized in one file and editable.</p><blockquote><strong>oss20b (GPT-OSS 20B)</strong></blockquote><blockquote>20B Mixture-of-Experts architecture, with ~3.6B active parameters per token.</blockquote><blockquote>Competitive reasoning in finance, law, and medical domains.</blockquote><blockquote>Fast, accurate, broad-domain knowledge; supports large context windows.</blockquote><blockquote>Runs on 11–14 GB VRAM with 4-bit quantization. However, I experienced several time-outs.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2iV-pKiH2SvSjn52OC1K9Q.png" /><figcaption>Testing OSS20B with Katja</figcaption></figure><blockquote><strong>Qwen2–7B</strong></blockquote><blockquote>Strong reasoning, multi-domain coverage, excellent multilingual support.</blockquote><blockquote>Well-suited for finance, law, medical Q&amp;A, and educational use cases.</blockquote><blockquote>Efficient deployment and lots of community integrations.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AVxdxwSh-N0bbsarnF3Hew.png" /><figcaption>Testing Qwen2–7B</figcaption></figure><blockquote><strong>Mistral-7B</strong></blockquote><blockquote>High accuracy for general tasks and domain-specific prompts.</blockquote><blockquote>Highly efficient, works well for finance, law, and multi-language learning.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xqL9JHo08Ww5DocgT9sXMA.png" /><figcaption>Testing Mistral-7B</figcaption></figure><blockquote><strong>Saul 7B is a pioneering open-source language model designed specifically for legal applications. </strong>Built on the robust Mistral-7B architecture, Saul 7B is trained with over 30 billion tokens of diverse legal text, making it exceptionally proficient in legal document comprehension, generation, and reasoning. The model has undergone both continued pretraining on curated public legal datasets from multiple jurisdictions and instruction fine-tuning using a mix of generic and legal instructions. This enables Saul 7B to excel in a wide range of legal tasks, from clause analysis and contract review to legal research assistance and conversational legal Q&amp;A. It stands out for its strong performance on legal benchmarks, outperforming many general-purpose models while remaining efficient for local deployment on consumer hardware.</blockquote><p><a href="https://arxiv.org/abs/2403.03883">SaulLM-7B: A pioneering Large Language Model for Law</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2Pe5fI4F5kN6b5lAJsu9Jg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*52rb6pytucGxKMCleHWGjA.png" /><figcaption>Testing Saul-7B</figcaption></figure><blockquote><strong>BioMistral-7B </strong>is likely the best available 7B model for delivering high-quality, focused medical guidance to ship officers preparing telemedical consultations or managing medical first aid. It combines accuracy, compliance awareness, and local deployment capability — making it especially suitable for “exam, report, don’t diagnose” workflow.</blockquote><p><a href="https://arxiv.org/abs/2402.10373">BioMistral: A Collection of Open-Source Pretrained Large Language Models for Medical Domains</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QAKLMXx7ThICtFFyXkzA7w.png" /><figcaption>Testing BioMistral-7B</figcaption></figure><p>Local LLMs require carefully crafted prompts tailored to the specific use case to deliver their best results. Katja features built-in prompt engineering tools, enabling users to design, test, and refine prompts directly within the application for optimal model performance across diverse scenarios.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CVOPN4BSdJzfiEdVT0d6fA.png" /></figure><h3>9. Manual testing</h3><p>It’s time to validate the workflow. The automation is now listening for incoming messages from the Telegram bot.</p><p>For example, sending a simple ‘Dober dan’ from your mobile device should trigger the LLM chain and return a replyin slovene — demonstrating that the system is functioning from end to end.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/955/1*dnz4l-FIpp3nLIeaB37HAA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iWZ1EBwN4uFt7w95mpQajw.jpeg" /><figcaption>View of the Slovene Chat in mobile phone</figcaption></figure><h3>10. Writing a Docker compose file — Reboot test</h3><p>When you reboot your machine, all running Docker containers are stopped, but your persistent data and configuration files remain intact thanks to volume mounts or bind mounts. To relaunch your stack, you’ll need to manually restart the three containers. For long-term convenience and reliability, it’s best to create a docker-compose.yml file to manage the entire setup. In your case, the configuration will look like this:</p><pre>services:<br>  ollama:<br>    image: ollama/ollama:latest<br>    container_name: ollama<br>    networks:<br>      - projects_n8n-network<br>    ports:<br>      - &quot;11434:11434&quot;<br>    volumes:<br>      - ~/ollama_llm:/root/.ollama<br>    restart: unless-stopped<br>    deploy:<br>      resources:<br>        reservations:<br>          devices:<br>            - driver: nvidia<br>              count: all<br>              capabilities: [gpu]<br>    environment:<br>      - NVIDIA_VISIBLE_DEVICES=all<br><br>  n8n:<br>    image: n8nio/n8n:latest<br>    container_name: n8n<br>    networks:<br>      - projects_n8n-network<br>    ports:<br>      - &quot;5678:5678&quot;<br>    volumes:<br>      - n8n_data:/home/node/.n8n<br>    environment:<br>      - N8N_BASIC_AUTH_ACTIVE=true<br>      - N8N_BASIC_AUTH_USER=&lt;your_admin&gt;<br>      - N8N_BASIC_AUTH_PASSWORD=&lt;your_pw&gt;<br>      - NODE_FUNCTION_ALLOW_EXTERNAL=*<br>      - N8N_HOST=n8n<br>      - N8N_PORT=5678<br>      - N8N_EDITOR_BASE_URL=https://&lt;your_ngrok_static_domain&gt;<br>      - WEBHOOK_URL=https://&lt;your_ngrok_static_domain&gt;<br>    restart: unless-stopped<br><br>  ngrok:<br>    image: ngrok/ngrok<br>    container_name: ngrok<br>    networks:<br>      - projects_n8n-network<br>    environment:<br>      - NGROK_AUTHTOKEN=&lt;your_ngrok_authtoken&gt;<br>    command: http --domain=&lt;your_ngrok_static_domain&gt; n8n:5678<br>    restart: unless-stopped<br><br>networks:<br>  projects_n8n-network:<br><br>volumes:<br>  n8n_data:</pre><p>This command will start all the services defined in your docker-compose.yml file in detached mode, ensuring your stack is fully operational with a single command :</p><pre>docker compose up -d</pre><p>After a reboot, it’s important to ensure all configurations are restored and services run cleanly. To prevent conflicts with leftover containers, consider running a cleanup script like this before restarting your stack:</p><pre># Stop and remove AI automation containers if they exist<br>for name in ollama n8n ngrok; do<br>  if [ &quot;$(docker ps -aq -f name=&quot;^${name}$&quot;)&quot; ]; then<br>    docker stop &quot;$name&quot;<br>    docker rm &quot;$name&quot;<br>  fi<br>done<br><br># Start up the full stack with Docker Compose<br><br>cd ~/projects || { echo &quot;projects folder not found&quot;; exit 1; }<br><br>docker compose up -d<br><br>echo &quot;n8n, ngrok and Ollama containers started.&quot;</pre><p>This approach explicitly stops and removes any existing service containers, ensuring a fresh environment every time the stack is launched — avoiding potential issues from stale or misconfigured containers</p><h3>11. Configuring a cloud LLM instead of Ollama</h3><p>For readers who do not want to use a local LLM, a OpenAI model can be used:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YRuTPkHDU0WRMKkmUX6cUw.png" /><figcaption>Workflow view with the Ollama node disconnected, replaced by OpenAI Chat Model</figcaption></figure><p>Configuration is straightforward: within the Basic LLM chain, the OpenAI Chat model requires only the selection of the desired model — in this case, <strong>GPT-3.5-Turbo</strong>. No additional setup is necessary beyond specifying the model in the configuration window</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*shAe4KD8hXflcdpuKg7fgg.png" /><figcaption>OpenAI credential validation with the Chat node on the background</figcaption></figure><h3>12. Use cases (and next articles roadmap)</h3><p>In the following subsection, I outline several potential use cases planned for development over the coming months.</p><h4>12.1. Chat with Fundamentals (revisited)</h4><p>n8n empowers the creation of sophisticated automation workflows across many domains. As illustrated by the following preliminary workflow, it enables seamless automation of fundamental financial analysis using data from <a href="https://eodhd.com/pricing?via=slmar">EODHD APIs</a>, and integrates this data pipeline with lead research, technical analysis, and dynamic chart generation. This orchestration is designed to transform raw financial and research data into actionable insights and visualizations. For those already familiar with my projects, this represents an n8n-based reimagining of the “<a href="https://quantcoderfs.substack.com/s/chat-with-fundamentals">Chat with Fundamentals</a>” workflows. This project has been now refactored into AlphaDesk (<a href="https://quantcoderfs.substack.com/p/marketsenseai-a-multi-agent-llm-framework">an EODHD APIs wrapper enhanced by agentic workflows inspired by MarketSenseAI approach of markets</a>).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AZDjokAagk_YEvtE88dqYA.png" /><figcaption>n8n-Chat with Fundamentals workflows at its preliminary stage of development</figcaption></figure><h4>12.2. QuantCoderFS (revisited)</h4><p>Another central focus of my development is automating the generation of trading algorithms directly from finance research papers through the open source application <a href="https://quantcoderfs.substack.com/s/release-notes">QuantCoderFS</a>. <a href="https://www.quantconnect.com/docs/v2/ai-assistance/mcp-server">QuantConnect’s recent release of the MCP (Model Context Protocol)</a> server marks a significant milestone in this area: the MCP server acts as a powerful bridge, allowing AI agents to manage projects, create and refine trading strategies, run backtests, optimize parameters, and deploy live trading algorithms seamlessly on the QuantConnect cloud platform through over 60 API endpoints. In my view, this capability represents a major leap forward — enabling flexible, scalable automation within ad hoc n8n workflows and making it possible to streamline quant research, strategy iteration, and deployment through an integrated, AI-driven process.</p><h4>12.3. Knowledge extraction</h4><p>n8n unlocks powerful knowledge extraction scenarios across research, education, and legal domains. Automated workflows can compile research reports by extracting insights from arXiv-style repositories, build code autotrainers leveraging trending GitHub projects and YouTube videos — with seamless slide generation — and implement interactive language teaching assistants. Advanced pipelines can run RAG-based extractions over high-quality management corpora, while legal research chatbots integrate directly with APIs from projects like <a href="https://case.law/">Harvard Case Law</a> or <a href="https://www.legifrance.gouv.fr/">Legifrance</a>.</p><h3>Conclusion</h3><p>This guide has demonstrated how to construct a robust, fully self-hosted automation pipeline using n8n, Ollama, and Telegram — all orchestrated through Docker containers for portability and reliability. With detailed step-by-step instructions, readers are empowered to deploy local LLMs for real-time automated messaging and task orchestration, and to adapt the system for either GPU, or remote LLM scenarios. By covering everything from container setup and network tunneling to persistent workflow management and integration with messaging platforms, this article enables technologists to move beyond proprietary cloud LLM providers, gaining greater control, privacy, and flexibility over their automation infrastructure. As the landscape advances, further development around domain-specific workflows — ranging from algorithmic trading to legal knowledge extraction and instructional assistants — will enhance the value and capabilities of local, orchestrated AI solutions.</p><h3>References</h3><ul><li><a href="https://n8n.io/">n8n.io - AI workflow automation platform</a></li><li><a href="https://ollama.com/search">Ollama</a></li><li><a href="https://docs.docker.com/get-started/docker-concepts/the-basics/what-is-a-container/">What is a container?</a></li><li><a href="https://core.telegram.org/bots">Bots: An introduction for developers</a></li><li><a href="https://ngrok.com/docs">Overview | ngrok documentation</a></li><li><a href="https://github.com/SL-Mar/Katja">GitHub - SL-Mar/Katja: Multi-Mode AI Chat Platform with Specialized LLMs</a></li></ul><p>Happy coding and trading !</p><p>Best regards</p><p>S.M. Laignel</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=65a411a8f161" width="1" height="1" alt=""><hr><p><a href="https://aiadvances.org/how-to-build-a-self-hosted-ai-automation-pipeline-with-docker-n8n-ollama-and-telegram-65a411a8f161">How to Build a Self-Hosted AI Automation Pipeline with Docker, n8n, Ollama, and Telegram</a> was originally published in <a href="https://aiadvances.org/">AI Advances</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[OpenAI on your desk: Why Moving to Local Models]]></title>
            <link>https://aiadvances.org/openai-on-your-desk-why-moving-to-local-models-ed81fb993aab?source=rss-37df43070e7c------2</link>
            <guid isPermaLink="false">https://medium.com/p/ed81fb993aab</guid>
            <category><![CDATA[llm-applications]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[openai]]></category>
            <dc:creator><![CDATA[Sebastien M. Laignel]]></dc:creator>
            <pubDate>Fri, 08 Aug 2025 13:08:55 GMT</pubDate>
            <atom:updated>2025-08-08T13:08:55.547Z</atom:updated>
            <content:encoded><![CDATA[<h4>How to Shift Projects in a Rapidly Evolving Environment</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JOJOZmGfC80IlAAnxOc8pQ.png" /><figcaption>GPT-5</figcaption></figure><h3>Introduction</h3><p>Artificial intelligence is moving fast, reshaping almost every quantitative and general-purpose field. For a solo entrepreneur, that speed means constantly reassessing the direction of projects. In data-heavy areas like algorithmic trading, new AI tools can speed up workflows and open new possibilities.</p><p>But simply wrapping a large language model (LLM) and adding an agentic workflow is no longer enough to stand out. What felt innovative a year ago can become outdated in months.</p><p>In this article, I look back at some of my recent projects — ones that have already lost their edge or are headed that way — and use them to outline the next phase of my work. I’ll also define what I see as three levels of AI development.</p><p>One note before diving in: in retail trading, my manual strategies have delivered solid double-digit returns by mid-year. That means I don’t need AI to perform well. Instead, I have the space to improve my tools at my own pace, explore new areas, and build more sustainable solutions.</p><h3>Past Projects and Their Natural Resolution</h3><h4>Chat with Fundamentals and AlphaDesk</h4><p>The <em>Chat with Fundamentals</em> project still plays a role in my workflow, especially when I’m making investment decisions based on fundamentals. But its commercial potential has dropped sharply. Services like <em>Perplexity.ai</em> now offer something similar for free, powered by FMP financial data. For most new users, my version wouldn’t offer a meaningful advantage.</p><p>That said, the evolution of <em>Chat with Fundamentals</em> into <em>AlphaDesk</em> still has value. <em>AlphaDesk</em> adds a proper interface for managing data files with full CRUD functions. What’s still missing is the integration of machine learning model training on OHLCV data — probably with XGBoost and LSTM. Building a solid dataset curation system is still one of the key requirements for any serious ML workflow, so this part of the project remains worth pursuing. I have also a top-tier data provider for this (affiliated link at the end of the article).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nH2LxPSPwzsMFj2G24zHVw.png" /><figcaption>Chat with Fundamentals — Fundamental analysis</figcaption></figure><h4>QuantCoderFS</h4><p>I started <em>QuantCoderFS</em> in late 2023 to extract value directly from academic papers. Since then, several “paper-to-code” tools have emerged, and LLMs have become much better at coding. With <em>GPT-5</em>, it’s entirely possible that a single, well-crafted prompt could outperform the fourth-generation model I originally used.</p><p>I could try plugging GPT-5 directly into the existing workflow, and it would be an interesting experiment. But I’ve decided to take a broader approach. I’m moving toward <em>n8n</em>, a self-hosted automation platform that’s fast, supports local deployment, and makes rapid prototyping easy. This move fits my bigger goal of keeping my systems autonomous and flexible.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oU2SkgH4lE1pektZtqsggg.png" /><figcaption>QuantCoderFS — From articles to code</figcaption></figure><h3>First Step: Choosing Hardware for a Local LLM</h3><p>There are plenty of good reasons to run LLMs locally. The biggest is that it’s now possible to train models tuned to specific needs. I see that as the <em>second level</em> of AI development.</p><p>The <em>first level</em> is embedding an LLM into an app — maybe with an agentic workflow — just to make something work. That’s how a lot of successful apps were built in the last couple of years, some of them making real money. But much of that success was down to branding and marketing, not technical edge.</p><p>The <em>second level</em> means picking a model that’s small enough for your tasks, training it on the right data, and running it locally or in the cloud. For local setups, performance comes down to the hardware you’re willing to invest in. Once you’ve done that, you can honestly say you own your AI — and your data.</p><p>I’ve ordered a new machine with an Intel i9 CPU and an NVIDIA RTX 4080 GPU. It’s arriving next week, and I’ll see what it can do.</p><h3>Second Step: Choosing the Local LLM</h3><p>With the hardware sorted, the next question is: what model should I run? The release of <em>OSS-20B</em> by OpenAI was the final push to make the switch, though I’d been thinking about it since <em>Mistral AI</em> started releasing their models.</p><p>The plan is to replace — or at least supplement — the <em>Chat with Fundamentals</em> workflow with something built in <em>n8n</em>. I think <em>n8n</em> workflow design is going to be the new “vibe-coding” and will probably take over from traditional prompt engineering.</p><p>One workflow will handle OHLCV data curation for machine learning research. Another will test whether <em>OSS-20B</em> or <em>Mistral AI Devstral</em> is enough to run the code-generation tasks in <em>QuantCoderFS</em>.</p><h3>Third Step: Starting with a Chat Interface</h3><p>I already have a GPT wrapper in my code library called <em>Katja</em>, originally for language learning. Here’s the core function that sets its “brain”:</p><pre>import os<br>from openai import OpenAI<br>from dotenv import load_dotenv<br>from pathlib import Path<br><br>def get_llm(flow: str, agent: str):<br>    # Load from ~/.katja/.env instead of current dir<br>    env_path = Path.home() / &quot;.katja&quot; / &quot;.env&quot;<br>    load_dotenv(dotenv_path=env_path)<br><br>    key = os.getenv(&quot;KATJA_KEY&quot;)<br>    model_name = os.getenv(&quot;MODEL_NAME&quot;, &quot;gpt-4o-mini&quot;)<br><br>    if not key:<br>        raise RuntimeError(f&quot;KATJA_KEY is not set. Expected it in {env_path}&quot;)<br><br>    client = OpenAI(api_key=key)<br><br>    def call(messages: list[dict]):<br>        response = client.chat.completions.create(<br>            model=model_name,<br>            messages=messages,<br>            temperature=0<br>        )<br>        return response.choices[0].message.content<br><br>    return call</pre><p>When I asked GPT-5 how to switch this to a local LLM with Ollama, it suggested two ways:</p><ol><li>Use the official ollama Python package, or</li><li>Use a requests call to Ollama’s REST API at <a href="http://localhost:11434/api/chat.">http://localhost:11434/api/chat.</a></li></ol><p>Here’s the refactored version, which lets me switch between OpenAI and Ollama with an environment variable:</p><pre>import os<br>from pathlib import Path<br>from dotenv import load_dotenv<br><br>def get_llm(flow: str, agent: str):<br>    # Load from ~/.katja/.env instead of current dir<br>    env_path = Path.home() / &quot;.katja&quot; / &quot;.env&quot;<br>    load_dotenv(dotenv_path=env_path)<br><br>    provider   = os.getenv(&quot;LLM_PROVIDER&quot;, &quot;openai&quot;).lower()  # &quot;openai&quot; or &quot;ollama&quot;<br>    model_name = os.getenv(&quot;MODEL_NAME&quot;, &quot;gpt-4o-mini&quot;)<br><br>    if provider == &quot;ollama&quot;:<br>        # pip install ollama<br>        import ollama<br><br>        # Optional: point to a remote/local daemon<br>        # export OLLAMA_HOST=http://localhost:11434<br>        # (the lib reads OLLAMA_HOST automatically)<br><br>        def call(messages: list[dict[str, str]]):<br>            # messages format is compatible: [{&quot;role&quot;:&quot;system|user|assistant&quot;,&quot;content&quot;:&quot;...&quot;}]<br>            res = ollama.chat(<br>                model=model_name,           # e.g. &quot;llama3.1:8b&quot;, &quot;qwen2:7b&quot;, etc.<br>                messages=messages,<br>                options={&quot;temperature&quot;: 0}  # mirrors your original temperature=0<br>            )<br>            return res[&quot;message&quot;][&quot;content&quot;]<br><br>        return call<br><br>    # --- OpenAI fallback ---<br>    from openai import OpenAI<br><br>    key = os.getenv(&quot;KATJA_KEY&quot;)<br>    if not key:<br>        raise RuntimeError(f&quot;KATJA_KEY is not set. Expected it in {env_path}&quot;)<br><br>    client = OpenAI(api_key=key)<br><br>    def call(messages: list[dict[str, str]]):<br>        response = client.chat.completions.create(<br>            model=model_name,<br>            messages=messages,<br>            temperature=0<br>        )<br>        return response.choices[0].message.content<br><br>    return call</pre><p>Once <em>Ollama</em> is installed and running, switching to a local model is just a matter of updating this one utility function.</p><h3>Next steps : Flow engineering (and MCP) is all you need</h3><p>The automation tool <em>n8n</em> is exactly what I’d been hoping for. In terms of architecture, it’s not far from what platforms like <em>MyShell</em> have been doing for years, but it’s visual and it supports the Model Context Protocol (MCP). This combination makes for a fast prototyping environment — based on JSON encapsulation — that can also scale into production. My time with <em>MyShell</em>, back when I was selling prompts on Promptbase, gave me a good foundation for working this way.</p><p>MCP solves a key problem with traditional API thinking in agentic workflows. Classic request–response setups assume static tools and predictable flows. AI agents don’t work like that — they reason, retry, log, and adapt as they go. Without MCP, you end up writing brittle, hard-coded logic to keep things moving.</p><p>With MCP, tools can call LLMs mid-execution, stream logs to the user, register or deregister on the fly, and handle retries and validation without breaking the flow. It’s a protocol between agents and tools, designed for real-time, dynamic interaction.</p><p>This means you can keep agents lightweight, let tools handle their own reasoning, save tokens, and get more precise logging and retries. In production, it looks like this: the agent gets a request, hands it to an MCP-enabled tool, the tool calls an LLM internally, and results come back while logs stream live. Failures trigger retries automatically.</p><p>It’s a protocol-first way of building AI systems — modular, composable, and built with observability in mind. And in algorithmic trading, the fact that <em>QuantConnect</em> now supports MCP is a big step forward.</p><h3>Conclusion: Building for Autonomy</h3><p>Moving from cloud-based LLMs to local models is more than a technical upgrade — it’s a shift in how I design and own my systems. The cloud still has its place, especially for tasks that need cutting-edge models or massive compute. But local models give me control over performance, costs, and data.</p><p>With the right hardware, carefully chosen models, and a workflow layer like <em>n8n</em> powered by MCP, I can build tools that are faster to iterate on, easier to integrate, and resilient to external changes. This isn’t about chasing every new AI release — it’s about creating a stable foundation I can adapt and grow on my own terms.</p><p>The next steps are clear: finish the hardware setup, train and test the first local workflows, and measure how far I can push local AI before the cloud becomes necessary again. From here, the goal is simple — build tools that last, regardless of how quickly the AI landscape shifts.</p><h4>References :</h4><ul><li><a href="https://eodhd.com/pricing?via=slmar">Free and paid plans for Historical Prices and Fundamental Financial Data API</a></li><li><a href="https://docs.nvidia.com/nim/large-language-models/latest/supported-models.html">Supported Models for NVIDIA NIM for LLMs - NVIDIA NIM for Large Language Models (LLMs)</a></li><li><a href="https://ollama.com/library/gpt-oss:20b">gpt-oss:20b</a></li><li><a href="https://n8n.io/">n8n.io - AI workflow automation platform</a></li><li><a href="https://www.quantconnect.com/announcements/19439/quantconnect-mcp-server/p1">QuantConnect MCP Server</a></li><li><a href="https://modelcontextprotocol.io/overview">Model Context Protocol - Model Context Protocol</a></li><li><a href="https://mistral.ai/news/devstral">Devstral | Mistral AI</a></li></ul><p>Happy coding and trading!</p><p>S.M.Laignel</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ed81fb993aab" width="1" height="1" alt=""><hr><p><a href="https://aiadvances.org/openai-on-your-desk-why-moving-to-local-models-ed81fb993aab">OpenAI on your desk: Why Moving to Local Models</a> was originally published in <a href="https://aiadvances.org/">AI Advances</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Quantum Computing Market View: Players, Growth, and Potential (May 2025)]]></title>
            <link>https://medium.com/coinmonks/quantum-computing-market-view-players-growth-and-potential-may-2025-15f58bb7ce29?source=rss-37df43070e7c------2</link>
            <guid isPermaLink="false">https://medium.com/p/15f58bb7ce29</guid>
            <category><![CDATA[quantum-computing]]></category>
            <dc:creator><![CDATA[Sebastien M. Laignel]]></dc:creator>
            <pubDate>Fri, 30 May 2025 07:30:58 GMT</pubDate>
            <atom:updated>2025-05-30T07:30:58.401Z</atom:updated>
            <content:encoded><![CDATA[<h4>Quantum computing is a generational technology opportunity, but the path to commercial scale is long and fraught with risk.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*X8oiIJ69ysoAi69D.png" /></figure><h3>Executive Summary</h3><p>The global quantum computing market is at a pivotal inflection point, transitioning from research-driven development to early-stage commercial deployment. Market size estimates for 2025 range from $1.2 billion to $1.85 billion, with forecasts for 2030 spanning $4.2 billion to $7.5 billion, reflecting compound annual growth rates (CAGR) between 20% and 35% depending on methodology and segment focus. The sector is characterized by a dual ecosystem of well-capitalized technology giants (IBM, Google, Microsoft, Amazon) and a dynamic landscape of startups and public quantum pure-plays (IonQ, Rigetti, D-Wave, Quantum Computing Inc.), with over 300 companies active globally. Investment momentum is fueled by unprecedented government and venture capital funding, but commercial revenue remains nascent, and valuations for pure-play stocks are widely considered to be in a speculative bubble. The market’s long-term potential is vast — spanning pharmaceuticals, finance, logistics, and cybersecurity — yet near-term risks include technical, regulatory, and competitive uncertainties, as well as a likely shakeout among smaller players. The investment thesis for 2025 is one of high growth potential offset by significant execution, adoption, and valuation risk (<a href="https://www.grandviewresearch.com/industry-analysis/quantum-computing-market">Grand View Research</a>, <a href="https://www.researchandmarkets.com/reports/5847512/quantum-computing-market-forecasts">Research and Markets</a>, <a href="https://www.globenewswire.com/news-release/2025/03/21/3046976/28124/en/Quantum-Technologies-Investment-Landscape-Report-2025-2045-with-Profiles-of-300-Companies-Across-the-Quantum-Technology-Landscape-Analysis-of-Start-ups-Tech-Giants-and-Public-priva.html">GlobeNewswire</a>, <a href="https://www.asapdrew.com/p/4-overvalued-quantum-computing-stocks-qubt-qbts-rgti-ionq-short-strategy-2025">ASAPDrew</a>).</p><h3>1. Macroeconomic &amp; Sector Trends</h3><h3>1.1 Market Size and Growth</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/542/0*Ruxz7vEekTMny1lo.png" /></figure><ul><li><strong>Growth Drivers:</strong></li><li><strong>Government Funding:</strong> Major initiatives (US National Quantum Initiative, EU Quantum Flagship, China’s quantum programs) are injecting billions into R&amp;D and commercialization (<a href="https://www.globenewswire.com/news-release/2025/03/21/3046976/28124/en/Quantum-Technologies-Investment-Landscape-Report-2025-2045-with-Profiles-of-300-Companies-Across-the-Quantum-Technology-Landscape-Analysis-of-Start-ups-Tech-Giants-and-Public-priva.html">GlobeNewswire</a>).</li><li><strong>Venture Capital:</strong> 2024 marked the first year global quantum investments surpassed $1 billion, with strong VC and corporate participation (<a href="https://www.globenewswire.com/news-release/2025/03/21/3046976/28124/en/Quantum-Technologies-Investment-Landscape-Report-2025-2045-with-Profiles-of-300-Companies-Across-the-Quantum-Technology-Landscape-Analysis-of-Start-ups-Tech-Giants-and-Public-priva.html">GlobeNewswire</a>).</li><li><strong>Corporate Partnerships:</strong> Tech giants and startups are forming alliances for hardware, software, and cloud-based quantum services (<a href="https://www.grandviewresearch.com/industry-analysis/quantum-computing-market">Grand View Research</a>).</li><li><strong>Sectoral Demand:</strong> Early adoption in pharmaceuticals (drug discovery), finance (risk analysis, portfolio optimization), logistics (route optimization), and cybersecurity (post-quantum cryptography) (<a href="https://www.moodys.com/web/en/us/insights/quantum/quantum-computings-six-most-important-trends-for-2025.html">Moody’s</a>).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/0*xUbF34cleOywzSY1.png" /></figure><h3>1.2 Industry Structure: Players and Ecosystem</h3><h4>Big Tech Leaders</h4><ul><li><strong>IBM:</strong> Leading in superconducting qubits, cloud-based quantum services, and ecosystem development.</li><li><strong>Google:</strong> Achieved “quantum supremacy” milestone, investing in gate-based quantum processors.</li><li><strong>Microsoft:</strong> Azure Quantum platform, partnerships with hardware startups, focus on topological qubits.</li><li><strong>Amazon:</strong> AWS Braket, providing access to multiple quantum hardware providers via cloud.</li></ul><h4>Public Pure-Play Companies</h4><ul><li><strong>IonQ:</strong> Trapped-ion quantum computers, first quantum pure-play to IPO, strong partnerships, real revenue but high valuation (<a href="https://www.asapdrew.com/p/4-overvalued-quantum-computing-stocks-qubt-qbts-rgti-ionq-short-strategy-2025">ASAPDrew</a>).</li><li><strong>Rigetti:</strong> Superconducting qubits, cloud access, lagging behind in scale and revenue.</li><li><strong>D-Wave:</strong> Quantum annealing, niche optimization focus, long R&amp;D history, limited commercial traction.</li><li><strong>Quantum Computing Inc. (QUBT):</strong> Photonic quantum computing, minimal revenue, highly speculative valuation.</li></ul><h4>Private Startups and Scaleups</h4><ul><li><strong>PsiQuantum, Xanadu, ColdQuanta, QuEra, Alice&amp;Bob:</strong> Advanced hardware approaches (photonic, neutral atom, superconducting, topological), significant VC funding, potential to leapfrog public peers upon technical breakthroughs (<a href="https://www.globenewswire.com/news-release/2025/03/21/3046976/28124/en/Quantum-Technologies-Investment-Landscape-Report-2025-2045-with-Profiles-of-300-Companies-Across-the-Quantum-Technology-Landscape-Analysis-of-Start-ups-Tech-Giants-and-Public-priva.html">GlobeNewswire</a>).</li></ul><h4>Ecosystem Overview</h4><ul><li><strong>Over 300 companies</strong> active globally, spanning hardware, software, cloud services, and consulting.</li><li><strong>Regional Hubs:</strong> US, UK, Germany, Canada, China, with innovation centers in London, New York, Toronto, Singapore (<a href="https://www.startus-insights.com/innovators-guide/quantum-computing-outlook/">StartUs Insights</a>).</li><li><strong>Employment:</strong> Over 1 million employed globally in quantum-related roles; 59,000+ new jobs added in 2024 (<a href="https://www.startus-insights.com/innovators-guide/quantum-computing-outlook/">StartUs Insights</a>).</li></ul><h3>1.3 Technology and Application Trends</h3><ul><li><strong>Hardware:</strong> Superconducting (IBM, Google, Rigetti), trapped ion (IonQ), photonic (PsiQuantum, Xanadu, QUBT), neutral atom (QuEra), topological (Microsoft, Alice&amp;Bob).</li><li><strong>Software:</strong> Quantum programming languages, simulators, and cloud APIs (Qiskit, Cirq, Orquestra, Xanadu’s PennyLane).</li><li><strong>Cloud Quantum Services:</strong> AWS Braket, Azure Quantum, IBM Quantum Experience, Alibaba Cloud.</li><li><strong>Key Applications:</strong> Drug discovery, financial modeling, logistics optimization, cryptography, materials science, machine learning acceleration (<a href="https://www.futuremarketinsights.com/reports/quantum-computing-market">Future Market Insights</a>).</li></ul><h3>2. Valuation &amp; Market Signals</h3><h3>2.1 Public Market Valuations</h3><ul><li><strong>Multiples:</strong> Pure-play quantum stocks trade at 100x–1,000x forward sales, vastly exceeding even high-growth SaaS or AI peers (<a href="https://www.asapdrew.com/p/4-overvalued-quantum-computing-stocks-qubt-qbts-rgti-ionq-short-strategy-2025">ASAPDrew</a>).</li><li><strong>Revenue Quality:</strong> Most revenue is from pilot projects, government grants, or R&amp;D contracts, not recurring commercial sales.</li><li><strong>Big Tech:</strong> Quantum is a small fraction of overall revenue for IBM, Google, Microsoft, Amazon, so quantum exposure is not material to their valuation.</li></ul><h3>2.2 Market Momentum &amp; Sentiment</h3><ul><li><strong>2024–2025 Quantum Bubble:</strong> Driven by Google’s “Willow” announcement and retail investor enthusiasm, quantum stocks soared, with some up 2,000%+ before a partial correction after critical remarks from industry leaders (<a href="https://www.asapdrew.com/p/4-overvalued-quantum-computing-stocks-qubt-qbts-rgti-ionq-short-strategy-2025">ASAPDrew</a>).</li><li><strong>Volatility:</strong> Quantum pure-plays exhibit extreme price swings, with 50%+ drawdowns not uncommon after negative news or macro tightening.</li><li><strong>Retail vs. Institutional:</strong> IonQ has attracted more institutional interest, but most quantum stocks are dominated by speculative retail flows.</li></ul><h3>2.3 M&amp;A and Funding Activity</h3><ul><li><strong>M&amp;A:</strong> Anticipated shakeout as larger tech firms acquire promising startups or as weaker public companies are delisted or acquired (<a href="https://www.asapdrew.com/p/4-overvalued-quantum-computing-stocks-qubt-qbts-rgti-ionq-short-strategy-2025">ASAPDrew</a>).</li><li><strong>VC Funding:</strong> Record levels in 2024, with over $1 billion invested globally; focus on hardware breakthroughs and vertical-specific software (<a href="https://www.globenewswire.com/news-release/2025/03/21/3046976/28124/en/Quantum-Technologies-Investment-Landscape-Report-2025-2045-with-Profiles-of-300-Companies-Across-the-Quantum-Technology-Landscape-Analysis-of-Start-ups-Tech-Giants-and-Public-priva.html">GlobeNewswire</a>).</li></ul><h3>2.4 Comparative Table: Quantum vs. Other Tech Bubbles</h3><p>SectorPeak P/S MultiplesRevenue RealityTime to CommercializationBubble OutcomeDot-Com (1999)50–100xMinimal5–10 yearsMassive shakeout3D Printing (2013)20–50xModest3–5 yearsCollapse, survivorsSPAC EVs (2021)20–100xPre-revenue5–10 yearsCollapseQuantum (2025)100–1,000xMinimal10–20 yearsUnfolding</p><h3>3. Risks &amp; Uncertainties</h3><h3>3.1 Technical and Commercialization Risks</h3><ul><li><strong>Hardware Scalability:</strong> No current platform has demonstrated error-corrected, large-scale quantum computing; timelines for “useful” quantum advantage remain 10–20 years out according to most experts (<a href="https://www.asapdrew.com/p/4-overvalued-quantum-computing-stocks-qubt-qbts-rgti-ionq-short-strategy-2025">ASAPDrew</a>).</li><li><strong>Software and Algorithms:</strong> Lack of robust, domain-specific quantum algorithms limits near-term adoption outside of research and pilot projects.</li><li><strong>Integration:</strong> Quantum-classical hybrid architectures are emerging, but integration with existing IT stacks is nascent (<a href="https://www.globenewswire.com/news-release/2025/04/09/3058195/28124/en/Quantum-Computing-Research-Report-2025-Market-to-Reach-7-48-Billion-by-2030-Hybrid-Quantum-Classical-Computing-Solutions-are-Meeting-Success-with-Early-Adopters-in-Key-Areas-Such-a.html">GlobeNewswire</a>).</li></ul><h3>3.2 Market and Valuation Risks</h3><ul><li><strong>Bubble Dynamics:</strong> Current valuations are disconnected from revenue reality; a macroeconomic shift (e.g., higher rates, liquidity tightening) could trigger a sharp correction (<a href="https://www.asapdrew.com/p/4-overvalued-quantum-computing-stocks-qubt-qbts-rgti-ionq-short-strategy-2025">ASAPDrew</a>).</li><li><strong>Shakeout Risk:</strong> Many startups and public pure-plays may not survive to profitability; consolidation is likely as the sector matures.</li><li><strong>Retail Speculation:</strong> Misinformation and hype (e.g., “quantum will replace AI GPUs soon”) drive unsustainable price levels.</li></ul><h3>3.3 Regulatory and Geopolitical Risks</h3><ul><li><strong>Export Controls:</strong> Quantum technology is increasingly seen as a strategic asset; US-China tensions could impact supply chains and talent flows (<a href="https://www.futuremarketinsights.com/reports/quantum-computing-market">Future Market Insights</a>).</li><li><strong>Standardization:</strong> Lack of industry standards for hardware, software, and security protocols could slow adoption</li><li><strong>Government Policy:</strong> Shifts in funding priorities or regulatory frameworks could impact the pace of commercialization.</li></ul><h3>3.4 Competitive Risks</h3><ul><li><strong>Big Tech Dominance:</strong> Google, IBM, Microsoft, and Amazon have resources to outpace smaller players, especially as quantum moves from R&amp;D to commercial deployment.</li><li><strong>Private Startups:</strong> Well-funded private companies (PsiQuantum, Xanadu) may leapfrog public peers if they achieve technical milestones.</li></ul><h3>4. Conclusion / Investment Takeaways</h3><h3>4.1 Investment Thesis</h3><ul><li><strong>Quantum computing is a generational technology opportunity, but the path to commercial scale is long and fraught with risk.</strong></li><li><strong>Big tech firms</strong> (IBM, Google, Microsoft, Amazon) offer diversified, lower-risk exposure to quantum, but quantum is not yet material to their financials.</li><li><strong>Public quantum pure-plays</strong> (IonQ, Rigetti, D-Wave, QUBT) are highly speculative, with valuations reflecting distant potential rather than near-term fundamentals.</li><li><strong>Private startups</strong> may offer the highest upside, but access is limited to venture investors and M&amp;A participants.</li></ul><h3>4.2 Key Takeaways</h3><ul><li><strong>Market Growth:</strong> Expect 20–35% CAGR through 2030, with the market reaching $4–7.5 billion by decade’s end (<a href="https://www.grandviewresearch.com/industry-analysis/quantum-computing-market">Grand View Research</a>, <a href="https://www.researchandmarkets.com/reports/5847512/quantum-computing-market-forecasts">Research and Markets</a>).</li><li><strong>Sector Leadership:</strong> Big tech will likely consolidate leadership as commercialization accelerates; most pure-plays will struggle to survive.</li><li><strong>Valuation Caution:</strong> Current market caps for pure-plays are not justified by revenue or near-term prospects; bubble risk is high.</li><li><strong>Adoption Timeline:</strong> Mainstream, large-scale quantum computing is likely 10–20 years away; near-term opportunities are in niche applications and hybrid quantum-classical solutions (<a href="https://www.globenewswire.com/news-release/2025/04/09/3058195/28124/en/Quantum-Computing-Research-Report-2025-Market-to-Reach-7-48-Billion-by-2030-Hybrid-Quantum-Classical-Computing-Solutions-are-Meeting-Success-with-Early-Adopters-in-Key-Areas-Such-a.html">GlobeNewswire</a>).</li><li><strong>Strategic Positioning:</strong> Investors seeking quantum exposure should prioritize diversified tech giants or consider venture/private equity routes for higher risk/reward.</li></ul><h3>4.3 Forecast</h3><ul><li><strong>Short-Term (2025–2027):</strong> Continued hype, volatility, and pilot deployments; likely shakeout among public pure-plays; increased M&amp;A.</li><li><strong>Medium-Term (2028–2030):</strong> Early commercial applications in finance, pharma, logistics; clearer winners among hardware and software platforms.</li><li><strong>Long-Term (2030+):</strong> Quantum computing becomes a foundational technology for select industries; mainstream adoption contingent on hardware breakthroughs and ecosystem maturation.</li></ul><h3>References</h3><ol><li>Grand View Research. <a href="https://www.grandviewresearch.com/industry-analysis/quantum-computing-market">Quantum Computing Market Analysis</a></li><li>Research and Markets. <a href="https://www.researchandmarkets.com/reports/5847512/quantum-computing-market-forecasts">Quantum Computing Market Forecasts 2025–2030</a></li><li>Business Research Insights. <a href="https://www.businessresearchinsights.com/market-reports/quantum-computing-market-119340">Quantum Computing Market Report</a></li><li>GlobeNewswire. <a href="https://www.globenewswire.com/news-release/2025/03/21/3046976/28124/en/Quantum-Technologies-Investment-Landscape-Report-2025-2045-with-Profiles-of-300-Companies-Across-the-Quantum-Technology-Landscape-Analysis-of-Start-ups-Tech-Giants-and-Public-priva.html">Quantum Technologies Investment Landscape Report 2025–2045</a></li><li>GlobeNewswire. <a href="https://www.globenewswire.com/news-release/2025/04/09/3058195/28124/en/Quantum-Computing-Research-Report-2025-Market-to-Reach-7-48-Billion-by-2030-Hybrid-Quantum-Classical-Computing-Solutions-are-Meeting-Success-with-Early-Adopters-in-Key-Areas-Such-a.html">Hybrid Quantum-Classical Solutions Gaining Traction</a></li><li>ASAPDrew. <a href="https://www.asapdrew.com/p/4-overvalued-quantum-computing-stocks-qubt-qbts-rgti-ionq-short-strategy-2025">Overvalued Quantum Computing Stocks (2025 Outlook)</a></li><li>StartUs Insights. <a href="https://www.startus-insights.com/innovators-guide/quantum-computing-outlook/">Quantum Computing Outlook 2025</a></li><li>Moody’s. <a href="https://www.moodys.com/web/en/us/insights/quantum/quantum-computings-six-most-important-trends-for-2025.html">Six Quantum Computing Trends for 2025</a></li><li>Future Market Insights. <a href="https://www.futuremarketinsights.com/reports/quantum-computing-market">Quantum Computing Market Report</a></li></ol><h4>Disclaimer</h4><p><em>This document is intended for informational and research purposes only. It does not constitute investment advice, a recommendation, or an offer to buy or sell any securities or financial instruments. The views expressed herein are based on publicly available data and sources believed to be reliable at the time of writing, but no warranty is made as to the accuracy or completeness of this information. Readers should conduct their own independent research and consult a qualified financial advisor before making any investment decisions. The author or publisher assumes no liability for any losses or damages arising from the use of this report.</em></p><p>S.M.L.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=15f58bb7ce29" width="1" height="1" alt=""><hr><p><a href="https://medium.com/coinmonks/quantum-computing-market-view-players-growth-and-potential-may-2025-15f58bb7ce29">Quantum Computing Market View: Players, Growth, and Potential (May 2025)</a> was originally published in <a href="https://medium.com/coinmonks">Coinmonks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Top Recent US IPOs in 2025: Winners, Valuations, and Sector Insights]]></title>
            <link>https://medium.com/thecapital/top-recent-us-ipos-in-2025-winners-valuations-and-sector-insights-eafea3a66fc9?source=rss-37df43070e7c------2</link>
            <guid isPermaLink="false">https://medium.com/p/eafea3a66fc9</guid>
            <category><![CDATA[ipo]]></category>
            <category><![CDATA[trading]]></category>
            <dc:creator><![CDATA[Sebastien M. Laignel]]></dc:creator>
            <pubDate>Thu, 22 May 2025 07:36:49 GMT</pubDate>
            <atom:updated>2025-05-22T07:36:49.841Z</atom:updated>
            <content:encoded><![CDATA[<h4>A Strategic Assessment of Upside Potential</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*loZcV4OQXxksME0y" /></figure><p>The US IPO market in 2025 has rebounded sharply, with 127 IPOs as of May 20 — a 71.6% increase over the same period in 2024. However, performance is highly polarized: a minority of new listings, such as Zhengye Biotechnology (ZYBT) and Mint Incorporation (MIMI), have delivered outsized returns (+125.8% and +36.8%, respectively), while many others have suffered steep losses. This bifurcation reflects a market that is increasingly selective, rewarding quality, profitability, and sectoral tailwinds, especially in life sciences, technology, and sponsor-backed deals. Investors are prioritizing robust fundamentals and clear growth trajectories amid ongoing macroeconomic, regulatory, and geopolitical uncertainties. The best upside potential lies in recent IPOs that combine strong financials, sector leadership, and favorable market positioning, but risks remain elevated due to volatility, regulatory shifts, and the possibility of abrupt market corrections. This report identifies the most promising recent IPOs and provides a structured analysis of the underlying drivers, valuation metrics, and risk factors shaping their outlook (<a href="https://stockanalysis.com/ipos/2025/">Stock Analysis, 2025</a>; <a href="https://www.ey.com/en_gl/insights/ipo/trends">EY, 2025</a>).</p><h3>Macroeconomic &amp; Sector Trends</h3><h3>1. IPO Market Recovery and Volume Surge</h3><ul><li><strong>IPO Volume:</strong> As of May 20, 2025, the US market has recorded 127 IPOs, a 71.6% YoY increase, signaling a robust rebound from the subdued activity of 2022–2023 (<a href="https://stockanalysis.com/ipos/2025/">Stock Analysis, 2025</a>).</li><li><strong>Sector Leadership:</strong> Life sciences and technology continue to dominate, with cross-border and sponsor-backed deals gaining momentum (<a href="https://www.ey.com/en_us/insights/assurance/ipo-market-in-2025">EY, 2025</a>).</li><li><strong>Private Equity Influence:</strong> PE-backed IPOs are expected to account for up to 40% of capital raised in 2025, up from a decade average of ~30% (<a href="https://natlawreview.com/article/outlook-us-private-equity-2025">NatLawReview, 2025</a>).</li></ul><h3>2. Economic Backdrop</h3><ul><li><strong>Interest Rates:</strong> The Fed’s rate cuts in late 2024 and early 2025 have lowered the cost of capital, improved risk appetite, and encouraged IPO activity (<a href="https://www.ey.com/en_us/insights/assurance/ipo-market-in-2025">EY, 2025</a>).</li><li><strong>Market Valuations:</strong> The S&amp;P 500 and NASDAQ have set multiple record highs, with trailing P/E ratios rebounding to 40.5x for NASDAQ by end-2024 (<a href="https://www.ey.com/en_us/insights/assurance/ipo-market-in-2025">EY, 2025</a>).</li><li><strong>Investor Sentiment:</strong> There is cautious optimism, with investors returning to equities as inflation moderates and economic growth stabilizes (<a href="https://www.cohnreznick.com/insights/optimism-uncertainty-road-ahead-investors-2025">CohnReznick, 2025</a>).</li></ul><h3>3. Regulatory and Policy Environment</h3><ul><li><strong>ESG and Disclosure:</strong> The SEC is finalizing enhanced ESG, cybersecurity, and human capital disclosure requirements, raising compliance costs but also providing more transparency for investors (<a href="https://regulatorycompliancenews.com/blog/navigating-the-evolving-landscape-regulatory-changes-in-the-us-ipo-market-in-2025/">Regulatory Compliance News, 2025</a>).</li><li><strong>Policy Uncertainty:</strong> Tariffs, tax policy, and regulatory shifts remain sources of volatility and could affect IPO windows (<a href="https://www.pwc.com/us/en/services/consulting/deals/library/ipo-market-faces-renewed-uncertainly.html">PwC, 2025</a>).</li></ul><h3>4. Sector-Specific Dynamics</h3><ul><li><strong>Life Sciences:</strong> Strong pipeline, favorable regulatory tailwinds, and high investor interest, but also high volatility and binary risks.</li><li><strong>Technology:</strong> Benefiting from digital transformation, AI, and cloud adoption; however, valuations are sensitive to interest rates and competitive threats.</li><li><strong>Financial Sponsors:</strong> PE-backed IPOs are perceived as higher quality due to operational rigor and focus on profitability (<a href="https://natlawreview.com/article/outlook-us-private-equity-2025">NatLawReview, 2025</a>).</li></ul><h3>Valuation &amp; Market Signals</h3><h3>1. IPO Performance Dispersion</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/508/1*erBrUm55aucz1_FKv-Z-XA.png" /><figcaption>A list of the last IPO — 20th May 2025 — <em>Source: </em><a href="https://stockanalysis.com/ipos/2025/"><em>Stock Analysis, 2025</em></a></figcaption></figure><ul><li><strong>Winners:</strong> ZYBT, MIMI, UFG, CEPO, ETOR have delivered strong upside, driven by sector leadership, growth visibility, and investor demand.</li><li><strong>Losers:</strong> INLIF, APUS, and other micro-caps have underperformed, highlighting the importance of selectivity.</li></ul><h3>2. Valuation Metrics</h3><ul><li><strong>P/E Ratios:</strong> Median P/E for IPOs in 2025 is ~21.5x, with sector outliers (e.g., tech and biotech) trading at higher multiples due to growth expectations (<a href="https://www.ipoplatform.com/main-board/pe-valuation">IPO Platform, 2025</a>).</li><li><strong>IPO Pricing:</strong> Many profitable companies have priced IPOs at a discount to peers, reflecting cautious sentiment and the need for strong post-IPO performance (<a href="https://www.ey.com/en_gl/insights/ipo/trends">EY, 2025</a>).</li><li><strong>Market Momentum:</strong> Median first-day returns in the US have risen by 3–5% YoY, but less than half of IPOs are currently above offer price, underscoring a bifurcated market (<a href="https://www.ey.com/en_gl/insights/ipo/trends">EY, 2025</a>).</li></ul><h3>3. Market Sentiment and Aftermarket Trends</h3><ul><li><strong>Selective Aftermarket:</strong> Investors are rewarding companies with clear profitability, sector tailwinds, and defensible business models. Speculative growth stories without fundamentals are being repriced downward (<a href="https://www.nasdaq.com/articles/what-happens-to-ipos-over-the-long-run-2021-04-15">Nasdaq, 2021</a>).</li><li><strong>Long-Term IPO Returns:</strong> Historically, only the top decile of IPOs deliver sustained outperformance; most underperform the broader market within three years (<a href="https://www.nasdaq.com/articles/what-happens-to-ipos-over-the-long-run-2021-04-15">Nasdaq, 2021</a>).</li></ul><h3>4. Comparative Analysis: Recent Top Performers</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1008/1*0fY_6hTR8hfV9V-oeu56vA.png" /><figcaption>Recent top performers</figcaption></figure><h3>Risks &amp; Uncertainties</h3><h3>1. Regulatory Risks</h3><ul><li><strong>SEC Disclosure:</strong> New ESG, cybersecurity, and human capital requirements increase compliance costs and scrutiny, potentially delaying IPOs or affecting valuations (<a href="https://regulatorycompliancenews.com/blog/navigating-the-evolving-landscape-regulatory-changes-in-the-us-ipo-market-in-2025/">Regulatory Compliance News, 2025</a>).</li><li><strong>Tariffs and Trade Policy:</strong> Ongoing uncertainty regarding tariffs and global trade can impact cross-border IPOs and multinational growth prospects (<a href="https://www.pwc.com/us/en/services/consulting/deals/library/ipo-market-faces-renewed-uncertainly.html">PwC, 2025</a>).</li></ul><h3>2. Market and Macroeconomic Risks</h3><ul><li><strong>Volatility:</strong> The VIX remains elevated above Q1 2025 lows, and any sharp correction in major indices could abruptly close the IPO window (<a href="https://www.ropesgray.com/en/insights/alerts/2025/04/us-pe-market-recap">Ropes &amp; Gray, 2025</a>).</li><li><strong>Interest Rate Sensitivity:</strong> While rate cuts have supported valuations, any reversal or inflation spike could pressure multiples, especially for growth stocks (<a href="https://www.ey.com/en_us/insights/assurance/ipo-market-in-2025">EY, 2025</a>).</li></ul><h3>3. Competitive and Execution Risks</h3><ul><li><strong>Sector Rotation:</strong> Rapid shifts in investor preference (e.g., from growth to value) can impact sector-specific IPOs.</li><li><strong>Post-IPO Execution:</strong> Companies must demonstrate operational excellence and deliver on growth/profitability promises to sustain valuations (<a href="https://www.ey.com/en_gl/insights/ipo/trends">EY, 2025</a>).</li></ul><h3>4. Long-Term Underperformance</h3><ul><li><strong>Historical Trends:</strong> Two-thirds of IPOs underperform the market after three years; only a small subset deliver sustained upside (<a href="https://www.nasdaq.com/articles/what-happens-to-ipos-over-the-long-run-2021-04-15">Nasdaq, 2021</a>).</li></ul><h3>Conclusion / Investment Takeaways</h3><h3>1. Investment Thesis: Where Is the Best Upside Potential?</h3><ul><li><strong>Selective Opportunity:</strong> The 2025 IPO market is characterized by a “winner-take-most” dynamic. Only a minority of recent IPOs have delivered significant upside, and these are concentrated in sectors with secular growth, strong fundamentals, and sponsor backing.</li><li><strong>Top Picks:</strong></li><li><strong>Zhengye Biotechnology (ZYBT):</strong> Exceptional post-IPO performance (+125.8%) reflects strong demand for biotech innovation, cross-border appeal, and robust pipeline. Upside remains if clinical milestones are met and US-China biotech flows remain open.</li><li><strong>Mint Incorporation (MIMI):</strong> With a +36.8% return, MIMI benefits from digital transformation and recurring revenue. Continued upside depends on execution and competitive differentiation.</li><li><strong>eToro Group Ltd. (ETOR):</strong> The fintech platform’s +21.7% return is underpinned by global scale and retail trading growth. Regulatory clarity and margin management are key to further gains.</li><li><strong>Cantor Equity Partners I (CEPO):</strong> PE-backed, with a +21.5% return, CEPO exemplifies the market’s preference for sponsor-backed, profitable listings.</li></ul><h3>2. Key Investment Criteria</h3><ul><li><strong>Profitability and Growth:</strong> Focus on companies with a clear path to profitability, strong EBITDA margins, and sector leadership.</li><li><strong>Sponsor-Backed IPOs:</strong> PE-backed listings offer greater operational discipline and are favored by institutional investors.</li><li><strong>Sector Tailwinds:</strong> Life sciences, technology, and fintech remain the most attractive, but require careful due diligence on pipeline, competitive landscape, and regulatory risks.</li><li><strong>Valuation Discipline:</strong> Avoid overpaying for speculative growth; prioritize companies with reasonable P/E and P/B multiples relative to sector peers.</li></ul><h3>3. Risks to Monitor</h3><ul><li><strong>Market Timing:</strong> The IPO window can close rapidly in response to macro shocks or policy changes.</li><li><strong>Regulatory Headwinds:</strong> Ongoing changes in disclosure requirements and ESG mandates can affect both costs and investor perception.</li><li><strong>Execution Risk:</strong> Post-IPO performance is highly dependent on management’s ability to deliver results and navigate a competitive landscape.</li></ul><h3>4. Forecast and Strategic Guidance</h3><ul><li><strong>Short-Term:</strong> Expect continued polarization in IPO performance. Investors should remain highly selective, focusing on recent outperformers with clear growth, profitability, and sectoral advantages.</li><li><strong>Medium-Term:</strong> As the IPO market normalizes and policy clarity improves, sponsor-backed and sector-leading IPOs will likely continue to outperform. However, long-term outperformance will be limited to a small subset of high-quality issuers.</li><li><strong>Actionable Takeaway:</strong> Allocate capital to recent IPOs with demonstrated post-offer momentum, robust fundamentals, and sectoral tailwinds, but maintain a disciplined approach to valuation and risk management.</li></ul><h3>References</h3><ul><li><a href="https://stockanalysis.com/ipos/2025/">Stock Analysis — All 2025 IPOs (so far)</a></li><li><a href="https://www.ey.com/en_gl/insights/ipo/trends">EY — Global IPO Trends Q1 2025</a></li><li><a href="https://www.ey.com/en_us/insights/assurance/ipo-market-in-2025">EY — IPO Market in 2025 | US</a></li><li><a href="https://natlawreview.com/article/outlook-us-private-equity-2025">NatLawReview — 2025 Private Equity Outlook: IPO Surge and Market Trends</a></li><li><a href="https://www.ropesgray.com/en/insights/alerts/2025/04/us-pe-market-recap">Ropes &amp; Gray — US Private Equity Market Recap — April 2025</a></li><li><a href="https://www.ipoplatform.com/main-board/pe-valuation">IPO Platform — PE Ratio Helps in IPO Valuation</a></li><li><a href="https://www.nasdaq.com/articles/what-happens-to-ipos-over-the-long-run-2021-04-15">Nasdaq — What Happens to IPOs Over the Long Run?</a></li><li><a href="https://regulatorycompliancenews.com/blog/navigating-the-evolving-landscape-regulatory-changes-in-the-us-ipo-market-in-2025/">Regulatory Compliance News — Navigating the Evolving Landscape: Regulatory Changes in the US IPO Market in 2025</a></li><li><a href="https://www.cohnreznick.com/insights/optimism-uncertainty-road-ahead-investors-2025">CohnReznick — Navigating 2025 for Investors: Tax Cuts, Regulatory Changes, and Market Dynamics</a></li><li><a href="https://www.pwc.com/us/en/services/consulting/deals/library/ipo-market-faces-renewed-uncertainly.html">PwC — IPO Market Faces Renewed Uncertainty</a></li><li><a href="https://www.renaissancecapital.com/review/3Q24USReview_Public.pdf">Renaissance Capital — 3Q24 US Review</a></li></ul><h4><strong>Disclaimer</strong></h4><p><em>This report is for informational purposes only and does not constitute investment advice or a recommendation to buy or sell any securities. All investments involve risk, including the risk of loss. The information provided is based on sources believed to be reliable, but its accuracy or completeness cannot be guaranteed. Past performance is not indicative of future results. Readers should conduct their own research or consult a qualified financial advisor before making any investment decisions.</em></p><p>Thanks for reading</p><p>S.M.L.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eafea3a66fc9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/thecapital/top-recent-us-ipos-in-2025-winners-valuations-and-sector-insights-eafea3a66fc9">Top Recent US IPOs in 2025: Winners, Valuations, and Sector Insights</a> was originally published in <a href="https://medium.com/thecapital">The Capital</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Practical Test of the Low-Volatility Anomaly in U.S. Equities (2020–2025)]]></title>
            <link>https://wire.insiderfinance.io/a-practical-test-of-the-low-volatility-anomaly-in-u-s-equities-2020-2025-8d9132a2194b?source=rss-37df43070e7c------2</link>
            <guid isPermaLink="false">https://medium.com/p/8d9132a2194b</guid>
            <category><![CDATA[quantconnect]]></category>
            <category><![CDATA[trading]]></category>
            <category><![CDATA[low-volatility]]></category>
            <dc:creator><![CDATA[Sebastien M. Laignel]]></dc:creator>
            <pubDate>Wed, 21 May 2025 14:43:15 GMT</pubDate>
            <atom:updated>2025-05-21T14:43:15.380Z</atom:updated>
            <content:encoded><![CDATA[<h4>Challenging the risk-return paradigm</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aWatcNhDY9mK1nsqZZmqgw.png" /><figcaption>GPT o4-mini-high</figcaption></figure><p>In this article, I examine whether low-volatility stocks can deliver returns comparable to — or even exceeding — those of the benchmark, but with significantly less risk. Using <a href="https://www.quantconnect.com/">QuantConnect</a>, I implement a systematic, monthly rebalanced strategy that selects the 30 least volatile equities from the 500 most liquid U.S. stocks. I use SPY as the benchmark for comparison.</p><p>The result?</p><ul><li>Improved Sharpe ratio compared to SPY</li><li>Reduced drawdowns and a smoother equity curve</li><li>Market-like returns with lower volatility</li></ul><p>This outcome challenges the traditional financial paradigm that higher returns require higher risk, and supports the anomaly first documented by Ang et al. (2006).</p><h3>1. Low Risk, Still Rewarded</h3><p>Classical financial theory posits that investors must accept higher risk to earn higher returns. However, empirical studies suggest the opposite: stocks with lower historical volatility tend to outperform on a <strong>risk-adjusted</strong> basis — and sometimes even in absolute terms.</p><blockquote><em>“Low volatility doesn’t mean low return — it means lower regret.”<br> — </em>Pim Van Vliet, PhD, portfolio manager</blockquote><p>This strategy investigates whether that effect holds in U.S. equities from 2020 to 2025, using a universe that mirrors the benchmark.</p><h3>2. Strategy Implementation: Systematic Volatility Selection</h3><ul><li><strong>Universe</strong>: Top 500 U.S. stocks by average daily dollar volume, filtered for price &gt; $5</li><li><strong>Signal</strong>: Annualized volatility computed from the trailing 3 months (60 trading days)</li><li><strong>Selection</strong>: Each month, select the 30 stocks with the lowest volatility</li><li><strong>Rebalancing</strong>: Monthly — executed on the first Monday at 10:00 AM</li><li><strong>Portfolio Construction</strong>: Equal-weighted allocation</li><li><strong>Risk Management</strong>: 5% trailing stop-loss per security and 10% drawdown cap at the portfolio level</li></ul><h3>3. Results (Backtest: 2020–2025)</h3><p>SPY serves as the benchmark, delivering an 88% return over the period, with a Sharpe ratio of 0.42 and a CAGR of 12.6%. Its maximum drawdown — during the COVID-19 crash — reached 33%.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4fN7JTmZJTDg5jXt.png" /><figcaption><strong>Buy and Hold SPY (2020–2025)</strong> — <em>Powered by QuantConnect</em></figcaption></figure><p>In contrast, the low-volatility strategy not only matched SPY’s total return, but did so with <strong>dramatically lower drawdowns (15%)</strong> and a Sharpe ratio of <strong>0.73</strong>. This confirms that <strong>risk-managed equity portfolios can outperform</strong> their benchmark with far greater stability.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XUledZXGPUDWvZft.png" /><figcaption><strong>Low volatility monthly selection strategy </strong>— <em>Powered by QuantConnect</em></figcaption></figure><p><a href="https://www.quantconnect.cloud/backtest/ea43d12e02bb8d3d6b69ba0233eb352f/?theme=darkly">The code can be checked here.</a></p><h3>4. Five Takeaways from the Volatility Strategy</h3><ol><li><strong>Lower risk can outperform</strong><br>High-volatility stocks tend to underperform, not just on a risk-adjusted basis, but often in raw returns as well.</li><li><strong>Simple metrics work</strong><br>Historical volatility is an intuitive and effective signal. No complex models or machine learning required.</li><li><strong>Concentration adds value</strong><br>A portfolio of just 30 names was sufficient to match — and improve upon — the benchmark.</li><li><strong>Timing matters</strong><br>Monthly rebalancing reduces turnover and noise compared to daily or weekly approaches.</li><li><strong>Drawdown control is critical</strong><br>A trailing stop-loss and portfolio-level cap helped preserve capital during market stress.</li></ol><h3>5. Strategy Code — Powered by QuantConnect</h3><p>Below is the simplified monthly selection logic:</p><pre><br>    def CoarseSelectionFunction(self, coarse):<br>        # Limit selection to once per month<br>        if (self.Time - self.last_selection_time).days &lt; 30:<br>            return Universe.Unchanged<br><br>        self.last_selection_time = self.Time<br><br>        # Filter for price &gt; $5 and high volume<br>        filtered = [x for x in coarse if x.HasFundamentalData and x.Price &gt; 5]<br>        sorted_by_volume = sorted(filtered, key=lambda x: x.Volume, reverse=True)[:500]<br>        symbols = [x.Symbol for x in sorted_by_volume]<br><br>        # 60-day historical volatility<br>        history = self.History(symbols, 60, Resolution.Daily)<br>        if history.empty:<br>            return []<br><br>        vol_dict = {}<br>        for symbol in symbols:<br>            if symbol not in history.index.levels[0]:<br>                continue<br>            close = history.loc[symbol][&#39;close&#39;]<br>            if len(close) &lt; 60:<br>                continue<br>            returns = close.pct_change().dropna()<br>            vol = returns.std() * np.sqrt(252)<br>            vol_dict[symbol] = vol<br><br>        # Select 30 lowest-volatility stocks<br>        sorted_vols = sorted(vol_dict.items(), key=lambda x: x[1])[:30]<br>        self.selected_symbols = [s[0] for s in sorted_vols]<br><br>        self.Debug(f&quot;{self.Time.date()} - Selected: {[str(s) for s in self.selected_symbols]}&quot;)<br>        return self.selected_symbols</pre><h3>Conclusion</h3><p>This practical test confirms that <strong>lower-risk stocks can deliver strong, market-like returns with materially better downside protection</strong>. While volatility-based investing may lack the narrative appeal of deep value or high momentum strategies, it offers a <strong>disciplined, empirically sound framework</strong> for long-term portfolio construction.</p><h3>References</h3><ul><li>Blitz, David C. &amp; van Vliet, Pim. (2007). “The Volatility Effect: Lower Risk without Lower Return.” ERIM Report Series Research in Management, ERS-2007–044-F&amp;A, Erasmus Research Institute of Management (ERIM), Erasmus University Rotterdam. <a href="https://papers.ssrn.com/sol3/papers.cfm?abstract_id=980865">https://papers.ssrn.com/sol3/papers.cfm?abstract_id=980865</a></li><li>Ang, Andrew and Hodrick, Robert J. and Xing, Yuhang and Zhang, Xiaoyan, The Cross-Section of Volatility and Expected Returns. Available at SSRN: <a href="https://ssrn.com/abstract=681343">https://ssrn.com/abstract=681343</a></li><li>Baker, Nardin L. and Haugen, Robert A., Low Risk Stocks Outperform within All Observable Markets of the World (April 27, 2012). Available at SSRN: <a href="https://ssrn.com/abstract=2055431">https://ssrn.com/abstract=2055431</a> or <a href="https://dx.doi.org/10.2139/ssrn.2055431">http://dx.doi.org/10.2139/ssrn.2055431</a></li><li>Blitz, David and van Vliet, Pim and Baltussen, Guido, The Volatility Effect Revisited (August 26, 2019). The Journal of Portfolio Management, 46(2). , Available at SSRN: <a href="https://ssrn.com/abstract=3442749">https://ssrn.com/abstract=3442749</a> or <a href="https://dx.doi.org/10.2139/ssrn.3442749">http://dx.doi.org/10.2139/ssrn.3442749</a></li></ul><p>Thanks for reading</p><p>S.M.L.</p><h4>A Message from InsiderFinance</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/301/0*10x5_2smmKq8oIlf.png" /></figure><p>Thanks for being a part of our community! Before you go:</p><ul><li>👏 Clap for the story and follow the author 👉</li><li>📰 View more content in the <a href="https://wire.insiderfinance.io/">InsiderFinance Wire</a></li><li>📚 Take our <a href="https://learn.insiderfinance.io/p/mastering-the-flow">FREE Masterclass</a></li><li><strong>📈 Discover </strong><a href="https://insiderfinance.io/?utm_source=wire&amp;utm_medium=message"><strong>Powerful Trading Tools</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8d9132a2194b" width="1" height="1" alt=""><hr><p><a href="https://wire.insiderfinance.io/a-practical-test-of-the-low-volatility-anomaly-in-u-s-equities-2020-2025-8d9132a2194b">A Practical Test of the Low-Volatility Anomaly in U.S. Equities (2020–2025)</a> was originally published in <a href="https://wire.insiderfinance.io/">InsiderFinance Wire</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Chat with Fundamentals v1.0]]></title>
            <link>https://wire.insiderfinance.io/chat-with-fundamentals-v1-0-87338174de6f?source=rss-37df43070e7c------2</link>
            <guid isPermaLink="false">https://medium.com/p/87338174de6f</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[trading]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[fundamental-analysis]]></category>
            <category><![CDATA[eodhd]]></category>
            <dc:creator><![CDATA[Sebastien M. Laignel]]></dc:creator>
            <pubDate>Tue, 29 Apr 2025 09:54:49 GMT</pubDate>
            <atom:updated>2025-04-29T13:42:22.461Z</atom:updated>
            <content:encoded><![CDATA[<h4>A Local-First, Open-Source application for Stock Fundamental Analysis</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Gn_mgkrmLD3x67MZ2Xg1TQ.png" /><figcaption>ChatGPT o4-mini</figcaption></figure><p><strong>Released: Tuesday, April 29, 2025</strong><br><strong>Author: SL Mar</strong></p><p><strong>Abstract.</strong> This article presents Chat with Fundamentals v1.0, an open-source, local-first application designed to facilitate equity research through large language models (LLMs) grounded in quantitative financial data. The platform integrates End-of-Day (EOD) market data, company fundamentals, and real-time news via EODHD APIs, and provides both natural language summaries and quantitative analytics modules. Key architectural components, data pipelines, and design philosophies are discussed in detail to equip practitioners with the necessary insights for deploying, extending, and critically evaluating the system.</p><h3>1. Introduction</h3><p>Equity research traditionally involves extensive manual effort: collecting historical price series, extracting fundamental ratios, parsing news events, and synthesizing insights into coherent narratives. Modern data providers and visualization tools have streamlined certain tasks, yet the synthesis process remains time-consuming and prone to cognitive biases. <strong>Chat with Fundamentals</strong> aims to address this gap by combining large language models (LLMs) with rigorously validated quantitative data.</p><p>This platform is released under the <strong>Apache 2.0 License</strong>, emphasizing transparency and extensibility. Crucially, it adheres to a <strong>local-first</strong> paradigm: all computations and data storage occur on the user’s machine, promoting privacy, auditability, and offline capability.</p><p>In the following sections, we provide a structured overview of the system: (1) core functionality and user workflows, (2) backend architecture and data validation, (3) quantitative analytics modules, (4) local-first design principles, (5) external dependencies and cost structures, and (6) concluding remarks on future work and research implications.</p><h3>2. Core Functionality and User Workflows</h3><p>At its foundation, Chat with Fundamentals operates as a single-query, one-shot chat interface. The user submits a natural language prompt, which is parsed to identify:</p><ol><li><strong>Target entity or ticker</strong> (e.g., ‘TSLA’).</li><li><strong>Desired data domains</strong> (e.g., price history, fundamental ratios, news coverage).</li><li><strong>Scope of analysis</strong> (e.g., comparative summaries, risk metrics, forward simulations).</li></ol><p>Upon parsing, the system retrieves the necessary datasets from <strong>EODHD APIs</strong> (historical OHLCV, financial news, company fundamentals). These data retrieval operations are managed by dedicated FastAPI routers, each implementing asynchronous HTTP requests, Pydantic-based validation, and structured error handling.</p><p>Once data ingestion is complete, the platform invokes an LLM to generate an <strong>executive summary</strong>. This summary synthesizes quantitative metrics (e.g., valuation multiples, growth rates), recent news events, and price action into a coherent narrative. No conversation history is maintained beyond this single interaction in the first version of this application.</p><h3>2.1 Example Workflows</h3><ul><li><strong>Single-Ticker Analysis (‘Is TSLA a good buy?’)</strong></li></ul><ol><li>Retrieve the last 100 days of OHLCV data for TSLA.</li><li>Fetch the latest fundamental metrics (e.g., P/E, debt-to-equity) and up to 20 recent news headlines.</li><li>LLM produces a concise summary addressing valuation, momentum, and sentiment.</li><li>Optional: Save raw JSON and CSV outputs for external review.</li><li>“Know More” interface grants access to interactive charts and simulations.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nH2LxPSPwzsMFj2G24zHVw.png" /><figcaption>Chat with Fundamentals — Single ticker analysis</figcaption></figure><ul><li><strong>Comparative Analysis (‘Compare TSLA and AMZN’)</strong></li></ul><ol><li>Parallel data retrieval for TSLA and AMZN.</li><li>LLM generates a side-by-side comparative narrative, discussing divergences in fundamentals, risk profiles, and recent performance.</li></ol><p>These workflows illustrate the platform’s emphasis on clarity, reproducibility, and user control over data inputs and analytic outputs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3Fgtwq_5bZecT1ojb6tbkg.png" /><figcaption>Chat with Fundamentals — Comparison between 2 tickers</figcaption></figure><h3>3. Backend Architecture and Data Validation</h3><p>The backend comprises multiple FastAPI routers, each responsible for a distinct data pipeline or analytic function. Two primary modules are described below.</p><h3>3.1 /quantanalyzer/eod Endpoint</h3><p>Defined in backend/routers/quantanalyzer.py, this endpoint serves historical OHLCV data:</p><pre>@router.get(&quot;/eod&quot;, response_model=EODResult)<br>async def get_eod_data(<br>    ticker: str = Query(...),<br>    limit: int = Query(100),<br>):<br>    url = (<br>        f&quot;https://eodhd.com/api/eod/{ticker}.US&quot;<br>        f&quot;?api_token={settings.eodhd_api_key}&quot;<br>        f&quot;&amp;fmt=json&amp;order=d&quot;<br>    )<br>    # Asynchronous fetch with httpx and structured error handling<br>    async with httpx.AsyncClient() as client:<br>        resp = await client.get(url)<br>        resp.raise_for_status()<br>        raw = resp.json()<br><br>    # Limit and reverse to chronological order<br>    rows = raw[:limit][::-1]<br>    # Pydantic validation into OLHCV models<br>    data = [OLHCV(**row) for row in rows]<br>    return EODResult(ticker=ticker, data=data).model_dump(by_alias=True)</pre><p><strong>Key characteristics:</strong></p><ul><li><strong>Asynchronous HTTP Requests</strong>: Utilizes httpx.AsyncClient for non-blocking I/O.</li><li><strong>Error Handling</strong>: Catches network, timeout, and HTTP status errors without exposing API tokens in logs.</li><li><strong>Data Validation</strong>: Transforms raw JSON into Pydantic models (OLHCV) to enforce type and field constraints.</li><li><strong>Chronological Ordering</strong>: Reverses descending API output to ascending time series.</li><li><strong>Camel-Case Aliases</strong>: Serializes field names to match React frontend expectations.</li></ul><h3>3.2 simulater.py Module</h3><p>This router (/equity prefix) provides statistical simulations and return analyses:</p><h4>3.2.1 Monte Carlo Simulation (/equity/simulate)</h4><pre>@router.get(&quot;/simulate&quot;)<br>async def simulate_equity(<br>    ticker: str = Query(...),<br>    horizon: int = Query(20, ge=5, le=60),<br>):<br>    # Fetch ~120 calendar days of close prices<br>    closes = await _fetch_close_series(ticker.upper(), 120)<br>    daily_rets = closes.pct_change().dropna()<br>    mu, sigma = daily_rets.mean(), daily_rets.std()<br>    # Generate 1,000 paths of future prices<br>    rng = np.random.default_rng()<br>    steps = rng.normal(mu, sigma, size=(1000, horizon))<br>    paths = closes.iloc[-1] * np.cumprod(1 + steps, axis=1)<br>    return {<br>        &quot;monte_carlo&quot;: {<br>            &quot;paths&quot;: paths.tolist(),<br>            &quot;percentiles&quot;: {<br>                &quot;p5&quot;: np.percentile(paths, 5, axis=0).tolist(),<br>                &quot;p50&quot;: np.percentile(paths, 50, axis=0).tolist(),<br>                &quot;p95&quot;: np.percentile(paths, 95, axis=0).tolist(),<br>            }<br>        }<br>    }</pre><ul><li><strong>Geometric Brownian Motion Approximation</strong>: Models price evolution via lognormal return increments.</li><li><strong>Vectorized Computation</strong>: Leverages NumPy for efficient random sampling and cumulative products.</li><li><strong>Dynamic Horizon</strong>: Accepts user-defined simulation lengths (5–60 trading days).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Izmtj7x8deY-8kUn85iTmQ.png" /><figcaption>Chat with Fundamentals — Monte Carlo simulation of forward equity curve</figcaption></figure><h4>3.2.2 Return Distribution and Beta Estimation (/equity/returns)</h4><pre>@router.get(&quot;/returns&quot;)<br>async def returns_analysis(ticker: str, years: int = Query(3), benchmark: str = Query(&quot;SPY&quot;)):<br>    ser_tic = await _fetch_close_series(ticker, years*365+30)<br>    ser_bmk = await _fetch_close_series(benchmark, years*365+30)<br>    ret_tic = ser_tic.pct_change().dropna()<br>    ret_bmk = ser_bmk.pct_change().dropna()<br>    # OLS regression for beta and alpha<br>    beta, alpha = np.polyfit(ret_bmk, ret_tic, 1)<br>    r2 = np.corrcoef(ret_bmk, ret_tic)[0,1]**2<br>    return {&quot;beta&quot;: beta, &quot;alpha&quot;: alpha, &quot;r2&quot;: r2}</pre><ul><li><strong>OLS Regression</strong>: Estimates systematic risk exposure (beta) and market-independent return (alpha).</li><li><strong>Coefficient of Determination (R²)</strong>: Quantifies explanatory power of the benchmark.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/935/1*KaDLIuAh4D6yhATklVMseg.png" /><figcaption>Chat with Fundamentals — Beta analysis</figcaption></figure><h4>3.2.3 Cumulative Returns Comparison (/equity/cumret)</h4><p>Rebases both series to 1.0 and computes multiplicative compounding:</p><pre>@router.get(&quot;/cumret&quot;)<br>async def cumulative_returns(ticker: str, years: int = 3, benchmark: str = &quot;SPY&quot;):<br>    s_tic = await _fetch_close_series(ticker, years*365+30)<br>    s_bmk = await _fetch_close_series(benchmark, years*365+30)<br>    df = pd.concat({&quot;tic&quot;: s_tic, &quot;bmk&quot;: s_bmk}, axis=1).dropna()<br>    cum = (df.pct_change().add(1).cumprod()).fillna(1)<br>    return cum.reset_index().to_dict(orient=&quot;records&quot;)</pre><ul><li><strong>Compound Returns</strong>: Facilitates direct performance comparison over multi-year horizons.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/952/1*iFg_vGNfmbJ7qtyMyDH-jw.png" /><figcaption>Chat with Fundamentals — Cumulative return against benchmark</figcaption></figure><p>Together, these modules form the base of a complete quantitative analytics suite that complements the LLM-generated narratives with data-driven visualizations and statistical insights.</p><h3>4. Local-First Design Philosophy</h3><p>The platform’s <strong>local-first</strong> orientation manifests in three principal aspects:</p><ol><li><strong>Data Sovereignty.</strong> All API keys, historical data caches, and analytic computations reside on the user’s machine, ensuring full control over data access and retention.</li><li><strong>Offline Capability.</strong> Once dependencies are installed, the system functions without persistent internet connectivity, subject to available local caches of historical data.</li><li><strong>Extensibility.</strong> Users may modify code, integrate alternative data sources, or fine-tune local LLM models (subject to licensing) without altering a central service.</li></ol><p>This philosophy reflects a broader trend in AI research: empowering individuals and small teams to own their data pipelines and risk management frameworks, rather than relying exclusively on proprietary cloud services.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qjoSN2OxzGBSVICbKVCDew.png" /><figcaption>Chat with Fundamentals — Log Console</figcaption></figure><h3>4.1 Deployment and Installation</h3><ul><li>A <strong>shell-based setup script</strong> automates environment creation, dependency installation (FastAPI, httpx, NumPy, pandas), and database initialization if required.</li><li>A <strong>desktop launcher</strong> script provides a user-friendly entry point to start the local server.</li><li><strong>Configuration</strong> is managed via environment variables (.env), including API keys and model preferences.</li></ul><p>By minimizing external dependencies and maintaining a modular codebase, Chat with Fundamentals facilitates reproducible research and secure deployment.</p><h3>5. External Service Dependencies and Cost Considerations</h3><h3>5.1 OpenAI LLM Usage</h3><p>The system currently supports multiple GPT-based models. A typical summary generated by the o1 model:</p><ul><li><strong>Token consumption</strong>: ~500 tokens (input + output)</li><li><strong>Cost</strong>: approximately $0.07 per summary</li></ul><h3>5.2 EODHD API Access</h3><p><strong>EODHD</strong> provides the quantitative data foundation:</p><ul><li><strong>Historical OHLCV Data</strong>: ~1 API call per ticker per day of history</li><li><strong>Fundamentals Data</strong>: 1 call per request</li><li><strong>Financial News</strong>: 1 call aggregates recent headlines</li></ul><p><strong>Subscription tiers</strong>:</p><ul><li><strong>Free Plan</strong>: 20 API calls per day</li><li><strong>Standard Plan</strong>: 100,000 calls per day, 1,000 calls per minute</li></ul><blockquote>Affiliate Disclosure<em>: I am affiliated with EODHD. Subscriptions via the following links support ongoing development of this platform at no additional cost:</em></blockquote><ul><li>Historical EOD API Subscription: <a href="https://eodhd.com/lp/historical-eod-api?via=slmar">https://eodhd.com/lp/historical-eod-api?via=slmar</a></li><li>Fundamentals Data API Subscription: <a href="https://eodhd.com/lp/fundamental-data-api?via=slmar">https://eodhd.com/lp/fundamental-data-api?via=slmar</a></li></ul><h3>5.3 Cost Optimization Strategies</h3><ul><li><strong>Batch Data Retrieval</strong>: Consolidate multiple tickers in single API calls where supported.</li><li><strong>Local Caching</strong>: Persist historical data locally to reduce repeated requests.</li><li><strong>Model Selection</strong>: Employ smaller or fine-tuned local models for routine summaries.</li></ul><p>Such measures ensure scalability for extended research scenarios, including multi-asset portfolio analysis or backtesting frameworks.</p><h3>6. Future Directions and Research Implications</h3><p>While Chat with Fundamentals v1.0 establishes a robust foundation, several development and research priorities have been identified:</p><ul><li><strong>Notion Integration for Executive Summaries:</strong> Implement an API connector to export structured AI-generated research summaries directly into Notion databases, facilitating collaborative editing and archival.</li><li><strong>Intraday and Real-Time Forecasting Module:</strong> Extend the platform to consume EODHD’s intraday and real-time data feeds, enabling short-horizon predictive models for intraday breakout detection.</li><li><strong>Completion of Core EOD Analytics Suite:</strong> Ensure full implementation of all quantitative analyses based on EOD data, including rolling Sharpe ratios, volatility cones, calendar heatmaps, autocorrelation functions, and underwater drawdown visualizations.</li><li><strong>Alphalens Integration for Factor Analysis:</strong> Incorporate the open-source Alphalens library into the workflow to evaluate factor returns, information coefficients, turnover metrics, and other alpha research diagnostics.</li></ul><p>From a research perspective, the open-source, local-first nature of the platform invites academic collaboration and reproducibility studies, aligning with emerging standards for transparent AI systems in quantitative finance. , the open-source, local-first nature of the platform invites academic collaboration and reproducibility studies, aligning with emerging standards for transparent AI systems in quantitative finance.</p><h3>7. Disclaimer</h3><p><strong>Chat with Fundamentals</strong> is intended as a <strong>research and decision-support tool</strong>. It does not constitute financial advice. Users must exercise their own judgment and perform independent due diligence. The platform’s outputs, both LLM-generated narratives and quantitative analytics, are subject to data quality and model limitations. All financial decisions remain the sole responsibility of the user.</p><h4>References :</h4><ol><li><strong>EODHD APIs</strong></li></ol><p><a href="https://eodhd.com/pricing?via=slmar">Free and paid plans for Historical Prices and Fundamental Financial Data API</a></p><p><strong>2. Technical documentation and release notes</strong></p><p><a href="https://quantcoderfs.substack.com/s/chat-with-fundamentals">Chat with Fundamentals | QuantCoderFS R&amp;D | SL Mar | Substack</a></p><p><strong>3. Source Code Repository</strong></p><p><a href="https://github.com/SL-Mar/chat-with-fundamentals">GitHub - SL-Mar/chat-with-fundamentals: AI-powered fundamental analysis and stock analytics</a></p><p>Thank for reading.</p><p>Best regards</p><p>S.M.Laignel</p><h4>A Message from InsiderFinance</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/301/0*10x5_2smmKq8oIlf.png" /></figure><p>Thanks for being a part of our community! Before you go:</p><ul><li>👏 Clap for the story and follow the author 👉</li><li>📰 View more content in the <a href="https://wire.insiderfinance.io/">InsiderFinance Wire</a></li><li>📚 Take our <a href="https://learn.insiderfinance.io/p/mastering-the-flow">FREE Masterclass</a></li><li><strong>📈 Discover </strong><a href="https://insiderfinance.io/?utm_source=wire&amp;utm_medium=message"><strong>Powerful Trading Tools</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=87338174de6f" width="1" height="1" alt=""><hr><p><a href="https://wire.insiderfinance.io/chat-with-fundamentals-v1-0-87338174de6f">Chat with Fundamentals v1.0</a> was originally published in <a href="https://wire.insiderfinance.io/">InsiderFinance Wire</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Full-Stack, Agent-Driven AI for Quantitative Finance]]></title>
            <link>https://aiadvances.org/quantcoder-fs-development-log-1b3b7e8c23de?source=rss-37df43070e7c------2</link>
            <guid isPermaLink="false">https://medium.com/p/1b3b7e8c23de</guid>
            <category><![CDATA[fintech]]></category>
            <category><![CDATA[trading]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[quantitative-finance]]></category>
            <dc:creator><![CDATA[Sebastien M. Laignel]]></dc:creator>
            <pubDate>Mon, 31 Mar 2025 07:15:48 GMT</pubDate>
            <atom:updated>2025-04-08T07:40:33.421Z</atom:updated>
            <content:encoded><![CDATA[<h4>The development log of QuantCoder FS</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BUBAclZ02SBxtxiTTf6VWw.png" /></figure><p><strong><em>By Sebastien M. Laignel</em></strong><br><strong><em>Update — April 8, 2025</em></strong><em><br>This is the final update to the QuantCoderFS development log on Medium.<br>All future updates, technical documentation, and workflow research are now published on Substack: </em><a href="https://quantcoderfs.substack.com/"><em>https://quantcoderfs.substack.com .</em></a></p><p>This article presents a detailed, behind-the-scenes account of building <strong>QuantCoderFS</strong>, a full-stack, agent-powered AI platform for quantitative finance. It covers the project’s development from inception through 8 April 2025, highlighting the architectural, algorithmic, and practical challenges encountered along the way.</p><p>Due to the volume and technical depth of the project, ongoing documentation and updates have outgrown the format of a single article. A dedicated Substack has been launched to host the complete development log and technical documentation moving forward:</p><p><a href="https://quantcoderfs.substack.com/">QuantCoderFS R&amp;D | SL Mar | Substack</a></p><p>The evolution of QuantCoderFS illustrates a range of engineering decisions — from architectural refactors and latency reduction to interface improvements and system modularization. Each update has aimed to improve performance, reproducibility, and long-term maintainability.</p><p>This article will be most valuable to:</p><ul><li><strong>Developers and AI Enthusiasts</strong> seeking real-world insights into operational challenges, including latency, model compatibility, and code refactoring — along with practical solutions.</li><li><strong>Finance Tech Practitioners</strong> exploring ways to automate or streamline their quantitative workflows through agent-based systems.</li><li><strong>Project Managers and Tech Leads</strong> interested in observing how modularization, repository organization, and iterative design principles are applied in a complex, cross-functional project.</li><li><strong>Me, the Developer</strong> as an ongoing personal reference that records architectural insights, decisions, and trade-offs, ensuring a clear, maintainable blueprint of the project’s evolution.</li></ul><h3>Development Update — Sunday, April 6, 2025</h3><p><strong>Chat with Fundamentals workflow completed full stack</strong></p><p>These past few days have been busy with the complete refactoring of the AI-powered workflow, <em>Chat with Fundamentals</em>. The refactoring process is now complete, although some rendering details still require polishing. The Fundamental Query Interpreter (FQI) efficiently converts any user query into a Pydantic model, which is then utilized to retrieve data with minimal reliance on either LLMs or APIs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DTUmiR3YgcPKc6o8URP7dA.png" /><figcaption>FQI agent — Entry point of the data pipeline</figcaption></figure><p>Data acquisition latency has been significantly reduced from several minutes to approximately 15 seconds. The interface now appears as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GzZOxfsIGhDl5OgF228X2w.png" /><figcaption>Chat with Fundamentals — 6 April 2025 — Powered by GPT4o-mini and EODHD</figcaption></figure><p>The latest updates are now clickable, while EOD dataframes and raw JSON API outputs are available for download. An analyst agent provides a concise executive summary. The key highlight is that the data pipeline is now fully production-ready.</p><p><em>Chat with Fundamentals</em> operates on a CrewAI flow, as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/574/1*0TafsNKz7jKXoS40jAN19w.png" /><figcaption>Chat with Fundamentals Flow powered by CrewAI</figcaption></figure><p>Application architecture allows for serialization of the CrewAI flow.</p><blockquote>One AI-powered flow = one file</blockquote><p>The next major task is designing a robust logging system. In the context of AI-driven autonomous workflows, logging and visualizing workflow progress are crucial. I consider it as a prerequisite for effectively designing the most complex of the four workflows: automatic algorithm generation.</p><h3>Development Summary — Thursday, April 3, 2025</h3><p><strong>Chat with Fundamentals workflow</strong></p><p>To improve the latency and robustness of my fundamental analysis workflow, I built a dedicated <strong>Query Interpreter Agent</strong> powered by CrewAI. Its purpose is to convert natural language queries into structured DataFetchPlan objects, identifying the relevant tickers, determining whether fundamentals, end-of-day price data (EOD), or recent news are needed, and selecting the exact financial metric sections to fetch from the EODHD API. Rather than hardcoding logic, the agent is guided by a schema-based knowledge base and dynamically prompted with real-time context—such as the current date—to adapt its reasoning. By default, it selects the most recent fiscal data and a rolling three-month EOD window unless the user specifies otherwise. This agent now acts as the intelligent gateway to the data pipeline—transforming vague user questions into precise, API-ready plans that are fully aligned with the financial schema.</p><p>Prompt engineering for this agent took around two hours and has proven to be one of the most valuable components of the application. I validated its performance with two test cases using GPT-4o-mini, and confirmed the accuracy of the output with GPT-4.5. Below is the first test run of the Fundamental Query Interpreter:</p><pre>{<br>  &quot;user_query&quot;: &quot;Compare the profitability and capital structure trends of <br>   NVIDIA, AMD, and Intel over the past two fiscal years, focusing on EBITDA <br>   margin, return on equity, and total debt. Also, assess if recent news might influence their current<br>   valuation trajectory. No need to include recent stock price volatility.&quot;<br>}</pre><p>The agent determines and returns which data should be fetched to answer the user’s query.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QmJspiZpJaEFWw1RRV_sLw.png" /></figure><p>A second test case was crafted to further evaluate the agent’s ability to interpret complex queries. The full query is reproduced below, along with validation results using ChatGPT 4.5 to ensure the agent’s output aligned with expectations.As ChatGPT 4.5 is given the full scheme of the JSON, it can be used to checked the GPT-4o-mini output :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XdmfhpjMAqnDbECVguRvqg.png" /><figcaption>Another user query</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ynop4nU7dX4h7qxCeHYyAg.png" /><figcaption>Data Scheme given by the Agent</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/657/1*Im3DWx-m2EFUi0626tBzRQ.png" /><figcaption>Validation of the test by ChatGPT 4.5</figcaption></figure><p><strong>Conclusion (for today)</strong></p><p>The <strong>Fundamental Query Interpreter</strong> (FQI) now appears production-ready. It will serve as the entry-point agent in a broader data pipeline — referred to as <em>flows</em> in the CrewAI framework. At launch, the FQI will orchestrate data retrieval from at least these 3 key <a href="https://eodhd.com/?via=smr">EODHD APIs</a>:</p><ul><li><strong>Fundamental and Economic Financial Data API</strong></li><li><strong>End-of-Day Historical Stock Market Data API</strong></li><li><strong>Financial News Feed and Stock News Sentiment API</strong></li></ul><p>Developers interested in integrating similar capabilities can explore <a href="https://eodhd.com/pricing?via=slmar">EODHD’s data plans</a>.</p><p>By translating user queries into structured fetch plans, the FQI enables dynamic, schema-compliant data collection with minimal latency — laying the foundation for scalable, AI-assisted financial research.</p><h3>Development Summary — Wednesday, April 2, 2025</h3><p><strong>Chat with Fundamentals workflow refactoring started</strong></p><p>The frontend of the chat application has been fully implemented today, focusing on foundational functionality. While the design remains a work in progress, each displayed tile is managed by a dedicated TypeScript component, ensuring it adheres to its own data model. This modular architecture enhances scalability and maintainability.</p><p>In the first design, the view is powered by a hard-coded request to expedite UI development. This placeholder is now replaced by a dynamic chat window integrated with a Pydantic-based UserQuery model for seamless backend connectivity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yG7HIMoD8HUkLjF-q_0G7A.png" /><figcaption>Chat with Fundamentals Front End — First design</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n0dlcSKjgzHoN6C4GnN6Dg.png" /><figcaption>Chat with Fundamentals Backend — Agents at work</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hUE_hx9oApuI76MA9IegVw.png" /><figcaption>Chat with Fundamentals Front End — First design</figcaption></figure><p>At this stage, the primary challenge lies in addressing the increased latency of the AI workflow. A process that previously executed within a few seconds in December now takes over a minute. Attempts to mitigate this by reducing the number of iterations with OpenAI models yielded minimal improvements. Consequently, Mistral AI models were explored as an alternative, but they also failed to deliver significant latency reductions.</p><p>Additionally, a compatibility issue was identified between the Pydantic models used by QuantCoder and the structured JSON output required by Mistral AI models. Furthermore, CrewAI appears to lack full compatibility with Mistral, which naturally leads to retaining OpenAI models despite their current latency concerns.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2XwEnLcfltRPK3w3husRVw.png" /><figcaption>Failure of agents when powered by Mistral AI Large.</figcaption></figure><p>Moving forward, optimizing latency will require a multi-faceted approach. This could include strategies such as streamlining model architecture, reducing input/output tokens, parallelizing tasks, and addressing compatibility conflicts to ensure seamless integration across components.</p><p>To ensure optimal development moving forward, it is essential to benchmark different models in terms of both performance and cost. A comprehensive evaluation of large language models will be a critical step in refining the coding workflow design. Benchmarking will provide insights into model efficiency, latency, resource consumption, and scalability under real-world conditions, enabling informed decisions about which models best align with project requirements.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/661/1*cVh_YRvYpm6wvLCuL3c5Rg.png" /><figcaption>Current prices of some OpenAI models (Source : ChatGPT 4.5)</figcaption></figure><p>Optimizing the latency of the Chat with Fundamentals AI workflow is now a critical priority. Today, there was 35 changes to push to GitHub for a development cost of :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/307/1*2uAoaSs1cmtInyWcaWzZgw.png" /><figcaption>OpenAI API calls costs</figcaption></figure><h3>Development Summary — Tuesday, April 1, 2025</h3><p><strong>Architecture Refactor, Repository Split &amp; Documentation Overhaul</strong></p><ul><li>Completed a major refactor to align the project with its long-term vision as a <strong>modular, agent-driven research lab.</strong></li><li>Rewrote the backend README.md to reflect a contributor-friendly architecture.</li><li>Cleaned and reset the main branch with a minimal placeholder README that redirects users to the active dev branch.</li><li>Split the application into <strong>two dedicated repositories</strong>:</li><li>quantcoder-backend: Open-source FastAPI backend with AI workflows (CrewAI, PDF summarizer, etc.). Authentification logic backend is discarded in .gitignore</li><li>quantcoder-frontend: Private Next.js frontend handling auth, session state, and user interaction.</li></ul><p><strong>Work on </strong><strong>quantcoder-legacy</strong>:</p><ul><li>Reviewed and preserved the CLI-based legacy version of the project.</li><li>Ensured that users can access it via the quantcoder-legacy branch.</li><li>Documented its role as an early prototype offering article search, summarization, and code generation via a command-line interface.</li></ul><p><strong>Next step :</strong><br> Rebuild and test the new architecture locally, with clean routing and backend–frontend integration. Begin preparing the summarization workflow for reproducible public use and documentation.</p><h3>Development Summary — Monday, March 31, 2025</h3><p>Today’s focus was on migrating the development computer from Windows to Linux, which involved a significant cleanup of dependencies to ensure compatibility and efficiency. Both the Windows and Linux requirements files were thoroughly reviewed, optimized, and are now available in the repository, providing a streamlined setup for future development. This migration marks a key step in improving the development workflow and establishing a more robust environment for ongoing and future work.</p><h3>Development Summary — Sunday, March 30, 2025</h3><p>The QuantCoder_FS project continues to evolve into a modular, full-stack platform designed to support automated research, summarization, and trading algorithm generation. Below is a summary of the most recent development milestones.</p><h4>Redesign of SavedSummariesList Component</h4><p>The SavedSummariesList component has been fully refactored to operate as a persistent file explorer on the left side of the interface. Key improvements:</p><ul><li>Users can now navigate between different saved items (summaries, generated code, and fundamental data) seamlessly.</li><li>Establishes a unified navigation pane across workflows, providing consistency in user experience and future scalability.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FkhZGcjhg3IjPP7TP6MhrA.png" /><figcaption>SavedSummariesList component is upgraded on the left</figcaption></figure><h4>Agentic workflows visualization</h4><p>A modular visual system has been introduced to display agent workflow outputs. Each block includes:</p><ul><li>Agent identifier</li><li>Task category</li><li>Expandable view of the output (e.g., summary, code, fundamental analysis)</li></ul><p>This structure supports future development of multi-agent chains and user-in-the-loop interactions.</p><p><em>Note: Current visualizations are populated with placeholder data as agent logic is still under implementation.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xguSFK2O5ZfvB8mnKAGVxw.png" /><figcaption>Coding interface boilerplate — Agentic workflows visualization</figcaption></figure><h4>Workflow Routing and Navigation</h4><ul><li>Routing between internal workflows (Summary, Coding, Fundamentals, and Chat) has been implemented.</li><li>Navigation across workflows is now smooth and does not require page reloads.</li><li>Routes are prepared for upcoming enhancements, including JWT-based route protection and role-based access control.</li></ul><h4>Landing Page Finalization</h4><p>The landing page has been finalized with production-ready visuals and logic. It functions as the central navigation hub for all major workflows within the application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*52JIkmgXbewXGnJ7fkJDEw.png" /><figcaption>QuantCoder landing page</figcaption></figure><h3>Development Summary — Saturday, March 29</h3><p>This session included both major improvements and minor setbacks:</p><ul><li>Markdown rendering on the backend required a rework due to incompatibilities in formatting.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BUBAclZ02SBxtxiTTf6VWw.png" /><figcaption>Summarization — Markdown failed rendering</figcaption></figure><ul><li>The summarization workflow was refactored to include a dedicated Markdown rendering component.</li><li>A second version of the Summarization Frontend is now live, offering more reliable rendering and improved UX.</li></ul><p>Additionally:</p><ul><li>A “Code” button was integrated into the Summary view.</li><li>Initial architecture was laid out to bridge multiple workflows using a chat interface, allowing data to move from one workflow (e.g., summary) to another (e.g., fundamentals or search).</li><li>Global state management and persistence were implemented using Zustand, ensuring consistency across views.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Glpb5cpTnydhlTHxU6zE9Q.png" /><figcaption>Summarization — Final rendering</figcaption></figure><h3>Development Summary — Friday, March 28</h3><p>Initial work began on user authentication:</p><ul><li>Authentication is handled through a stateless login system based on JSON Web Tokens (JWT). A technical article describing the implementation was available earlier but has since been withdrawn from public view.</li><li>A functional login page was created, pending refinement in layout and styling.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/817/1*zW0cmDbzCA-sKYcy0YVspQ.png" /><figcaption>Login process — first design</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/845/1*V-7Kubb9Bg2XI19y93NdZg.png" /><figcaption>Login process — second design</figcaption></figure><h3>Development Summary — Thursday, March 27</h3><p>The first frontend prototype was constructed. While functionality was present, the UI rendering — particularly for text and markdown — was not yet fully optimized.</p><h3>Status Prior to March 27</h3><p>At this earlier stage of development, only the backend infrastructure was operational:</p><ul><li>The summarization pipeline using AI agents was tested and functional.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GOjGxuu5DKU4KBq1arko6g.png" /><figcaption>Summarization backend with agents at work</figcaption></figure><ul><li>Early-stage documentation was initiated, in preparation for the open-source release. It can be accessed here :</li></ul><p><a href="https://medium.com/@sl_mar/quantcoder-fs-documentation-6fc79915e287">QuantCoder_FS Documentation</a></p><h3>Road Ahead</h3><p>The next development phases include:</p><ul><li>Completing the agentic workflow for algorithm generation.</li><li>Finalizing authentication and authorization infrastructure.</li><li>Implementing credit-based access controls.</li><li>Preparing for deployment on Azure with CI/CD integration.</li><li>Publishing selected workflows for early access and user feedback.</li></ul><h3>Resources</h3><p>• GitHub Repository: <a href="https://github.com/SL-Mar/quantcoder-backend">quantcoder-backend</a><br> • Project Site: <a href="https://quantcoder-fs.com/">quantcoder-fs.com</a><br> • Try the EODHD APIs: <a href="https://eodhd.com/pricing?via=slmar">EODHD Pricing</a> <em>(affiliate)</em></p><p>Thank you for reading</p><p><em>Logged by Sebastien M. Laignel</em><br>Founder of <strong>QuantCoder FS</strong>, building agentic tools for quantitative finance research. This project is powered in part by EODHD — affiliate link in the resources section helps support development.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1b3b7e8c23de" width="1" height="1" alt=""><hr><p><a href="https://aiadvances.org/quantcoder-fs-development-log-1b3b7e8c23de">Building a Full-Stack, Agent-Driven AI for Quantitative Finance</a> was originally published in <a href="https://aiadvances.org/">AI Advances</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Secure JWT Authentication System with FastAPI and Next.js]]></title>
            <link>https://medium.com/@sl_mar/building-a-secure-jwt-authentication-system-with-fastapi-and-next-js-301e749baec2?source=rss-37df43070e7c------2</link>
            <guid isPermaLink="false">https://medium.com/p/301e749baec2</guid>
            <category><![CDATA[jwt]]></category>
            <category><![CDATA[fastapi]]></category>
            <category><![CDATA[nextjs]]></category>
            <dc:creator><![CDATA[Sebastien M. Laignel]]></dc:creator>
            <pubDate>Sat, 29 Mar 2025 08:20:04 GMT</pubDate>
            <atom:updated>2025-03-29T08:20:04.300Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tI6XkWFt0UjKY3NenJdiOQ.png" /><figcaption>ChatGPT-4</figcaption></figure><h3>TL;DR</h3><p>As part of my quant research platform <strong>QuantCoder FS</strong>, I needed a lightweight and secure authentication system to protect access to workflows such as document summarization and algorithm generation.</p><p>This guide shows how I implemented a full-stack JWT-based authentication system using:</p><ul><li><strong>FastAPI</strong> on the backend</li><li><strong>Next.js + React + Tailwind</strong> on the frontend</li><li><strong>LocalStorage</strong> for token management</li></ul><p>Everything is modular, reactive, and production-ready.</p><h3>✨ Why I Built It</h3><p>In my AI-powered research platform, some routes (like document summarization) require authentication. Instead of managing server-side sessions or cookies, I wanted something <strong>stateless</strong>, secure, and easily integrable with frontend logic.</p><p><strong>JWT (JSON Web Token)</strong> authentication checked all the boxes.</p><h3>🔐 What is a JWT Token?</h3><p>A <strong>JSON Web Token (JWT)</strong> is a compact, URL-safe string used to represent claims between two parties — typically, a server and a client.</p><p>A JWT has three parts:</p><ol><li><strong>Header</strong>: algorithm &amp; token type</li><li><strong>Payload</strong>: the actual claims (e.g., user ID, email, expiration)</li><li><strong>Signature</strong>: ensures the token wasn’t tampered with</li></ol><p>Example payload:</p><pre>{<br>  &quot;sub&quot;: &quot;user@example.com&quot;,<br>  &quot;exp&quot;: 1711745085<br>}</pre><ul><li>sub stands for subject (usually user email or ID)</li><li>exp is a UNIX timestamp that defines the token&#39;s expiration</li></ul><p>JWTs are signed with a secret key and can be verified but not modified by the client. They’re stored in localStorage on the frontend and passed in the Authorization header when calling protected APIs.</p><h3>🔁 End-to-End Flow</h3><ol><li>User logs in via a React form (email + password)</li><li>FastAPI verifies credentials and returns a <strong>JWT access token</strong></li><li>Token is stored in localStorage</li><li>On each protected request, the token is sent in the Authorization header</li><li>FastAPI verifies the token using the secret key and allows or denies access</li></ol><p>This entire flow is <strong>stateless</strong> — no cookies or server sessions.</p><h3>🧱 System Architecture</h3><p>Key principles:</p><ul><li>JWT tokens with expiration (exp) and user identity (sub)</li><li>Secure password hashing via bcrypt</li><li>React-based frontend logic with useAuth()</li><li>Token-aware API client</li><li>Protected routes with FastAPI dependencies</li></ul><h3>📁 Project File Structure</h3><pre>backend/<br>├── main.py                # FastAPI app with CORS and routers<br>├── routers/<br>│   ├── auth.py            # Login endpoint<br>│   └── summarizer.py      # Protected summarization routes<br>├── utils/<br>│   └── auth_utils.py      # JWT, hashing, get_current_user()</pre><pre>frontend/<br>├── pages/<br>│   ├── login.tsx          # Login form<br>│   └── summarisation.tsx  # Protected dashboard<br>├── lib/<br>│   ├── useAuth.ts         # JWT decoding + auth state<br>│   └── api.ts             # Token-aware API client<br>├── components/<br>│   └── Header.tsx         # Dynamic auth header</pre><h3>🚀 FastAPI Auth Backend</h3><h3>/login Endpoint</h3><p>This endpoint checks user credentials and issues a token:</p><pre>@router.post(&quot;/login&quot;)<br>def login(req: LoginRequest):<br>    if req.email != FAKE_USER[&quot;email&quot;]:<br>        raise HTTPException(status_code=401, detail=&quot;User not found&quot;)<br>    if not verify_password(req.password, FAKE_USER[&quot;hashed_password&quot;]):<br>        raise HTTPException(status_code=401, detail=&quot;Incorrect password&quot;)</pre><pre>    token = create_access_token({&quot;sub&quot;: req.email})<br>    return {&quot;access_token&quot;: token, &quot;token_type&quot;: &quot;bearer&quot;}</pre><h3>JWT Helpers (utils/auth_utils.py)</h3><pre>def create_access_token(data: dict, expires_delta: timedelta = None):<br>    expire = datetime.utcnow() + (expires_delta or timedelta(minutes=60))<br>    to_encode = data.copy()<br>    to_encode.update({&quot;exp&quot;: expire})<br>    return jwt.encode(to_encode, SECRET_KEY, algorithm=ALGORITHM)</pre><h3>Protecting Routes with Depends</h3><p>Any route can require a valid JWT:</p><pre>@router.post(&quot;/extract&quot;)<br>async def extract_scientific_summary(<br>    file: UploadFile = File(...),<br>    current_user: str = Depends(get_current_user)<br>):<br>    # run summarization workflow...</pre><p>The get_current_user function decodes and validates the token.</p><h3>🌐 React Frontend Auth</h3><h3>useAuth() Hook</h3><p>Tracks login state by decoding JWT:</p><pre>export function useAuth() {<br>  useEffect(() =&gt; {<br>    const token = localStorage.getItem(&quot;token&quot;);<br>    if (token) {<br>      const payload = JSON.parse(atob(token.split(&quot;.&quot;)[1]));<br>      setUser(payload.sub);<br>    } else {<br>      setUser(null);<br>    }<br>  }, []);</pre><pre>  return { user, username, loading };<br>}</pre><h3>Dynamic Header</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/845/1*V-7Kubb9Bg2XI19y93NdZg.png" /><figcaption><em>Dynamic header showing logged-in user and logout option.</em></figcaption></figure><pre>{user ? (<br>  &lt;span&gt;Logged as {username}&lt;/span&gt;<br>) : (<br>  &lt;Link href=&quot;/login&quot;&gt;Login&lt;/Link&gt;<br>)}<br>{user &amp;&amp; (<br>  &lt;button onClick={() =&gt; localStorage.removeItem(&#39;token&#39;)}&gt;Log out&lt;/button&gt;<br>)}</pre><h3>Login Page</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/760/1*MMYIP9I9CY5Jqn-uc9g9hA.png" /><figcaption><em>Login screen for QuantCoder FS with JWT authentication.</em></figcaption></figure><pre>const handleLogin = async () =&gt; {<br>  const res = await fetch(&#39;/login&#39;, {...});<br>  const data = await res.json();<br>  localStorage.setItem(&#39;token&#39;, data.access_token);<br>  router.push(next);<br>};</pre><h3>Route Protection</h3><pre>useEffect(() =&gt; {<br>  if (!loading &amp;&amp; user === null) {<br>    router.push(&#39;/login?next=/summarisation&#39;);<br>  }<br>}, [user, loading]);</pre><h3>🔗 Token-Aware API Client (lib/api.ts)</h3><pre>const getAuthHeaders = () =&gt; ({<br>  Authorization: `Bearer ${localStorage.getItem(&#39;token&#39;)}`<br>});</pre><pre>export const api = {<br>  async extractSummary(file) {<br>    const res = await fetch(&#39;/summarizer/extract&#39;, {<br>      method: &#39;POST&#39;,<br>      headers: getAuthHeaders(),<br>      body: formData<br>    });<br>    ...<br>  }<br>}</pre><p>All requests to protected endpoints include the JWT in the headers.</p><h3>🧩 FastAPI App Entrypoint (main.py)</h3><pre>app = FastAPI()<br>app.add_middleware(CORSMiddleware, allow_origins=[&quot;http://localhost:3000&quot;], ...)<br>app.include_router(auth.router)<br>app.include_router(router, prefix=&quot;/summarizer&quot;)</pre><h3>🎯 Final Thoughts</h3><p>This setup gave me exactly what I needed:</p><ul><li>Stateless authentication</li><li>Secure access to LLM workflows</li><li>Frontend that reacts to login/logout</li><li>Fast and easy to scale</li></ul><p>All without any need for sessions or cookies.</p><h3>🌐 Want More?</h3><p>This authentication system powers <strong>QuantCoder FS</strong>, my open-source quant research stack for AI-assisted financial analysis and algorithmic trading.</p><p>The project is actively evolving on a dedicated DEV branch. This branch will soon be integrated into a CI/CD pipeline — most likely powered by <strong>Azure DevOps</strong> — to automate testing, deployment, and continuous delivery of the full-stack application.</p><p>Rather than writing purely pedagogical content, I’m focusing on building a live, working platform that quant researchers and traders can interact with — no coding required. The aim is to enable replication, adaptation, and faster experimentation directly from the browser.</p><p>There’s still a lot to explore in time series forecasting and financial modeling — and QuantCoder FS is my vehicle to deliver and test those ideas in real time.</p><p>👉 <a href="https://github.com/SL-Mar">Visit GitHub</a> to explore the full project and other AI tools I’ve built.</p><p><em>Thanks for reading!</em></p><p>The project is here :</p><p><a href="https://github.com/SL-Mar/QuantCoder-FS">GitHub - SL-Mar/QuantCoder-FS: Automating financial research and generating trading strategies.</a></p><p>Other coding works here :</p><p><a href="https://github.com/SL-Mar/Coding_and_Writing_Works">GitHub - SL-Mar/Coding_and_Writing_Works: Trading algorithms, code toolbox and list of articles</a></p><p><strong>Copyright 2024 SL MAR — Sebastien M. Laignel</strong><br><em>Licensed under the Apache License 2.0</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=301e749baec2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Summarizing YouTube videos for Insights]]></title>
            <link>https://python.plainenglish.io/summarizing-youtube-videos-for-insights-af58366209b5?source=rss-37df43070e7c------2</link>
            <guid isPermaLink="false">https://medium.com/p/af58366209b5</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[trading]]></category>
            <dc:creator><![CDATA[Sebastien M. Laignel]]></dc:creator>
            <pubDate>Thu, 27 Mar 2025 04:17:18 GMT</pubDate>
            <atom:updated>2025-04-01T16:38:38.141Z</atom:updated>
            <content:encoded><![CDATA[<h4>A Python Tool for Structured Summarization of Financial and Technical Talks</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/467/1*rUDzwMgDqziYWnygLHeVDw.png" /><figcaption>Another YT Summarizer by DALL.E</figcaption></figure><p><em>Published: March 23, 2025 · Last Updated: March 31, 2025</em></p><p>This Python script enables structured summarization of YouTube videos using OpenAI’s GPT-4 API. It is specifically designed for financial, academic, or technical content, where extracting meaningful insights from long-form interviews, presentations, or webinars is of practical value.</p><p>The tool retrieves transcripts, segments them for processing, and generates a comprehensive summary formatted in both Markdown and PDF. The tone and analytical depth of the output can be tailored using predefined personas (e.g., financial analyst or theoretical physicist), depending on the content.</p><h4>Setup and Dependencies</h4><ol><li>Create and activate a virtual environment</li></ol><pre>python -m venv venv<br>venv\Scripts\activate</pre><ol><li>Clone the project folder and install the required dependencies with:</li></ol><pre>pip install -r requirements.txt</pre><p>2. Create a .env file in the project root and add your OpenAI API key:</p><pre>OPENAI_API_KEY=your_openai_key_here</pre><p>3. Install wkhtmltopdf.org on below location :</p><pre>C:\Program Files\wkhtmltopdf\bin\</pre><h4>How It Works</h4><p>The user starts by providing a YouTube video ID and selecting the language of the transcript (e.g., en for English or fr for French); the image below illustrates how to extract the video ID from a standard YouTube URL. The script then retrieves the transcript using youtube-transcript-api, splits it into segments of up to 1,000 words, and sends each chunk to OpenAI&#39;s GPT-4 for summarization. These partial summaries are combined and reformulated into a complete article using one of two predefined prompts—either a physicist or a financial analyst persona—depending on the nature of the content. The final result is saved in both Markdown (.md) and PDF (.pdf) formats.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/692/1*6P2o__nRcSWB10O7n2_jlQ.png" /></figure><h4>LLM Prompt Used in This Example</h4><p>For the example below, the GPT prompt uses a <strong>financial analysis persona</strong></p><pre># 💼 FINANCE PERSONA — use for financial, economic, or market content<br>    active_prompt = (<br>        f&quot;You are a senior financial analyst and macro strategist with expertise in institutional investing, market trends, and global economics. &quot;<br>        f&quot;You are analyzing a talk titled \&quot;{title}\&quot; published on {publish_date} on YouTube.\n\n&quot;<br>        &quot;Based on the transcript summaries below, write a professional, insightful, and structured article in markdown format. &quot;<br>        &quot;Your audience includes mainly informed retail investors who follow Bloomberg, Financial Times, and Wall Street Journal content.\n\n&quot;<br>        &quot;The article should include key macro and microeconomic themes, sector and asset class insights, market sentiment, and any notable forecasts or strategic implications. &quot;<br>        &quot;Where appropriate, highlight risk factors, valuation considerations, or actionable perspectives.\n\n&quot;<br>        &quot;Structure your article with clear sections (e.g., ## Executive Summary, ## Market Outlook, ## Sector Insights, ## Strategy &amp; Implications, ## Conclusion). &quot;<br>        &quot;Aim for an article around 1000 words. Provide well-reasoned analysis and connect ideas to broader economic or financial contexts.\n\n&quot;<br>        &quot;Transcript summaries:\n\n&quot; + &quot;\n\n&quot;.join(summaries)<br>    )</pre><p>The GitHub version of the code also includes a physicist persona for use with academic or technical content.</p><h4>Example use case</h4><p>To summarize the Bloomberg Invest 2025 interview with <strong>Bruce Flatt</strong>, CEO of Brookfield Asset Management (YouTube ID: 69YOJFvL1-M), simply run:</p><pre>python youtube_summarizer.py</pre><p>The CLI is visible below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1022/1*Gywj3KJok7btgEO5LG2rfw.png" /></figure><p>In this interview, Bruce Flatt (CEO of Brookfield) discusses tariffs against Canada, structural trends in asset management, and the outlook for digital infrastructure investment with Bloomberg’s Erik Schatzker.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F69YOJFvL1-M%3Flist%3DPLk_dRJVyaR2wP4MiAcStFDKXF2JeDZyGK&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D69YOJFvL1-M&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F69YOJFvL1-M%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/1a3af8fcdddab4e950a053ca247e8e5d/href">https://medium.com/media/1a3af8fcdddab4e950a053ca247e8e5d/href</a></iframe><p>The script will process the transcript and generate a full article, saved in .md and .pdf formats. In this particular talk, Bruce Flatt discusses tariffs against Canada, structural shifts in asset management, and future investment opportunities in digital infrastructure.</p><blockquote>Output samples and generated files are available in the project repository.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ghgJ44nLZISCrKyjmA4h_w.png" /><figcaption>Summary extracted from the example video</figcaption></figure><h4>Integration with QuantCoder_FS</h4><p>This script applies LLM summarization techniques to structured video content, converting lengthy presentations into actionable research insights. It is particularly well suited for financial interviews, academic lectures, and high-level commentary.</p><p>I am currently evaluating its integration into the <strong>QuantCoder_FS</strong> application as an <strong>insight extraction module</strong>, complementing the existing PDF summarization workflow. This extension will allow users to extract value not only from written documents but also from audio-visual media, thereby enhancing the platform’s research scope.</p><p><a href="https://github.com/SL-Mar/QuantCoder-FS/tree/dev">GitHub - SL-Mar/QuantCoder-FS at dev</a></p><h4>Repository and Source Code</h4><p>The complete script and examples are available at:</p><p><a href="https://github.com/SL-Mar/codes-articles/tree/main/youtube_summarizer">codes-articles/youtube_summarizer at main · SL-Mar/codes-articles</a></p><p>Thank you for your interest.</p><p><em>Sebastien M. Laignel</em></p><h3>Thank you for being a part of the community</h3><p><em>Before you go:</em></p><ul><li>Be sure to <strong>clap</strong> and <strong>follow</strong> the writer ️👏<strong>️️</strong></li><li>Follow us: <a href="https://x.com/inPlainEngHQ"><strong>X</strong></a> | <a href="https://www.linkedin.com/company/inplainenglish/"><strong>LinkedIn</strong></a> | <a href="https://www.youtube.com/@InPlainEnglish"><strong>YouTube</strong></a> | <a href="https://newsletter.plainenglish.io/"><strong>Newsletter</strong></a> | <a href="https://open.spotify.com/show/7qxylRWKhvZwMz2WuEoua0"><strong>Podcast</strong></a> | <a href="https://differ.blog/inplainenglish"><strong>Differ</strong></a> | <a href="https://twitch.tv/inplainenglish"><strong>Twitch</strong></a></li><li><a href="https://cofeed.app/"><strong>Check out CoFeed, the smart way to stay up-to-date with the latest in tech</strong></a> <strong>🧪</strong></li><li><a href="https://differ.blog/"><strong>Start your own free AI-powered blog on Differ</strong></a> 🚀</li><li><a href="https://discord.gg/in-plain-english-709094664682340443"><strong>Join our content creators community on Discord</strong></a> 🧑🏻‍💻</li><li>For more content, visit <a href="https://plainenglish.io/"><strong>plainenglish.io</strong></a> + <a href="https://stackademic.com/"><strong>stackademic.com</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=af58366209b5" width="1" height="1" alt=""><hr><p><a href="https://python.plainenglish.io/summarizing-youtube-videos-for-insights-af58366209b5">Summarizing YouTube videos for Insights</a> was originally published in <a href="https://python.plainenglish.io/">Python in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>