<?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"><channel><title><![CDATA[Nenjo Trades]]></title><description><![CDATA[Software Engineer with 13+ years' experience, focused on trading bot automation, market analysis, Golang, Python, EA scripting, and TradingView integration]]></description><link>https://nenjotrades.hashnode.dev</link><image><url>https://cdn.hashnode.com/res/hashnode/image/upload/v1752330047748/bac8e1eb-f2c2-46b1-a03e-4544e42e8cbb.png</url><title>Nenjo Trades</title><link>https://nenjotrades.hashnode.dev</link></image><generator>RSS for Node</generator><lastBuildDate>Thu, 10 Sep 2026 08:38:35 GMT</lastBuildDate><atom:link href="https://nenjotrades.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[The Danger of Using AI in Trading: Why Blind Automation Is Riskier Than You Think]]></title><description><![CDATA[When the Tools Start Thinking for You
It’s easy to see why AI has made its way into trading.
Machine learning models promise to analyze more data than a human ever could. They can spot patterns, generate entry signals, and even write code to automate...]]></description><link>https://nenjotrades.hashnode.dev/the-danger-of-using-ai-in-trading-why-blind-automation-is-riskier-than-you-think</link><guid isPermaLink="true">https://nenjotrades.hashnode.dev/the-danger-of-using-ai-in-trading-why-blind-automation-is-riskier-than-you-think</guid><category><![CDATA[AWS]]></category><category><![CDATA[Forex Trading]]></category><category><![CDATA[trading, ]]></category><category><![CDATA[automation]]></category><category><![CDATA[Machine Learning]]></category><category><![CDATA[golang]]></category><category><![CDATA[Artificial Intelligence]]></category><dc:creator><![CDATA[Nenjo Trades]]></dc:creator><pubDate>Thu, 17 Jul 2025 10:28:14 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1752747722145/b6a07e3f-90b0-409b-9fc6-1cc30c10e1bd.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-when-the-tools-start-thinking-for-you">When the Tools Start Thinking for You</h2>
<p>It’s easy to see why AI has made its way into trading.
Machine learning models promise to analyze more data than a human ever could. They can spot patterns, generate entry signals, and even write code to automate strategies. With a few clicks, you can spin up a trading bot that claims to be smarter, faster, and more accurate than anything you could design by hand.
For traders tired of screen time and emotional decisions, it sounds like a dream.
But here’s the problem.
Most traders using AI aren’t using it to assist their thinking. They’re using it to replace it.
That’s where things go wrong.</p>
<h2 id="heading-what-happens-when-you-rely-on-vibes-not-context">What Happens When You Rely on Vibes, Not Context</h2>
<p>AI tools can now generate entire Pine Script or Python trading bots with a single prompt. You type in a vague idea, and it spits out a working script.
It might look clean. It might backtest well. It might even place a few decent trades.
But under the surface, you don’t know why it works. Or if it even works for the market you’re in.
You’re not building a strategy anymore. You’re just using someone else’s logic — copied, repackaged, and abstracted through layers of code you didn’t write and don’t fully understand.
That’s not trading. That’s vibe coding.
It’s relying on something that feels smart because it looks smart. But there’s no context, no real insight into price action, and no connection to the actual structure of the market.
And when things shift — when the trend breaks or volatility changes — you’re flying blind.</p>
<h2 id="heading-false-positives-look-like-wins-until-they-dont">False Positives Look Like Wins… Until They Don’t</h2>
<p>One of the biggest risks with AI-generated strategies is the illusion of effectiveness.
A backtest might show a 70+% win rate. You see smooth equity curves and low drawdowns. But what you’re looking at might be curve-fitted, cherry-picked, or over-optimized for a narrow slice of data.
It’s easy to create a strategy that performs well on paper. It’s much harder to design one that adapts to real market conditions — news, macro trends, liquidity shifts, or human behavior.
AI doesn’t care about these factors unless you explicitly feed them into the system. And most traders don’t.
They’re trusting outputs from models trained on price alone. No fundamentals. No order flow. No market psychology.
And in real-world trading, those missing inputs matter.
The result? Strategies that perform well for a few days or weeks, then collapse without warning. And when that happens, you’re left with code you can’t fix and trades you can’t explain.</p>
<h2 id="heading-the-real-power-of-ai-is-in-enhancement-not-replacement">The Real Power of AI Is in Enhancement, Not Replacement</h2>
<p>AI isn’t the enemy. In fact, it can be a powerful partner — if you know how to use it.
The danger is in treating it like a magic black box that can outsmart the market on its own. It can’t.
The strongest traders use AI to speed up analysis, generate ideas, or automate repetitive tasks. But they never stop thinking. They don’t outsource the core decision-making. They treat AI like a tool, not a substitute for skill.
That’s the difference between responsible automation and blind delegation.
Because when you don’t understand your own system, you’re not trading. You’re just pushing buttons and hoping the model gets it right.
And hope isn’t a strategy.</p>
<h2 id="heading-the-bottom-line">The Bottom Line</h2>
<p>If you're using AI in your trading, be honest with yourself:</p>
<ul>
<li>Do you understand the logic behind your strategy?</li>
<li>Can you explain why it wins — and why it might lose?</li>
<li>Are you trading a system, or are you trusting a script you didn’t write?</li>
</ul>
<p>The future of trading will include AI. That’s inevitable. But the traders who last are the ones who combine it with real insight, real discipline, and real understanding.</p>
<p>Anything less is gambling with prettier code.</p>
]]></content:encoded></item><item><title><![CDATA[Why Most Traders Fail at Automation (And What Engineers Can Do About It)]]></title><description><![CDATA[The Dream of Passive Trading
It usually starts with a dream. You’ve developed a strategy, maybe it’s a clean RSI divergence setup or a price action pattern you’ve been back testing for weeks. It works. You’re winning more than you’re losing.
Then it ...]]></description><link>https://nenjotrades.hashnode.dev/why-most-traders-fail-at-automation-and-what-engineers-can-do-about-it</link><guid isPermaLink="true">https://nenjotrades.hashnode.dev/why-most-traders-fail-at-automation-and-what-engineers-can-do-about-it</guid><category><![CDATA[Python]]></category><category><![CDATA[Python 3]]></category><category><![CDATA[Go Language]]></category><category><![CDATA[metatrader4]]></category><category><![CDATA[MT5 forex trading]]></category><category><![CDATA[mt5]]></category><category><![CDATA[trading, ]]></category><category><![CDATA[tradingplatfrom]]></category><category><![CDATA[tradingbot]]></category><dc:creator><![CDATA[Nenjo Trades]]></dc:creator><pubDate>Sat, 12 Jul 2025 13:39:50 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1752326335172/d9991ba3-c5dc-4c5d-97fb-ff0b4896e034.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-the-dream-of-passive-trading"><strong>The Dream of Passive Trading</strong></h2>
<p>It usually starts with a dream. You’ve developed a strategy, maybe it’s a clean RSI divergence setup or a price action pattern you’ve been back testing for weeks. It works. You’re winning more than you’re losing.</p>
<p>Then it hits you: <em>"Why not automate it?"</em></p>
<p>The idea sounds perfect. No more missed entries, no more late nights waiting for confirmations and confluences. Just signals, entries, exits, all running 24/7 while you sleep, work, or go for a walk. You start coding. Pine Script handles the signals. A webhook sends the alert. Maybe you use a Python script or even a vibe-coding bridge to place the order.</p>
<p>Within a day or two, your first trade gets triggered. Your bot is alive. And you feel like a genius.</p>
<p>But then… things go wrong.</p>
<hr />
<h2 id="heading-why-it-falls-apart"><strong>Why It Falls Apart</strong></h2>
<p>At first, you shrug off the issues. A missed entry? Maybe the alert was delayed. A double trade? Maybe the position hit the stop-loss too early, or maybe it didn’t even close when it should have. Perhaps you accidentally ran two instances of your bot.</p>
<p>But the cracks begin to grow.</p>
<p>You start noticing inconsistencies, trades don’t execute at the right time, or worse, at the wrong price. Some days, you get no trades at all, even though your setup clearly triggered.</p>
<p>Other times, your broker rejects orders because your bot didn’t handle position sizing properly. And when you try to trace the issue?</p>
<p>You realize you never added logging.</p>
<p>You built something, sure. But it’s blind, brittle, and behaving unpredictably. And the worst part? You don’t even know where it’s failing, let alone why.</p>
<p>This is where most traders quit. They realize that automation isn’t as plug-and-play as it looks. What they thought was just “code + strategy = freedom” turns out to be a deeper, more complex problem. One that’s less about trading and more about <strong>software engineering</strong>.</p>
<hr />
<h2 id="heading-how-engineers-think-differently"><strong>How Engineers Think Differently</strong></h2>
<p>Here’s the good news: if you have even a bit of engineering experience, or you’re willing to think like one — you can turn this mess into something powerful.<br />Because unlike many traders who approach automation as a shortcut, engineers approach it as <strong>a system to be designed, tested, and improved</strong>.</p>
<p>The first shift is in how you structure the bot itself. Most hobbyist traders will build everything inside a single, messy script — one that receives alerts, calculates position size, sends orders, and maybe prints a log to the terminal. But engineers know better. Systems are easier to scale, test, and debug when you break them into modules. You don’t need microservices out of the gate, but you do need separation of concerns. Have one function handle signals, another manages risk logic, another for execution, and another to monitor and log the results.</p>
<p>The next big shift is how you treat the signals. Many traders think a webhook alert should instantly trigger a trade. But as an engineer, you realize that a webhook is an event, not a command. When you receive that signal, you should run it through a series of checks. Is the market open? Are we already in a trade? Has slippage widened too much? Did this alert already trigger at the last minute?</p>
<p>Your system should decide whether it’s safe, and smart to act. This is the automation equivalent of <strong>if-else logic in the real world</strong>. Not all signals should be followed blindly.</p>
<p>Of course, none of these matters if your system can’t recover from failure. APIs fail. Connections drop. Brokers reject orders. Your bot must not only expect these issues, but it should also handle them gracefully. If an order doesn’t go through, try again. If MT5 is disconnected, queue the trade or trigger an alert. Always log the reason. Build in redundancy like an engineer deploying backend infrastructure, because that’s exactly what you’re doing.</p>
<p>Lastly, visibility is everything. Without logs, metrics, and some form of monitoring, you’ll never trust your automation. You don’t need Prometheus and Grafana from day one, but you do need clear, timestamped logs of every signal received, trade executed, error handled, and position updated. Even a simple .log file and Telegram alerts can give you a massive edge when debugging.</p>
<hr />
<h2 id="heading-a-real-world-example-from-script-to-system"><strong>A Real-World Example: From Script to System</strong></h2>
<p>When I built my first bot, I started with a Python script that simply caught <strong>TradingView</strong> webhooks and sent market orders to MT5. It worked, until it didn’t.</p>
<p>So, I refactored. I broke it into modules: one script received signals and validated the logic. Another handled risk calculations. The third was in charge of execution, retries, and order status tracking. I wrapped the whole thing in a basic <strong>FastAPI</strong> server and added a logging layer that wrote to both file and Telegram.</p>
<p>Later, I migrated the core to Golang, not because Python wasn’t working, but because I wanted tighter control over concurrency and WebSocket handling. Using goroutines and channels, I could process multiple signals and order flows in real time without blocking anything. It felt like engineering, not just coding.</p>
<p>And when something failed, I didn’t panic. I read the logs, identified the bug, wrote a test, and fixed it. Just like I would in any other production environment.</p>
<hr />
<h2 id="heading-final-thoughts-automation-isnt-a-hack-its-an-engineering-problem"><strong>Final Thoughts: Automation Isn’t a Hack — It’s an Engineering Problem</strong></h2>
<p>If you're thinking about building a trading bot, or you’ve already built one that behaves like a wild animal, know this:</p>
<p>You're not failing because your strategy is bad (or maybe).<br />You're failing because your automation wasn’t built like software.</p>
<p>And if you start thinking like an engineer, with modular code, fault tolerance, monitoring, and system design, you’ll build bots that are stable, repeatable, and genuinely hands-off.</p>
<p>Not every strategy will make money.<br />But every good system should work exactly as designed, even when it fails.</p>
<p>And that, more than anything, is how you win in trading automation.</p>
<hr />
<h2 id="heading-need-help-automating-your-strategy">🤝 Need Help Automating Your Strategy?</h2>
<p>With over 13 years of experience in software engineering, building scalable, enterprise-grade systems, and a deep trading mindset, I help traders turn their strategies into fully automated bots using <strong>Expert Advisors</strong>, <strong>Python</strong>, or <strong>Go</strong>.</p>
<p>If you’re ready to bring your idea to life, I’d be happy to help.<br />📩 Reach out to me at <strong>nenjotrade@gmail.com</strong> and let’s build it right.</p>
]]></content:encoded></item><item><title><![CDATA[How to Implement SOLID Principles in Golang for Automated Trading Bots]]></title><description><![CDATA[Imagine this: you’re in the middle of an epic coding session, coffee mug half-empty, and your trading bot is spitting out errors like a grumpy cat. You scream internally, "Why did I write this tangled mess of code?!" Been there, done that. But what i...]]></description><link>https://nenjotrades.hashnode.dev/how-to-implement-solid-principles-in-golang-for-automated-trading-bots</link><guid isPermaLink="true">https://nenjotrades.hashnode.dev/how-to-implement-solid-principles-in-golang-for-automated-trading-bots</guid><category><![CDATA[golang]]></category><category><![CDATA[SOLID principles]]></category><category><![CDATA[Automated Trading Systems]]></category><category><![CDATA[Forex Trading]]></category><category><![CDATA[tradingplatfrom]]></category><dc:creator><![CDATA[Nenjo Trades]]></dc:creator><pubDate>Tue, 17 Jun 2025 10:31:53 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1750156247710/a3ddaf70-b227-4536-ac5c-73fbbaf4d71f.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Imagine this: you’re in the middle of an epic coding session, coffee mug half-empty, and your trading bot is spitting out errors like a grumpy cat. You scream internally, "Why did I write this tangled mess of code?!" Been there, done that. But what if I told you there’s a way to avoid this nightmare? Enter SOLID principles, your coding safety net. Let’s explore how these principles can turn your automated trading bot into a masterpiece of maintainability and scalability.</p>
<p><strong>1. Single Responsibility Principle (SRP)</strong></p>
<h3 id="heading-one-job-dude-just-one-job"><strong>"One Job, Dude. Just One Job."</strong></h3>
<p>Picture this: your trading bot is like a team of specialists. Each part has its expertise. The data fetcher doesn’t care about executing trades, and the trade executor isn’t losing sleep over market analysis. That’s SRP in action.</p>
<h4 id="heading-example"><strong>Example:</strong></h4>
<pre><code class="lang-go"><span class="hljs-comment">// SRP: Separate data fetching logic</span>

