<?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>Forem: Dany Trakhtenberg</title>
    <description>The latest articles on Forem by Dany Trakhtenberg (@dany_trakhtenberg).</description>
    <link>https://forem.com/dany_trakhtenberg</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%2F1671656%2Fafcaa37e-cc6d-4abc-b93b-444a260c1e51.jpg</url>
      <title>Forem: Dany Trakhtenberg</title>
      <link>https://forem.com/dany_trakhtenberg</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/dany_trakhtenberg"/>
    <language>en</language>
    <item>
      <title>I Built a Risk-Driven Stock Portfolio Optimizer (And What I Learned)</title>
      <dc:creator>Dany Trakhtenberg</dc:creator>
      <pubDate>Thu, 25 Dec 2025 01:07:44 +0000</pubDate>
      <link>https://forem.com/dany_trakhtenberg/i-built-a-risk-driven-stock-portfolio-optimizer-and-what-i-learned-49ai</link>
      <guid>https://forem.com/dany_trakhtenberg/i-built-a-risk-driven-stock-portfolio-optimizer-and-what-i-learned-49ai</guid>
      <description>&lt;p&gt;Like many developers, I’ve seen a lot of “portfolio builder” tools that promise outperformance with vague AI claims or black-box optimization.&lt;/p&gt;

&lt;p&gt;I wanted to explore a different angle:&lt;/p&gt;

&lt;p&gt;What if risk controlled portfolio structure — not just which stocks are labeled “risky”?&lt;/p&gt;

&lt;p&gt;So I built StockRisker, a risk-driven stock portfolio optimizer that focuses on constraints, explainability, and realistic tradeoffs rather than guarantees.&lt;/p&gt;

&lt;p&gt;👉 Live demo: &lt;a href="https://stockrisker.com/build" rel="noopener noreferrer"&gt;https://stockrisker.com/build&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F439vs52mrw2803u6uamg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F439vs52mrw2803u6uamg.png" alt=" " width="800" height="1176"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The Core Idea&lt;/p&gt;

&lt;p&gt;Most retail investing tools treat risk as a side effect:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Higher risk → “riskier stocks”&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Lower risk → “safer stocks”&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In practice, that’s not how portfolios behave.&lt;/p&gt;

&lt;p&gt;Risk tolerance usually affects:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;How concentrated you’re willing to be&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;How much sector exposure you allow&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;How asymmetric your allocations can get&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So in StockRisker:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
Risk directly controls portfolio constraints&lt;/li&gt;
&lt;li&gt;
Higher risk = fewer penalties, higher concentration caps&lt;/li&gt;
&lt;li&gt;
Lower risk = stricter diversification rules&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Risk isn’t just a label — it’s a structural input.&lt;/p&gt;

&lt;p&gt;How the Optimizer Works (High Level)&lt;/p&gt;

&lt;p&gt;The optimizer is built around three layers:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Risk Mapping&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A user selects a risk level (1–10).&lt;br&gt;
That value dynamically controls:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Max allocation per stock&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Max allocation per sector&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Strength of diversification penalties&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;At high risk levels, penalties are relaxed instead of forcing “safe” portfolios that don’t match user intent.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Constraint-Driven Portfolio Generation&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Portfolios are evaluated under:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Hard constraints (must never be violated)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Soft constraints (applied as scoring penalties)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This avoids a common failure mode where optimization technically succeeds but produces unrealistic portfolios.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Explainable Scoring&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Each portfolio is scored using a weighted function that balances:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Expected return estimates&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Volatility and diversification&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Concentration and sector exposure&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If results look suspicious (e.g., very high return vs relatively low volatility), the UI surfaces contextual warnings instead of hiding the risk.&lt;/p&gt;

&lt;p&gt;No “guaranteed outperformance” messaging.&lt;/p&gt;

&lt;p&gt;What I Optimized Against&lt;/p&gt;

&lt;p&gt;One of the most interesting challenges wasn’t math — it was expectation management.&lt;/p&gt;

&lt;p&gt;Some things I intentionally avoided:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;No promise to beat the S&amp;amp;P 500&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;No opaque AI model&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;No single “correct” portfolio&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Instead, the tool helps users reason about tradeoffs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Concentration vs diversification&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Risk appetite vs volatility&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Simplicity vs optimization&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Tech Stack&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Backend: TypeScript + Node.js&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Modular optimizer design (risk mapping → constraints → scoring)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Cached stock universes for performance and stability&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Frontend: Clean, minimal UI focused on clarity and explainability&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The architecture is designed to support future extensions like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Backtesting&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Risk-adjusted metrics (Sharpe, drawdown)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Scenario simulations&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What I Learned&lt;/p&gt;

&lt;p&gt;Risk is a UX problem, not just a math problem&lt;br&gt;
Users need to understand why a portfolio looks the way it does.&lt;/p&gt;

&lt;p&gt;Constraints matter more than algorithms&lt;br&gt;
A simple optimizer with good constraints beats a complex one without them.&lt;/p&gt;

