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

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.

Important: 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.