<span class="hljs-keyword">package</span> datafetcher

<span class="hljs-keyword">type</span> DataFetcher <span class="hljs-keyword">interface</span> {
    FetchMarketData(symbol <span class="hljs-keyword">string</span>) (MarketData, error)
}

<span class="hljs-keyword">type</span> MarketData <span class="hljs-keyword">struct</span> {
    Price <span class="hljs-keyword">float64</span>
    Volume <span class="hljs-keyword">float64</span>
}


<span class="hljs-comment">// SRP: Separate strategy logic</span>
<span class="hljs-keyword">package</span> strategy

<span class="hljs-keyword">import</span> <span class="hljs-string">"yourproject/datafetcher"</span>

<span class="hljs-keyword">type</span> Strategy <span class="hljs-keyword">interface</span> {
    Evaluate(data datafetcher.MarketData) (<span class="hljs-keyword">bool</span>, error)
}


<span class="hljs-comment">// SRP: Separate order execution</span>
<span class="hljs-keyword">package</span> executor

<span class="hljs-keyword">import</span> <span class="hljs-string">"yourproject/strategy"</span>

<span class="hljs-keyword">type</span> Executor <span class="hljs-keyword">interface</span> {
    ExecuteTrade(strategy strategy.Strategy) error
}
</code></pre>
<p>By giving each component a single job, debugging becomes as easy as finding Waldo in a room full of Oompa-Loompas.</p>
<hr />
<h2 id="heading-2-openclosed-principle-ocp"><strong>2. Open/Closed Principle (OCP)</strong></h2>
<h3 id="heading-extend-it-dont-break-it"><strong>"Extend It, Don’t Break It."</strong></h3>
<p>Your bot starts simple: one strategy, one order type. Then you get ambitious. New strategies, multiple order types—chaos, right? Not with OCP.</p>
<h4 id="heading-example-1"><strong>Example:</strong></h4>
<pre><code class="lang-go"><span class="hljs-comment">// Define an interface for strategies</span>