&lt;p&gt;Transparency builds trust faster than performance claims&lt;br&gt;
Surfacing limitations actually increases confidence. &lt;/p&gt;

</description>
      <category>algorithms</category>
      <category>datascience</category>
      <category>showdev</category>
    </item>
    <item>
      <title>Introducing the Schengen Area Calculator: Plan Your European Travels Seamlessly</title>
      <dc:creator>Dany Trakhtenberg</dc:creator>
      <pubDate>Sun, 23 Jun 2024 20:19:22 +0000</pubDate>
      <link>https://forem.com/dany_trakhtenberg/introducing-the-schengen-area-calculator-plan-your-european-travels-seamlessly-398k</link>
      <guid>https://forem.com/dany_trakhtenberg/introducing-the-schengen-area-calculator-plan-your-european-travels-seamlessly-398k</guid>
      <description>&lt;p&gt;Are you planning a trip to Europe and worried about the 90/180-day Schengen visa rule? Meet the &lt;a href="https://schengen90.com" rel="noopener noreferrer"&gt;Schengen Area Calculator&lt;/a&gt; – your ultimate tool for tracking stays and ensuring compliance with the Schengen visa regulations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is the Schengen Area Calculator?&lt;/strong&gt;&lt;br&gt;
The Schengen Area Calculator is a web-based tool designed to help travelers like tourists or digital nomads to track their stays within the Schengen Area. This tool ensures that you comply with the 90/180-day rule, preventing overstaying, fines, or even bans from the Schengen countries.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Features&lt;/strong&gt;&lt;br&gt;
Stay Tracking: Log your entry and exit dates for every trip to the Schengen Area. The calculator keeps track of your stays and alerts you if you are close to violating the 90/180-day rule.&lt;br&gt;
Violation Alerts: Receive instant notifications if your planned stays exceed the allowed duration, helping you avoid potential issues with visa regulations.&lt;br&gt;
Visual Timeline: Our interactive Schengen Chart offers a visual representation of your stays, giving you a clear overview of your travel history and future plans.&lt;br&gt;
Country Information: Access detailed information about each Schengen country, including visa requirements and exemptions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How It Works&lt;/strong&gt;&lt;br&gt;
Input Your Stays: Enter the dates of your stays within the Schengen Area, including the start and end dates of each stay and the country visited.&lt;br&gt;
Track Your Stays: The calculator will automatically track your stays and calculate the total duration of your stays within the last 180 days.&lt;br&gt;
Receive Alerts: If you are close to or have exceeded the allowed 90 days, the tool will alert you, ensuring you can take action to avoid any issues.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;New Feature: Days Left Calculator&lt;/strong&gt;&lt;br&gt;
We recently added a feature to calculate the last day you can stay in the Schengen Area if you want to maximize your 90 days. This feature helps you plan your trip efficiently by showing the remaining days starting from a specific stay and the next possible entry date after the 180-day period.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why Use the Schengen Area Calculator?&lt;/strong&gt;&lt;br&gt;
Avoid Overstaying: Stay within the legal limits and avoid fines or bans.&lt;br&gt;
Plan Efficiently: Use the tool to plan your trips and make the most of your stay in Europe.&lt;br&gt;
Peace of Mind: Travel with confidence, knowing that you are complying with visa regulations.&lt;br&gt;
&lt;a href="https://schengen90.com/" rel="noopener noreferrer"&gt;https://schengen90.com&lt;/a&gt;&lt;br&gt;
Planning a trip to Europe? Check out the Schengen Area Calculator and start tracking your stays today!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Technical Implementation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Frontend&lt;/strong&gt;&lt;br&gt;
The frontend is built using React and Next.js, which allows for server-side rendering and static site generation, improving SEO and performance.&lt;br&gt;
React: Used for building the user interface, ensuring a responsive and interactive experience.&lt;br&gt;
Next.js: Utilized for its server-side rendering capabilities, which enhance SEO and load times.&lt;br&gt;
React Bootstrap: For styling and responsive design, making the tool accessible on both desktop and mobile devices.&lt;br&gt;
Firebase Authentication: Implemented for user login and data persistence, allowing users to save their travel data securely.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Backend&lt;/strong&gt;&lt;br&gt;
The backend leverages Firebase for both hosting and database services.&lt;br&gt;
Firebase Firestore: Stores user data, including travel dates and country information, ensuring secure and scalable data management.&lt;br&gt;
Moment.js: For date manipulation and formatting, making it easy to calculate durations and validate dates.&lt;br&gt;
react-dates: Provides a robust date picker component, ensuring users can easily select their travel dates.&lt;br&gt;
react-helmet: Manages meta tags for SEO, improving the visibility of the tool on search engines.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Feedback and Support&lt;/strong&gt;&lt;br&gt;
We'd love to hear your feedback! If you have any questions or suggestions, please feel free to reach out.&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>react</category>
      <category>tooling</category>
      <category>firebase</category>
    </item>
  </channel>
</rss>
