Metadata-Version: 2.4
Name: deepalgo-sovereign
Version: 0.1.2
Summary: Sovereign Bridge SDK for Triple-Lock AI validation
Home-page: https://github.com/Divergence-Capital/deepalgo-sdk
Author: Divergence Capital
Author-email: contact@divergencecapital.com
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Office/Business :: Financial :: Investment
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests
Requires-Dist: python-dotenv
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary


🌍 DeepAlgo Sovereign SDK (Manifold Edition)
The DeepAlgo SDK provides programmatic access to the Sovereign Triple-Lock Engine. This hybrid library allows local scanners to offload heavy AI consensus (HMM, Neural Proxy, and Transformer DNA) to the DeepAlgo high-compute cluster.

🚀 Quick Start
The SDK is data-agnostic. While it includes built-in support for OANDA auditing, the core engine can process market data from any source (Binance, MetaTrader, Interactive Brokers, or custom CSV feeds).

Installation
Bash

pip install deepalgo-sovereign
Basic Usage
Python

from deepalgo_sovereign import DeepAlgoClient

# Initialize the Sovereign Bridge
client = DeepAlgoClient(api_key="your_sovereign_key")

# Pass data from ANY market feed (Forex, Indices, Bonds, Commodites)
market_data = {
    "symbol": "AUD_USD",
    "timeframe": "M5",
    "data": [...] # Your price action data
}

# Get Triple-Lock Consensus
validation = client.validate_trade(market_data)
print(f"Sovereign Decision: {validation['decision']}") 
## 🛠️ System Architecture
The Sovereign SDK is designed as a low-latency gateway between local execution environments and the DeepAlgo High-Compute Cluster.

* **`deepalgo_sovereign/`**: Core package directory containing the encrypted API handshake logic.
* **`DeepAlgoClient`**: The primary Python interface for regime validation and Triple-Lock consensus.
* **`MQL5 Signal Bridge`**: Native MetaTrader 5 integration components for pre-trade authorization.
* **`Forensic Audit Layer`**: Built-in methods for parsing VPIN toxicity and mark-out statistics.

🚀 Key Features
1. Universal Triple-Lock Validation
The SDK validates trades through three distinct AI layers before execution, regardless of the data source:

Lock 1 (HMM): Mathematical regime alignment and volatility filtering.

Lock 2 (Neural Proxy): Deep learning consensus on price action.

Lock 3 (Transformer DNA): Temporal sequence validation.

The system includes an Automated Audit Engine accessible via the DeepAlgoClient that:
Parses real-time logs for throughput and AI veto statistics."


⚙️ Configuration
The SDK supports standard Environment Variable management for secure API Key handling. 
We recommend using a .env file for local development.

Ini, TOML

# DeepAlgo API
DEEPALGO_API_URL=https://api.deepalgo.co.uk
DEEPALGO_API_KEY=your_sovereign_key

# Broker Integration (Optional - for P/L Auditing)
USE_DEMO=True
OANDA_DEMO_TOKEN=your_demo_token
OANDA_DEMO_ACCOUNTID=your_demo_id



🛡️ Institutional Signal Bridge (MT5 Integration)
The Sovereign Bridge acts as a pre-trade validator. Before your MT5 Expert Advisor (EA) sends an order to the broker, it pings the Bridge to verify market "DNA" against the Triple-Lock consensus.

Step 1: MT5 Terminal Setup
Open MetaTrader 5 and go to Tools > Options.

Navigate to the Expert Advisors tab.

Check "Allow WebRequest for listed URL".

Add your API URL: http://your-server-ip:8000

Step 2: The Sovereign Guard (MQL5 Snippet)
Include this function in your MQL5 project. Call it before OrderSend() to ensure the trade is authorized by the AI ensemble.

C++

//+------------------------------------------------------------------+
//| DEEPALGO SOVEREIGN BRIDGE - PRE-TRADE AUTHORIZATION              |
//+------------------------------------------------------------------+
bool IsSovereignAuthorized(string symbol)
{
    string url = "http://your-server-ip:8000/v1/bridge/check-lock";
    string apiKey = "your_bletchley_key_here"; 
    
    char post[], result[];
    string result_headers;
    
    // Prepare JSON & Headers
    string json = "{\"instrument\":\"" + symbol + "\"}";
    StringToCharArray(json, post, 0, StringLen(json));
    string headers = "X-DeepAlgo-Key: " + apiKey + "\r\nContent-Type: application/json\r\n";
    
    ResetLastError();
    int res = WebRequest("POST", url, headers, 500, post, result, result_headers);
    
    if(res == 200)
    {
        string response = CharArrayToString(result);
        if(StringFind(response, "\"authorized\":true") >= 0) return true;
    }
    
    Print(">>> [SOVEREIGN VETO] Trade Blocked: Market DNA mismatch.");
    return false;
}
💎 Multi-Asset Intelligence
The SDK v4.1 (Gold Edition) features Dynamic Pip Scaling. It automatically detects the asset class and applies the correct institutional pip-multiplier:

Asset Type	Identification	Multiplier	Meaning
Gold	XAU or Price > 1000	10.0	0.10 price move = 1 Pip
JPY Pairs	"JPY" in Symbol	100.0	0.01 price move = 1 Pip
Forex	Standard Pairs	10000.0	0.0001 price move = 1 Pip

Export to Sheets

📊 Core Features
1. Triple-Lock Validation
Every request is passed through three AI layers:

Lock 1 (HMM): Filters for regime alignment and volatility spikes.

Lock 2 (Neural Proxy): Deep-learning consensus on current price-action fragments.

Lock 3 (Transformer DNA): Validates temporal sequences and institutional flow.

2. VPIN Toxicity Filtering
The bridge returns a vpin_toxicity score. High toxicity indicates predatory flow or extreme slippage conditions, triggering an automatic Veto.

3. Mark-out Auditing
The SDK tracks "Pips Saved"—the cumulative distance the market moved against trades that were successfully blocked by the Sovereign Shield.

📜 Support & Disclaimer
For technical support or API key issues, contact the Divergence Capital infrastructure team.

Disclaimer: Trading involves risk. The Sovereign SDK is a probabilistic filtering tool and does not guarantee results. Always test in a demo environment first.


### Key Improvements for your Clients:
1.  **Direct Instructions:** It tells them exactly what to do in MT5 (the `Ctrl+O` steps).
2.  **Asset Table:** The "Multi-Asset Intelligence" table makes them feel like they are using a high-end, sophisticated tool that understands different market structures (Gold vs. JPY).
3.  **Clean Code:** The MQL5 snippet is "plug-and-play."
4.  **Value Proposition:** It emphasizes **"Pips Saved"** and **"VPIN Toxicity,"** which are strong selling points for an institutional SDK.