<span class="hljs-keyword">package</span> strategy

<span class="hljs-keyword">type</span> Strategy <span class="hljs-keyword">interface</span> {
    Execute(symbol <span class="hljs-keyword">string</span>) (<span class="hljs-keyword">bool</span>, error)
}


<span class="hljs-comment">// Implement multiple strategies</span>
<span class="hljs-keyword">package</span> strategies

<span class="hljs-keyword">import</span> <span class="hljs-string">"yourproject/strategy"</span>

<span class="hljs-keyword">type</span> MACDStrategy <span class="hljs-keyword">struct</span> {}

<span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-params">(s MACDStrategy)</span> <span class="hljs-title">Execute</span><span class="hljs-params">(symbol <span class="hljs-keyword">string</span>)</span> <span class="hljs-params">(<span class="hljs-keyword">bool</span>, error)</span></span> {
    <span class="hljs-comment">// MACD logic</span>
    <span class="hljs-keyword">return</span> <span class="hljs-literal">true</span>, <span class="hljs-literal">nil</span>
}

<span class="hljs-keyword">type</span> RSIOverboughtStrategy <span class="hljs-keyword">struct</span> {}

<span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-params">(s RSIOverboughtStrategy)</span> <span class="hljs-title">Execute</span><span class="hljs-params">(symbol <span class="hljs-keyword">string</span>)</span> <span class="hljs-params">(<span class="hljs-keyword">bool</span>, error)</span></span> {
    <span class="hljs-comment">// RSI logic</span>
    <span class="hljs-keyword">return</span> <span class="hljs-literal">false</span>, <span class="hljs-literal">nil</span>
}

