<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: irgendwasmitfelix</title>
    <description>The latest articles on DEV Community by irgendwasmitfelix (@irgendwasmitfelix).</description>
    <link>https://dev.to/irgendwasmitfelix</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3865542%2Fea401fc3-e0ad-4023-8261-0ff2871dcaca.jpeg</url>
      <title>DEV Community: irgendwasmitfelix</title>
      <link>https://dev.to/irgendwasmitfelix</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/irgendwasmitfelix"/>
    <language>en</language>
    <item>
      <title>I Built a Self-Improving AI Crypto Bot with Python and Kraken (Full Architecture)</title>
      <dc:creator>irgendwasmitfelix</dc:creator>
      <pubDate>Tue, 07 Apr 2026 10:10:37 +0000</pubDate>
      <link>https://dev.to/irgendwasmitfelix/i-built-a-self-improving-ai-crypto-bot-with-python-and-kraken-full-architecture-25bl</link>
      <guid>https://dev.to/irgendwasmitfelix/i-built-a-self-improving-ai-crypto-bot-with-python-and-kraken-full-architecture-25bl</guid>
      <description>&lt;p&gt;The Dream: A Bot That Learns from Its Mistakes&lt;br&gt;
Most trading bots are static. You program a strategy (like RSI or MACD), and it executes until the market regime changes and you lose money. On my channel The Efficient Dev, I wanted to solve this.&lt;/p&gt;

&lt;p&gt;I built a system that doesn't just trade—it reflects. It uses AI agents to analyze its own P&amp;amp;L and suggest optimizations. Here’s how I did it.&lt;/p&gt;

&lt;p&gt;🛠️ The Tech Stack&lt;br&gt;
To keep it "efficient" and 24/7 capable, I chose:&lt;/p&gt;

&lt;p&gt;Language: Python 3.11+&lt;/p&gt;

&lt;p&gt;Exchange: Kraken API (Robust and dev-friendly)&lt;/p&gt;

&lt;p&gt;Brain: AI Agents (Analyzing trade history)&lt;/p&gt;

&lt;p&gt;Environment: Raspberry Pi (Low power, high uptime)&lt;/p&gt;

&lt;p&gt;🏗️ The System Architecture&lt;br&gt;
The bot operates in a continuous loop, but with a twist. Instead of just Market Data -&amp;gt; Trade, it follows a Reflective Loop:&lt;/p&gt;

&lt;p&gt;Ingestion: Pulling real-time OHLCV data from Kraken.&lt;/p&gt;

&lt;p&gt;Strategy Execution: A technical analysis layer triggers potential entries.&lt;/p&gt;

&lt;p&gt;The "Agent" Layer: This is the secret sauce. An AI agent reviews the last 24 hours of trades.&lt;/p&gt;

&lt;p&gt;Question: "Why did we lose 2% on that ETH long?"&lt;/p&gt;

&lt;p&gt;Action: Adjusts the volatility threshold for the next trade.&lt;/p&gt;

&lt;p&gt;Autonomous Deployment: Running on a Raspberry Pi via a systemd service.&lt;/p&gt;

&lt;p&gt;💻 Code Snippet: Connecting to Kraken&lt;br&gt;
Here is a simplified look at how I handle the authenticated client:&lt;/p&gt;

&lt;p&gt;Python&lt;br&gt;
import krakenex&lt;br&gt;
from pykrakenapi import KrakenAPI&lt;/p&gt;

&lt;p&gt;def get_kraken_connection():&lt;br&gt;
    api = krakenex.API()&lt;br&gt;
    api.load_key('kraken.key') # Keep your keys safe!&lt;br&gt;
    return KrakenAPI(api)&lt;/p&gt;

&lt;h1&gt;
  
  
  The bot then uses this to fetch balances and execute trades
&lt;/h1&gt;

&lt;p&gt;kraken = get_kraken_connection()&lt;br&gt;
print(kraken.get_account_balance())&lt;br&gt;
🧠 Why "Self-Improving"?&lt;br&gt;
The core problem with algorithmic trading is Overfitting. By using an AI reflection layer, the bot identifies if a strategy is failing because of "bad luck" or because the "market logic" has shifted.&lt;/p&gt;

&lt;p&gt;In the full video, I show the logs where the bot actually decides to stay out of the market because the AI agent detected high-frequency noise that the standard RSI couldn't see.&lt;/p&gt;

&lt;p&gt;📺 Full Technical Walkthrough&lt;br&gt;
I’ve documented the entire build process, the challenges with the Kraken API, and the exact logic of the AI agents in this video:&lt;/p&gt;

&lt;p&gt;WATCH THE VIDEO HERE: &lt;a href="https://youtu.be/nTXojkvskGM" rel="noopener noreferrer"&gt;https://youtu.be/nTXojkvskGM&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;🚀 Get the Source Code&lt;br&gt;
I’m a big believer in open source. You can find the repository for this project on my GitHub. Feel free to star it or fork it to build your own version!&lt;/p&gt;

&lt;p&gt;👉 GitHub Repo: irgendwasmitfelix/TradingBot&lt;/p&gt;

&lt;p&gt;Let's Discuss!&lt;br&gt;
How do you handle risk management in your bots?&lt;/p&gt;

&lt;p&gt;Do you think AI agents are the future of retail trading, or just hype?&lt;/p&gt;

&lt;p&gt;I'll be in the comments answering questions!&lt;/p&gt;

</description>
      <category>python</category>
      <category>ai</category>
      <category>raspberrypi</category>
      <category>cryptocurrency</category>
    </item>
  </channel>
</rss>
