ट्रेडिंग रणनीतियों में LEAN समता का ऑडिट
सारांश
यह नोटबुक वास्तविक रणनीतियों के ऑडिट के सुरक्षित रखे गए नतीजों की जाँच करती है, जिसमें LEAN इंजन की तुलना मेल खाते ML4T बैकटेस्ट प्रोफ़ाइलों से की गई है। यह स्थिर इनपुट से समर्थित परिसंपत्ति-वर्ग के कार्यभार की पहचान करती है और भरे गए ऑर्डर, मूल्यांकन, मूल्यांकन समय-मुद्राओं, इक्विटी अंतरालों तथा अंतिम मूल्यों के बीच समता के साक्ष्य देती है। CME फ्यूचर्स कार्यभार को शामिल नहीं किया गया है, क्योंकि उपलब्ध सतत मूल कीमतों में दिनांकित अनुबंध शृंखला और नेटिव LEAN सब्सक्रिप्शन के लिए आवश्यक रोल मैपिंग नहीं है।
यह केवल इंजन के समय की भी तुलना करती है। इसे इंजन कॉल के आसपास मापा गया है, जिसमें इनपुट लोडिंग, अनुमान, लक्ष्य निर्माण, तैयारी और रिपोर्टिंग शामिल नहीं हैं। ये आँकड़े केवल पिन किए गए संस्करणों, इनपुट और समय-सीमाओं पर लागू होते हैं। एक सिंथेटिक स्ट्रेस पंक्ति को पैमाने और प्रोफ़ाइल के निदान के रूप में दिखाया गया है, जो वास्तविक रणनीति तुलनाओं से अलग है। नोटबुक ऑडिट के नतीजे देती है, फ़्रेमवर्क की गति या समानता के बारे में कोई सामान्य दावा नहीं, और इसके समता निष्कर्ष समर्थित कार्यभारों तथा स्थिर बंडल तक सीमित हैं।
मुख्य विचार
- ऑडिट भरे गए ऑर्डर, मूल्यांकन, समय-मुद्राओं और अंतिम नतीजों पर LEAN और ML4T बैकटेस्ट की तुलना करता है।
- स्थिर इनपुट ETF, क्रिप्टो परपेचुअल, USD-कोटेड FX और US इक्विटी कार्यभारों का समर्थन करते हैं।
- CME फ्यूचर्स मामले का समर्थन नहीं है, क्योंकि आवश्यक दिनांकित अनुबंध शृंखला और रोल मैप अनुपलब्ध हैं।
- केवल इंजन के समय में डेटा तैयारी, अनुमान, अडैप्टर कार्य और रिपोर्टिंग शामिल नहीं हैं।
- सिंथेटिक स्ट्रेस नतीजे निदान के लिए हैं और इन्हें वास्तविक रणनीति के साक्ष्य से अलग समझना चाहिए।
टैग
पूरा पाठ
# LEAN Parity on Current Case-Study Strategies
# LEAN Parity on Current Case-Study Strategies
This notebook isolates the LEAN rows from the current real-strategy audit. It uses retained results
generated by the native LEAN engine and the matching ML4T Backtest profiles. The shared inputs are
frozen before engine execution.
**Learning objectives**
- Identify which selected asset classes are valid LEAN comparisons
- Read LEAN parity across fills, valuations, and terminal value
- Interpret LEAN engine-only timing on the measured strategies
- Keep synthetic stress evidence separate from real-strategy equivalence
**Book reference**: Chapter 16, Section 16.3
## Setup
```python
"""Current LEAN parity evidence."""
import json
import polars as pl
from IPython.display import Markdown, display
from utils.paths import get_chapter_dir
```
```python
# Production defaults - Papermill injects overrides after this cell
ROUND_SECONDS = 3
```
```python
AUDIT_PATH = get_chapter_dir(16) / "resources" / "framework_parity_audit.json"
audit = json.loads(AUDIT_PATH.read_text(encoding="utf-8"))
lean = audit["frameworks"]["lean"]
LEAN_NAME = f"{lean['display_name']} {lean['version']}"
CASE_NAMES = {
"etfs": "ETF allocation",
"cme_futures": "CME futures",
"crypto_perps_funding": "Crypto perpetual funding",
"fx_pairs": "FX allocation (USD-quoted pairs)",
"us_equities_panel": "US equity panel",
}
```
```python
display(Markdown(f"**Pinned engine:** {LEAN_NAME} with ML4T profile `{lean['profile']}`"))
```
## 1. Supported real strategies
LEAN is required for the ETF, crypto-perpetual, USD-quoted foreign-exchange, and US equity-panel
workloads. The CME row is unsupported for this particular frozen bundle: it contains continuous
root prices but lacks the dated contract chain and roll map needed to construct a native LEAN
futures subscription.
```python
lean_results = (
pl.DataFrame(audit["real_strategy_records"])
.filter(pl.col("framework") == "lean")
.with_columns(pl.col("case_study").replace_strict(CASE_NAMES).alias("strategy"))
.select(
"strategy",
"status",
"fills",
"valuations",
"valuation_timestamps_match",
"equity_gap",
"equity_raw_gap",
"terminal_gap",
"terminal_raw_gap",
"negative_control_detected",
)
)
assert lean_results.height == 4
assert lean_results["status"].to_list() == ["pass"] * 4
assert lean_results["valuation_timestamps_match"].all()
assert lean_results["negative_control_detected"].all()
display(lean_results)
```
```python
lean_unsupported = (
pl.DataFrame(audit["unsupported_records"])
.filter(pl.col("framework") == "lean")
.with_columns(pl.col("case_study").replace_strict(CASE_NAMES).alias("strategy"))
.select("strategy", "reason")
)
display(lean_unsupported)
```
The table reports the complete fill and valuation counts for each supported workload. LEAN uses
native equity, crypto-future, and foreign-exchange securities. The audit does not convert the
continuous CME roots into a different instrument merely to add a LEAN row.
## 2. Engine-only timing
The timer starts immediately before the engine call and stops when it returns. One warmup and ten
process-isolated samples are used. Input loading, model inference, target construction, adapter
preparation, result extraction, and reporting are outside the timed region.
```python
lean_timing = (
pl.DataFrame(audit["performance_records"])
.filter(pl.col("framework") == "lean")
.with_columns(
pl.col("case_study").replace_strict(CASE_NAMES).alias("strategy"),
pl.col("framework_median_seconds").round(ROUND_SECONDS).alias("lean_seconds"),
pl.col("ml4t_median_seconds").round(ROUND_SECONDS).alias("ml4t_seconds"),
pl.col("framework_to_ml4t_ratio").round(2).alias("lean_div_ml4t"),
)
.select("strategy", "lean_seconds", "ml4t_seconds", "lean_div_ml4t")
)
display(lean_timing)
```
The timing result applies to these pinned versions, bundles, and engine boundaries. It is not a
general LEAN performance claim.
## 3. Synthetic stress remains diagnostic
```python
lean_stress = (
pl.DataFrame(audit["synthetic_stress"]["records"])
.filter(pl.col("framework") == "lean")
.select("intents", "fills", "trades", "terminal_value", "status")
)
display(lean_stress)
```
The retained stress row tests scale and the calibrated LEAN profile on generated inputs. The
supported rows above provide the real-data evidence.स्रोत के लाइसेंस के तहत श्रेय सहित पूरा पाठ दिखाया गया है। लाइसेंस: MIT
यह सारांश मूल स्रोत के आधार पर Stratmill के शोध एजेंट ने लिखा है; यह स्रोत की प्रति नहीं है।