<span class="hljs-comment">// Add new strategies without touching existing ones!</span>
</code></pre>
<p>Now, you’re adding features without praying your bot doesn’t implode.</p>
<hr />
<h2 id="heading-3-liskov-substitution-principle-lsp"><strong>3. Liskov Substitution Principle (LSP)</strong></h2>
<h3 id="heading-swap-it-like-its-hot"><strong>"Swap It Like It’s Hot."</strong></h3>
<p>Ever tried switching out a part only to realize it breaks everything? LSP ensures you can swap components without chaos.</p>
<h4 id="heading-example-2"><strong>Example:</strong></h4>
<pre><code class="lang-go"><span class="hljs-keyword">package</span> broker

<span class="hljs-keyword">type</span> Broker <span class="hljs-keyword">interface</span> {
    PlaceOrder(symbol <span class="hljs-keyword">string</span>, volume <span class="hljs-keyword">float64</span>, orderType <span class="hljs-keyword">string</span>) error
}


<span class="hljs-comment">// Binance implementation</span>
<span class="hljs-keyword">package</span> binance

<span class="hljs-keyword">import</span> <span class="hljs-string">"yourproject/broker"</span>

<span class="hljs-keyword">type</span> BinanceBroker <span class="hljs-keyword">struct</span> {}

