Alpha Quant Pro AQP Bundle Development Guide
This page follows the current production contract: AQP Bundle Manifest v2.
1. Canonical Contract
| Concept | Current standard |
|---|---|
| Research object | Strategy |
| Delivery/install object | AQP Bundle |
| Production artifact | signed *.aqp |
| Bundle ID | aqp_bundle_* |
| Bundle kind | bundle_kind: strategy |
| Strategy kind | rules | ml | hybrid |
| Manifest version | format_version: 2.0 |
| Python entrypoint | strategy.py |
| Entry class | TradingStrategy |
| Optional factory | load_strategy() |
Manifest v1 names exist only behind the explicit read-only compatibility boundary for historical signed packages. New code, examples, tests, and releases must use Manifest v2 terminology.
2. Source and Release Layout
aqp_bundle_example/
|-- manifest.json
|-- strategy.py
|-- config.json
|-- risk_profile.json
|-- requirements.lock
|-- models/
`-- README.md
A production .aqp additionally carries manifest.sha256 and aqp_signature.json. Production Desktop accepts signed .aqp packages; folders, ZIP files, and loose Python sources are development-mode inputs only.
3. Manifest v2 Example
{
"bundle_id": "aqp_bundle_gold_example",
"bundle_kind": "strategy",
"strategy_kind": "hybrid",
"format_version": "2.0",
"runtime_version": "aqp-runtime-v1",
"name": "Gold Example",
"version": "1.0.0",
"entrypoint": "strategy:TradingStrategy",
"supported_symbols": ["XAUUSD"],
"supported_timeframes": ["M15"],
"model_files": ["models/model.onnx"],
"permissions": {
"trade_request": true,
"mt5_direct": false,
"network": false,
"filesystem": "bundle_readonly"
}
}
The Manifest must not contain account-level execution settings such as lot size, risk percentage, maximum daily loss, maximum spread, magic number, deviation, or an auto-trading switch.
4. Strategy Interface
class TradingStrategy:
def on_bar(self, ctx):
confidence = 0.72
if confidence < ctx.config.get("min_confidence", 0.65):
return ctx.intent.hold(reason="confidence_filter")
return ctx.intent.market(
side="BUY",
confidence=confidence,
sl=ctx.price - 5.0,
tp=ctx.price + 15.0,
reason="model_signal",
)
The Strategy returns a TradeIntent. It does not call MetaTrader 5 directly. load_strategy(bundle_path) may be supplied as a factory when needed.
5. Ownership Boundary
AQP Bundle owns: strategy logic, feature/model inference, signal confidence, intent, and strategy-internal configuration.
Alpha Quant Pro Runtime owns: account/subscription/device/broker authorization, final position sizing, account risk, spread/news filters, circuit breakers, and MT5 order execution.
A Bundle cannot bypass Runtime authorization or account-level risk controls.
6. Dependencies and Security
- Production dependencies belong in
requirements.lock, with pinned versions and SHA-256 hashes. - Production Workers do not install dependencies automatically.
- Network access must be explicitly declared and routed through
ctx.http; rawsocket,requests, andurllibaccess is not an execution shortcut. - Direct
MetaTrader5.order_send(), dynamic MetaTrader5 imports, subprocess/system commands, and file access outside the Bundle are prohibited. - Protected
.aqppackages must pass Manifest, hash, signature, dependency-policy, and entrypoint validation before installation.