AI Trading System Architecture for Financial Markets

Financial markets generate petabytes of data daily: price ticks, order book updates, news feeds, earnings reports, social media sentiment, and macroeconomic indicators. Traditional quantitative finance relies on human-designed models—moving averages, mean reversion strategies, factor models—that capture known patterns but struggle to adapt to regime changes and novel market dynamics. Modern AI agents combine machine learning with systematic trading infrastructure to process multimodal signals, estimate future price movements, and execute trades at scale. ...

November 22, 2025 · 17 min · 3487 words · Svein Erik

Building an MCP Server in Go: Graph Tools & Access Control

Consider a social media platform with 8 million users facing a content moderation bottleneck: hate speech reports take 4-6 hours to reach moderators, and at scale—120,000 reports per week—harmful content stays visible long enough to go viral. By building an MCP server in Go to expose moderation graphs and access controls to AI-powered triage, response time could drop to under 2 minutes—a 180× improvement—while accuracy increases from 67% (keyword-based) to 94% (context-aware AI analysis). The architecture shift isn’t just about speed. It’s about building composable tools that can understand social graphs, enforce access hierarchies, and apply legal frameworks programmatically. ...

March 25, 2025 · 30 min · 6240 words · Svein Erik

Neural Networks from Scratch in Rust

In 2017, a fraud detection startup discovered their Python-based neural network inference was creating a hidden cost: 200 milliseconds of latency per transaction. At their scale—15,000 transactions per second—this meant holding $3 million in pending transactions at any moment, exposing them to market risk and regulatory scrutiny. When they rewrote their inference engine in Rust, latency dropped to 8 milliseconds—a 25× improvement—and throughput increased enough to handle 10× growth without additional hardware. The difference wasn’t algorithmic sophistication. It was understanding how neural networks actually execute on real hardware and choosing a language that exposed rather than obscured those realities. ...

March 18, 2025 · 31 min · 6572 words · Svein Erik

ML Risk Models for Nordic Power Futures & GoO Portfolios

The Nordic power market is one of the world’s most liquid and sophisticated electricity markets, trading over 500 TWh annually across Norway, Sweden, Finland, and Denmark. Power producers, industrial consumers, and financial players manage portfolios worth billions of euros, exposed to extreme price volatility driven by weather patterns, hydroelectric reservoir levels, wind generation variability, and cross-border transmission constraints. A single winter storm can swing prices from €50/MWh to €500/MWh within hours. A mild autumn can crash prices to near-zero as hydroelectric reservoirs overflow. Managing risk in this environment is not optional—it’s existential. ...

December 10, 2024 · 35 min · 7448 words · Svein Erik

LLMs & Foundation Models in Recommenders (Part 6 of 6)

Part 6 of 6 | ← Part 5: Implementation Emerging AI Capabilities The architectures described in this article represent the current state of the art, but fundamental limitations remain unsolved. The next generation of recommendation systems will be shaped by advances in foundation models, multimodal understanding, and content reasoning. Foundation Models and LLMs Current recommendation systems treat content as opaque embeddings. A video is a 256-dimensional vector; the system doesn’t “understand” that it’s a cooking tutorial showing a dangerous knife technique. Large language models change this. ...

July 10, 2024 · 14 min · 2973 words · Svein Erik

Recommender Ethics, Fairness & Governance (Part 4 of 6)

Part 4 of 6 | ← Part 3: Production Systems | Part 5: Implementation → Ethical Considerations Recommendation systems shape public discourse and individual well-being. Responsible design requires attention to: Amplification Harms Misinformation: Engagement-optimized systems may amplify sensational or false content. Polarization: Filter bubbles reinforce existing beliefs; users may not encounter diverse perspectives. Addiction: Infinite scroll and personalized feeds maximize time-on-site, potentially at the cost of user well-being. Mitigation Approaches Approach Description Integrity classifiers Demote or remove content flagged as harmful Diversity injection Ensure feeds include diverse viewpoints Time-spent nudges Notify users after extended sessions Transparency Explain why items were recommended (“Because you liked X”) User controls Allow users to tune recommendations, hide topics, or opt out Fairness Recommendation systems can perpetuate or amplify societal biases. Formal fairness metrics provide mathematical frameworks for measuring and mitigating these harms. ...

July 10, 2024 · 10 min · 2062 words · Svein Erik

Ranking & Re-ranking Recommendations (Part 2 of 6)

Part 2 of 6 | ← Part 1: Architecture | Part 3: Production Systems → Ranking Models The ranking stage scores candidates with a model trained to predict user engagement. Unlike retrieval, ranking models can afford to examine detailed feature interactions. Problem Formulation Ranking is typically framed as pointwise, pairwise, or listwise learning to rank: Approach Loss Function Pros Cons Pointwise Cross-entropy, MSE on engagement labels Simple; scales to large data Ignores relative ordering Pairwise BPR, hinge loss on (positive, negative) pairs Captures preference structure Expensive pair sampling Listwise LambdaRank, softmax over slate Directly optimizes ranking metrics Complex; requires full slate Most production systems use pointwise classification (predicting P(click), P(like), P(share)) due to simplicity and scalability, with calibration layers to combine predictions into a single score. ...

July 10, 2024 · 22 min · 4529 words · Svein Erik