<span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-params">(b BinanceBroker)</span> <span class="hljs-title">PlaceOrder</span><span class="hljs-params">(symbol <span class="hljs-keyword">string</span>, volume <span class="hljs-keyword">float64</span>, orderType <span class="hljs-keyword">string</span>)</span> <span class="hljs-title">error</span></span> {
    <span class="hljs-comment">// Binance API logic</span>
    <span class="hljs-keyword">return</span> <span class="hljs-literal">nil</span>
}


<span class="hljs-comment">// MT5 implementation</span>
<span class="hljs-keyword">package</span> mt5

<span class="hljs-keyword">import</span> <span class="hljs-string">"yourproject/broker"</span>

<span class="hljs-keyword">type</span> MT5Broker <span class="hljs-keyword">struct</span> {}

<span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-params">(m MT5Broker)</span> <span class="hljs-title">PlaceOrder</span><span class="hljs-params">(symbol <span class="hljs-keyword">string</span>, volume <span class="hljs-keyword">float64</span>, orderType <span class="hljs-keyword">string</span>)</span> <span class="hljs-title">error</span></span> {
    <span class="hljs-comment">// MT5 API logic</span>
    <span class="hljs-keyword">return</span> <span class="hljs-literal">nil</span>
}


<span class="hljs-comment">// Use brokers interchangeably</span>
<span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">Trade</span><span class="hljs-params">(b broker.Broker, symbol <span class="hljs-keyword">string</span>, volume <span class="hljs-keyword">float64</span>)</span> <span class="hljs-title">error</span></span> {
    <span class="hljs-keyword">return</span> b.PlaceOrder(symbol, volume, <span class="hljs-string">"BUY"</span>)
}
</code></pre>
<p>Whether you’re trading Bitcoin or gold, your code is ready.</p>
<hr />
<h2 id="heading-4-interface-segregation-principle-isp"><strong>4. Interface Segregation Principle (ISP)</strong></h2>
<h3 id="heading-no-bloat-no-problem"><strong>"No Bloat, No Problem."</strong></h3>
<p>Interfaces shouldn’t feel like Thanksgiving dinner—bloated and hard to handle. ISP keeps things lean.</p>
<h4 id="heading-example-3"><strong>Example:</strong></h4>
<pre><code class="lang-go"><span class="hljs-keyword">package</span> notifier

<span class="hljs-keyword">type</span> EmailNotifier <span class="hljs-keyword">interface</span> {
    SendEmail(subject, body <span class="hljs-keyword">string</span>) error
}


<span class="hljs-keyword">type</span> SMSNotifier <span class="hljs-keyword">interface</span> {
    SendSMS(message, phoneNumber <span class="hljs-keyword">string</span>) error
}


<span class="hljs-comment">// Implement only what’s needed</span>
<span class="hljs-keyword">package</span> notifications

<span class="hljs-keyword">type</span> TradeNotifier <span class="hljs-keyword">struct</span> {}

<span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-params">(t TradeNotifier)</span> <span class="hljs-title">SendEmail</span><span class="hljs-params">(subject, body <span class="hljs-keyword">string</span>)</span> <span class="hljs-title">error</span></span> {
    <span class="hljs-comment">// Email logic</span>
    <span class="hljs-keyword">return</span> <span class="hljs-literal">nil</span>
}

<span class="hljs-comment">// SMS logic isn’t needed for this implementation</span>
</code></pre>
<p>Focus your interfaces like a laser, not a disco ball.</p>
<hr />
<h2 id="heading-5-dependency-inversion-principle-dip"><strong>5. Dependency Inversion Principle (DIP)</strong></h2>
<h3 id="heading-abstract-all-the-things"><strong>"Abstract All the Things."</strong></h3>
<p>Dependencies should work for you, not the other way around. DIP keeps your code flexible.</p>
<h4 id="heading-example-4"><strong>Example:</strong></h4>
<pre><code class="lang-go"><span class="hljs-keyword">package</span> tradingbot

<span class="hljs-keyword">import</span> <span class="hljs-string">"yourproject/broker"</span>

<span class="hljs-keyword">import</span> <span class="hljs-string">"yourproject/strategy"</span>

<span class="hljs-keyword">type</span> Bot <span class="hljs-keyword">struct</span> {
    Broker   broker.Broker
    Strategy strategy.Strategy
}


