Zing Forum

Reading

DeepStock: An AI Stock Prediction System Running Purely in the Browser

DeepStock is a stock prediction system powered by a neural network with only 410,000 parameters, running securely in the browser. It requires no server or API key, all computations are done locally, and it supports predictions across 6 time horizons.

边缘AI股票预测神经网络浏览器端机器学习模型压缩隐私保护金融AIJavaScript
Published 2026-06-02 06:10Recent activity 2026-06-02 06:19Estimated read 7 min
DeepStock: An AI Stock Prediction System Running Purely in the Browser
1

Section 01

DeepStock: An AI Stock Prediction System Running Purely in the Browser (Introduction)

Key Takeaways: DeepStock v7 is a neural network system with only 411K parameters, running entirely in the browser. It requires no server or API key, all computations are done locally, and it supports stock predictions across 6 time horizons from 1 day to 1 year. Privacy protection is its core advantage. The project was developed by WheatleyCoder, open-sourced on GitHub, and released on June 1, 2026.

2

Section 02

Project Background and Philosophy

The most distinctive feature of DeepStock is its privacy-first design. Most AI financial tools rely on cloud computing, which may lead to user data being collected; however, DeepStock runs in the browser and uses pure JS for inference, so user data never leaves the local device. Project Overview: Supports predictions across 6 time horizons, with a small but fully functional model. Original Author/Maintainer: WheatleyCoder, Source Platform: GitHub, Original Link: https://github.com/WheatleyCoder/deepstock.

3

Section 03

Technical Architecture and Feature Engineering

Technical Architecture: Input layer processes 148-dimensional features (LayerNorm normalization) → Conditional embedding (FiLM technique injects time horizon and industry classification) → Core component: feature-grouped self-attention (4 groups to reduce complexity) → 4 gated residual blocks → 6 multi-scale prediction heads (corresponding to different time horizons) → Output layer (direction prediction, return magnitude, confidence).

Feature Engineering: The 148-dimensional indicators are divided into 5 categories: Momentum (RSI, MACD, etc.), Volatility (ATR, etc.), Volume (OBV, etc.), Fundamentals (P/E ratio, etc.), and Macro (interest rates, etc.). Data is obtained from the Yahoo Finance API (accessed via CORS proxy).

4

Section 04

Training Data and Model Performance

Training Data: Covers 690 stocks, 500,000 samples from 10 years of historical data.

Performance: Short-term (1 day) direction accuracy: 55.8%, long-term (1 year) up to 62.2%, comprehensive score: 0.5742 (38th epoch).

Training Techniques: Focal Loss to address class imbalance; asymmetric threshold setting for a wider sell interval; multi-scale bottleneck heads to allocate more expressive power to long-term predictions. The developer explicitly labels it as an experimental model for educational purposes.

5

Section 05

Technical Challenges in Browser-side Implementation

Key Challenges and Solutions: 1. Model Compression: Float16 quantization, weights compressed to ~1.2MB, stored in base64 to reduce transmission size; 2. Pure JS Implementation: No dependency on frameworks like TensorFlow.js, all operators (LayerNorm, FiLM, grouped attention, etc.) implemented from scratch; 3. Performance Optimization: Potential use of Web Workers to move inference to background threads, maintaining UI responsiveness; 4. Numerical Stability: Ensure consistency between JS double-precision floats and PyTorch single-precision floats.

6

Section 06

Limitations and Usage Recommendations

Limitations: 1. Limited to historical data patterns (non-stationary markets, black swan events may render it ineffective); 2. Limited accuracy (62.2% for 1-year predictions still has nearly 40% error rate, cannot be relied on alone); 3. Data delay (free Yahoo Finance data has delays); 4. No risk management (no position management, stop-loss, etc.).

Usage Recommendations: Only use as an educational experimental tool to assist thinking; do not replace professional investment advice.

7

Section 07

Project Significance and Summary

Project Significance: Demonstrates a new paradigm for edge AI (model compressed to run on edge devices, eliminating cloud dependency), with natural advantages in privacy-sensitive scenarios (finance, healthcare); provides a learning case for machine learning engineers (architecture design under resource constraints, engineering deployment).

Summary: DeepStock is an open-source project with exquisite technology and advanced philosophy, reflecting a responsible development attitude (frankly disclosing limitations). It is a learning resource for developers and an interesting experimental tool for ordinary users.