by ABXK.AI AI Trading

AI Trading Platform: Security Audit & Major System Updates

machine-learningtradingsecurityaccessibilitypythonneural-networks

What’s New Since Our Optimization Breakthrough?

In our last post, we celebrated reaching a 2.77 Profit Factor through careful stop-loss optimization. Now we’ve taken a step back to audit the entire platform from top to bottom.

The result? One critical security fix, several accessibility improvements, and some interesting live statistics from over 33,000 analyzed trades.

The Audit Process

We conducted a full review of:

  • Core trading functions and ML models
  • Database and data flow
  • Flask API endpoints
  • Frontend HTML/CSS/JS
  • Test coverage (20/20 tests passing checkmark)

Let’s walk through what we found and fixed.


1. Critical Security Fix

The Problem: Unsafe Model Loading

Our Transformer model was loading saved checkpoints with weights_only=False. This setting allows arbitrary code execution through Python’s pickle deserialization.

Why is this dangerous? If someone replaces your model file with a malicious one, it could run any code when loaded. This is a known vulnerability (OWASP A08:2021 - Software and Data Integrity Failures).

The Fix

# Before (VULNERABLE)
checkpoint = torch.load(model_path, weights_only=False)

# After (SECURE)  
checkpoint = torch.load(model_path, weights_only=True)

Key lesson: Always use weights_only=True when loading PyTorch models. It prevents code injection attacks.


2. Live Platform Statistics

Here’s what our platform has learned from real market data:

Overall Numbers

MetricValue
Total Trades Analyzed33,465
Winning Trades3,943
Overall Win Rate11.8%
Average AI Confidence57.9%
Average Result+0.26%
Winning Patterns Found8
Confidence Weights Learned180

Breakdown by Asset Type

Asset TypeTradesWinsWin Rate
USA Stocks19,2102,49013.0%
Asia Stocks5,31756610.6%
Crypto4,44046910.6%
Commodities1,76219511.1%
Stock (General)1,8401618.8%
Indices895626.9%
Forex100.0%

Key insight: USA stocks show the highest win rate at 13%. Indices are the hardest to predict at 6.9%.


3. Neural Network Architecture

Our platform uses two neural networks working together:

LSTM Model (Original)

ParameterValue
Input Features28
Hidden Size128
Layers2
Total Parameters363,778
Model File Size4.3 MB

Transformer Model (Newer)

ParameterValue
Input Features35
d_model (hidden)128
Attention Heads8
Layers4
Total Parameters545,281
Model File Size6.5 MB

The Transformer uses 7 additional “discriminating” features designed to separate winners from losers:

  1. Trend strength score — ADX × |DI difference|
  2. Momentum alignment — MACD + RSI agreement
  3. Extreme indicator — RSI < 30 or > 70
  4. Volume surge — Volume ratio above normal
  5. Ichimoku-MACD alignment — Multi-indicator confirmation
  6. Stochastic-RSI agreement — Both oscillators aligned
  7. DI crossover strength — Direction of trend

4. System Architecture Diagram

The diagram below shows how data flows through our platform: market data enters from the left, gets processed through indicator calculations and feature extraction, then feeds into our dual neural network layer (LSTM + Transformer). The models generate trading signals that are validated by the backtester, stored in our database, and exposed via the Flask API.

ABXK.AI Trading Platform Architecture Diagram
Complete system architecture showing data flow from market feeds to trading signals.

5. What We Learned About Indicator Performance

The platform tracks which indicators perform best. All indicators have learned weights of 2.5 across timeframes, with hundreds of thousands of samples each:

IndicatorTimeframeSamples
RSI1h358,168
MACD1h358,168
Bollinger1h358,168
MA Trend1h358,168
Ichimoku1h358,168
RSI4h337,977
MACD4h337,977
RSI1d51,654

Key finding: The 1-hour and 4-hour timeframes have the most data. Daily timeframes have fewer samples but remain useful.


6. Changes Summary

FileWhat Changed
transformer_trader.pySecurity fix: weights_only=True
database.pyFixed deprecated SQLAlchemy import
index.htmlSEO, Schema.org, accessibility, mobile

7. What Comes Next

Based on this audit, here are our priorities:

Short Term

  1. Add API authentication (JWT tokens)
  2. Implement Redis caching for market data
  3. Add PWA support for mobile apps

Medium Term

  1. Cross-validation for model training
  2. Model versioning with rollback
  3. End-to-end integration tests

Long Term

  1. Real-time WebSocket updates
  2. Multi-strategy portfolio management
  3. Risk management dashboard

Conclusion

This audit found one critical security issue that we fixed immediately. We also improved accessibility for all users and collected insights from 33,000+ trades.

The platform is now more secure, more accessible, and continues to learn from every trade it analyzes.

Remember: USA stocks show the best win rate (13%), and the Transformer model with its 35 features provides better discrimination than the LSTM alone.


Security and accessibility aren’t optional features—they’re the foundation of any serious trading platform.

AI Trading Platform Blog

Read our development journey and latest updates:

AI Trading Platform: Adding CI/CD to Our Development Workflow
AI Trading

AI Trading Platform: Adding CI/CD to Our Development Workflow

We implemented a CI/CD pipeline for the AI Trading Platform. This post documents the approach, the types of bugs it catches, and why automated testing matters …

AI tradingCI/CDautomated testing
AI Adoption in Trading: Why Acting Now Matters
AI Trading

AI Adoption in Trading: Why Acting Now Matters

AI adoption in trading is accelerating. Learn why firms that act now gain an advantage, and how our AI trading platform validates this approach through real …

AI tradingtrading technologypaper trading
AI Trading Platform: Choosing the Right Markets and Trading Style
AI Trading

AI Trading Platform: Choosing the Right Markets and Trading Style

We tested our frozen v0.3 exit strategy across different markets and trading styles. Here is what we learned about CFDs, futures, stocks, and why swing trading …

AI tradingfutures tradingCFD trading
AI Trading Platform: Exit Strategy Breakthrough & Paper Trading System
AI Trading

AI Trading Platform: Exit Strategy Breakthrough & Paper Trading System

Our AI trading platform improved expectancy from near-zero to statistically meaningful levels through a two-stage exit strategy. We also built a causal paper …

machine-learningtradingexit-strategy
AI Trading Platform: Observing Model Behavior During Strategy Optimization
AI Trading

AI Trading Platform: Observing Model Behavior During Strategy Optimization

A research note documenting how iterative changes affected model behavior, risk distribution, and evaluation metrics.

machine-learningtradingbacktesting
AI Trading Platform Update: Building a Bulletproof Evaluation Framework
AI Trading

AI Trading Platform Update: Building a Bulletproof Evaluation Framework

Two days of intensive work on preventing overfitting and data leakage. Here's what we built and what we learned.

machine-learningtradingbacktesting
Building an AI Trading Platform: Our Progress So Far
AI Trading

Building an AI Trading Platform: Our Progress So Far

We are building an AI trading system that learns from its mistakes. Here is what we have done, what works, and what problems we still need to solve.

machine-learningtradingneural-networks
⚠️ Important Notice

The AI Trading Platform is an internal research project operated exclusively by ABXK.AI. It is not publicly accessible and cannot be used by visitors.

Any results, insights, or examples shared on this website or on social media are provided for informational and educational purposes only and do not constitute financial advice.