<span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-params">(b Bot)</span> <span class="hljs-title">Run</span><span class="hljs-params">(symbol <span class="hljs-keyword">string</span>)</span> <span class="hljs-title">error</span></span> {
    decision, err := b.Strategy.Execute(symbol)
    <span class="hljs-keyword">if</span> err != <span class="hljs-literal">nil</span> || !decision {
        <span class="hljs-keyword">return</span> err
    }
    <span class="hljs-keyword">return</span> b.Broker.PlaceOrder(symbol, <span class="hljs-number">1.0</span>, <span class="hljs-string">"BUY"</span>)
}


<span class="hljs-comment">// Inject dependencies</span>
<span class="hljs-keyword">package</span> main

<span class="hljs-keyword">import</span> (
    <span class="hljs-string">"yourproject/binance"</span>
    <span class="hljs-string">"yourproject/strategies"</span>
    <span class="hljs-string">"yourproject/tradingbot"</span>
)


<span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">main</span><span class="hljs-params">()</span></span> {
    bot := tradingbot.Bot{
        Broker:   binance.BinanceBroker{},
        Strategy: strategies.MACDStrategy{},
    }
    bot.Run(<span class="hljs-string">"BTCUSDT"</span>)
}
</code></pre>
<p>Now, you can swap brokers or strategies like you’re changing outfits for a party.</p>
<hr />
<h2 id="heading-conclusion"><strong>Conclusion</strong></h2>
<p>The SOLID principles aren’t just buzzwords; they’re the Avengers of coding practices, ready to save your bot from disaster. With Golang as your hammer, these principles ensure your trading bot is:</p>
<ol>
<li><p>Easy to debug.</p>
</li>
<li><p>Ready to scale.</p>
</li>
<li><p>Resilient to change.</p>
</li>
</ol>
<p>So, go forth and code responsibly. And remember, the only thing worse than spaghetti code is cold spaghetti. What’s your favorite SOLID principle? Share your thoughts (or war stories) in the comments—let’s trade ideas like we trade stocks!</p>
]]></content:encoded></item><item><title><![CDATA[Why I Love TypeScript in Svelte, and the Beauty of SvelteKit Compared to Other JS Frameworks]]></title><description><![CDATA[In the fast-paced world of frontend development, Svelte has emerged as a breath of fresh air, combining simplicity with power. When paired with TypeScript, Svelte becomes an even more formidable tool, offering type safety and enhanced developer exper...]]></description><link>https://nenjotrades.hashnode.dev/why-i-love-typescript-in-svelte-and-the-beauty-of-sveltekit-compared-to-other-js-frameworks</link><guid isPermaLink="true">https://nenjotrades.hashnode.dev/why-i-love-typescript-in-svelte-and-the-beauty-of-sveltekit-compared-to-other-js-frameworks</guid><category><![CDATA[TypeScript]]></category><category><![CDATA[Svelte]]></category><category><![CDATA[Frontend Development]]></category><dc:creator><![CDATA[Nenjo Trades]]></dc:creator><pubDate>Sat, 14 Jun 2025 12:13:37 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1749902901114/553d0e49-93dd-404c-a4ca-91be6fc2ea2b.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In the fast-paced world of frontend development, Svelte has emerged as a breath of fresh air, combining simplicity with power. When paired with TypeScript, Svelte becomes an even more formidable tool, offering type safety and enhanced developer experience. Meanwhile, SvelteKit, the full-stack application framework for Svelte, outshines its counterparts like React and Vue.js in many ways. Let’s dive into why TypeScript in Svelte is a game-changer and explore the beauty of SvelteKit compared to other popular JavaScript frameworks.</p>
<h1 id="heading-why-i-love-typescript-in-svelte"><strong>Why I Love TypeScript in Svelte</strong></h1>
<h2 id="heading-1-type-safety-without-the-noise"><strong>1. Type Safety Without the Noise</strong></h2>
<p>Svelte’s inherently simpler structure pairs beautifully with TypeScript. Defining props, types, and interfaces feels natural and uncluttered compared to other frameworks. The combination helps catch errors early while keeping your codebase clean and maintainable.</p>
<h2 id="heading-example-a-simple-user-component"><strong>Example: A Simple User Component</strong></h2>
<p>Imagine building a component to display user profiles. With TypeScript, you can define clear expectations for the props:</p>
<pre><code class="lang-typescript">&lt;script lang=<span class="hljs-string">"ts"</span>&gt;
<span class="hljs-keyword">export</span> <span class="hljs-keyword">interface</span> User {
   id: <span class="hljs-built_in">number</span>;
   name: <span class="hljs-built_in">string</span>;
   email: <span class="hljs-built_in">string</span>;
}
<span class="hljs-keyword">export</span> <span class="hljs-keyword">let</span> user: User;
&lt;/script&gt;

&lt;div&gt;
    &lt;h2&gt;{user.name}&lt;/h2&gt;
    &lt;p&gt;Email: {user.email}&lt;/p&gt;
&lt;/div&gt;
</code></pre>
<p>In a real-world scenario, this ensures that only valid user data is passed to the component, preventing runtime errors when fetching or rendering user data from APIs.</p>
<h1 id="heading-2-intuitive-syntax-with-powerful-typing"><strong>2. Intuitive Syntax with Powerful Typing</strong></h1>
<p>Unlike JSX or Vue templates, Svelte’s HTML-first approach means you’re writing declarative code that feels intuitive, with TypeScript enhancing it by enforcing data consistency. This reduces cognitive load while working on complex applications.</p>
<h2 id="heading-example-a-todo-app"><strong>Example: A Todo App</strong></h2>
<p>With TypeScript, you can define the structure of your to-dos and ensure type safety throughout:</p>
<pre><code class="lang-typescript">&lt;script lang=<span class="hljs-string">"ts"</span>&gt;
  <span class="hljs-keyword">interface</span> Todo {
    id: <span class="hljs-built_in">number</span>;
    title: <span class="hljs-built_in">string</span>;
    completed: <span class="hljs-built_in">boolean</span>;
  }
  <span class="hljs-keyword">let</span> todos: Todo[] = [
    { id: <span class="hljs-number">1</span>, title: <span class="hljs-string">'Learn Svelte'</span>, completed: <span class="hljs-literal">false</span> },
    { id: <span class="hljs-number">2</span>, title: <span class="hljs-string">'Build a project'</span>, completed: <span class="hljs-literal">false</span> }
  ];
  <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">toggleCompleted</span>(<span class="hljs-params">id: <span class="hljs-built_in">number</span></span>) </span>{
    todos = todos.map(<span class="hljs-function"><span class="hljs-params">todo</span> =&gt;</span>
      todo.id === id ? { ...todo, completed: !todo.completed } : todo
    );
  }
&lt;/script&gt;
&lt;ul&gt;
  {#each todos <span class="hljs-keyword">as</span> todo}
    &lt;li&gt;
      &lt;input <span class="hljs-keyword">type</span>=<span class="hljs-string">"checkbox"</span> bind:checked={todo.completed} on:change={<span class="hljs-function">() =&gt;</span> toggleCompleted(todo.id)} /&gt;
      {todo.title}
    &lt;/li&gt;
  {/each}
&lt;/ul&gt;
</code></pre>
<p>This example demonstrates a small but functional application where TypeScript ensures the consistency and integrity of your data.</p>
<h1 id="heading-3-improved-tooling"><strong>3. Improved Tooling</strong></h1>
<p>With TypeScript, Svelte’s already excellent tooling gets a significant boost. Autocompletion, type-checking, and error detection within IDEs like VS Code ensure you’re more productive and confident in your work. For example, if you mistype a property name in the <code>Todo</code> interface, your IDE will highlight the error immediately.</p>
<h1 id="heading-4-seamless-integration"><strong>4. Seamless Integration</strong></h1>
<p>Using TypeScript in Svelte requires minimal configuration. The community has ensured a smooth developer experience, making it easy to adopt and enjoy TypeScript’s benefits without extensive setup.</p>
<h2 id="heading-real-world-scenario-api-integration"><strong>Real-World Scenario: API Integration</strong></h2>
<p>When fetching data from an external API, TypeScript can define the expected structure, preventing potential issues:</p>
<pre><code class="lang-typescript">&lt;script lang=<span class="hljs-string">"ts"</span>&gt;
  <span class="hljs-keyword">import</span> { onMount } <span class="hljs-keyword">from</span> <span class="hljs-string">'svelte'</span>;
  <span class="hljs-keyword">interface</span> Post {
    id: <span class="hljs-built_in">number</span>;
    title: <span class="hljs-built_in">string</span>;
    body: <span class="hljs-built_in">string</span>;
  }
  <span class="hljs-keyword">let</span> posts: Post[] = [];
  onMount(<span class="hljs-keyword">async</span> () =&gt; {
    <span class="hljs-keyword">const</span> response = <span class="hljs-keyword">await</span> fetch(<span class="hljs-string">'https://jsonplaceholder.typicode.com/posts'</span>);
    posts = <span class="hljs-keyword">await</span> response.json();
  });
&lt;/script&gt;
&lt;ul&gt;
  {#each posts <span class="hljs-keyword">as</span> post}
    &lt;li&gt;
      &lt;h3&gt;{post.title}&lt;/h3&gt;
      &lt;p&gt;{post.body}&lt;/p&gt;
    &lt;/li&gt;
  {/each}
&lt;/ul&gt;
</code></pre>
<p>This ensures that your <code>posts</code> variable matches the expected structure, and any discrepancies are caught at compile time rather than runtime.</p>
<h1 id="heading-the-beauty-of-sveltekit-compared-to-react-and-vuejs"><strong>The Beauty of SvelteKit Compared to React and Vue.js</strong></h1>
<h1 id="heading-1-zero-boilerplate"><strong>1. Zero Boilerplate</strong></h1>
<p>Unlike React (with Next.js) or Vue.js (with Nuxt.js), SvelteKit provides a much cleaner starting point. The lack of excessive boilerplate code means developers can focus on building features rather than managing configuration.</p>
<h2 id="heading-example-file-based-routing"><strong>Example: File-Based Routing</strong></h2>
<p>SvelteKit’s file-based routing is straightforward and intuitive. For instance, creating a new route is as simple as adding a file in the <code>routes</code> directory:</p>
<pre><code class="lang-bash">src/routes
├── index.svelte
├── about.svelte
├── blog
│   └── [slug].svelte
</code></pre>
<p>This simplicity reduces setup time and improves developer productivity.</p>
<h1 id="heading-2-truly-reactive"><strong>2. Truly Reactive</strong></h1>
<p>While React and Vue.js employ reactivity via hooks or computed properties, Svelte’s reactivity is built into its core. Variables automatically update the DOM when they change, making the code more intuitive and less verbose.</p>
<h2 id="heading-example-dynamic-form-handling"><strong>Example: Dynamic Form Handling</strong></h2>
<pre><code class="lang-typescript">&lt;script&gt;
  <span class="hljs-keyword">let</span> formData = { name: <span class="hljs-string">''</span>, email: <span class="hljs-string">''</span> };
  <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">handleSubmit</span>(<span class="hljs-params"></span>) </span>{
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'Form submitted:'</span>, formData);
  }
&lt;/script&gt;
&lt;form on:submit|preventDefault={handleSubmit}&gt;
  &lt;input <span class="hljs-keyword">type</span>=<span class="hljs-string">"text"</span> bind:value={formData.name} placeholder=<span class="hljs-string">"Name"</span> /&gt;
  &lt;input <span class="hljs-keyword">type</span>=<span class="hljs-string">"email"</span> bind:value={formData.email} placeholder=<span class="hljs-string">"Email"</span> /&gt;
  &lt;button <span class="hljs-keyword">type</span>=<span class="hljs-string">"submit"</span>&gt;Submit&lt;/button&gt;
&lt;/form&gt;
</code></pre>
<p>This simplicity makes it easier to build dynamic and interactive applications.</p>
<h1 id="heading-3-built-in-optimizations"><strong>3. Built-In Optimizations</strong></h1>
<p>SvelteKit’s approach to rendering — whether it’s SSR (Server-Side Rendering), SSG (Static Site Generation), or client-side — is seamless and highly performant out of the box. This contrasts with the sometimes-cumbersome configurations required in React and Vue.js ecosystems.</p>
<h1 id="heading-4-smaller-bundle-sizes"><strong>4. Smaller Bundle Sizes</strong></h1>
<p>Svelte’s compiler approach eliminates the runtime overhead common in React and Vue.js, resulting in significantly smaller bundle sizes and faster load times. For businesses, this translates into better SEO and user retention.</p>
<h1 id="heading-5-simplified-state-management"><strong>5. Simplified State Management</strong></h1>
<p>State management in Svelte is refreshingly straightforward, with no need for additional libraries like Redux or Vuex. Svelte’s writable stores provide a lightweight, built-in solution for managing global state.</p>
<h2 id="heading-example-shared-state-across-components"><strong>Example: Shared State Across Components</strong></h2>
<pre><code class="lang-typescript"><span class="hljs-comment">// store.ts</span>
<span class="hljs-keyword">import</span> { writable } <span class="hljs-keyword">from</span> <span class="hljs-string">'svelte/store'</span>;
<span class="hljs-keyword">export</span> <span class="hljs-keyword">const</span> count = writable(<span class="hljs-number">0</span>);

&lt;!-- Counter.svelte --&gt;
&lt;script&gt;
  <span class="hljs-keyword">import</span> { count } <span class="hljs-keyword">from</span> <span class="hljs-string">'./store'</span>;
&lt;/script&gt;

&lt;button on:click={<span class="hljs-function">() =&gt;</span> count.update(<span class="hljs-function"><span class="hljs-params">n</span> =&gt;</span> n + <span class="hljs-number">1</span>)}&gt;Increment&lt;/button&gt;
&lt;p&gt;Count: {$count}&lt;/p&gt;
</code></pre>
<p>This simplicity is a significant advantage for teams and solo developers alike.</p>
<h1 id="heading-why-choose-sveltekit-and-typescript"><strong>Why Choose SvelteKit and TypeScript?</strong></h1>
<p>The combination of SvelteKit and TypeScript represents the best of both worlds — a modern framework designed for simplicity and speed, paired with a robust type system that ensures reliability and scalability. Whether you’re building a personal project or a production-grade application, this stack is worth considering.</p>
<p>What’s your experience with SvelteKit and TypeScript? Let’s discuss in the comments below!</p>
]]></content:encoded></item></channel></rss>