mirror of
https://github.com/NicolasBohn/NexQuant.git
synced 2026-07-29 00:17:44 +00:00
cbe1c52e00
Rename all source files, scripts, tests, documentation, and configuration from Predix/predix to NexQuant/nexquant across the entire codebase.
59 lines
1.5 KiB
Python
59 lines
1.5 KiB
Python
"""
|
|
Trading Protection System for NexQuant.
|
|
|
|
Prevents excessive losses by automatically pausing trading
|
|
when risk thresholds are exceeded.
|
|
|
|
Usage:
|
|
from rdagent.components.backtesting.protections import (
|
|
ProtectionManager,
|
|
MaxDrawdownProtection,
|
|
CooldownProtection,
|
|
StoplossGuardProtection,
|
|
LowPerformanceProtection,
|
|
)
|
|
|
|
manager = ProtectionManager()
|
|
manager.create_default_protections()
|
|
|
|
result = manager.check_all(
|
|
returns=[0.01, -0.02, 0.015],
|
|
timestamps=[...],
|
|
current_equity=98000,
|
|
peak_equity=100000
|
|
)
|
|
|
|
if result.should_block:
|
|
print(f"Trading blocked: {result.reason}")
|
|
"""
|
|
|
|
from .base import (
|
|
BaseProtection,
|
|
ProtectionConfig,
|
|
ProtectionResult,
|
|
ProtectionType,
|
|
ProtectionScope,
|
|
)
|
|
from .max_drawdown import MaxDrawdownProtection, MaxDrawdownConfig
|
|
from .cooldown import CooldownProtection, CooldownConfig
|
|
from .stoploss_guard import StoplossGuardProtection, StoplossGuardConfig
|
|
from .low_performance import LowPerformanceProtection, LowPerformanceConfig
|
|
from .protection_manager import ProtectionManager
|
|
|
|
__all__ = [
|
|
"BaseProtection",
|
|
"ProtectionConfig",
|
|
"ProtectionResult",
|
|
"ProtectionType",
|
|
"ProtectionScope",
|
|
"MaxDrawdownProtection",
|
|
"MaxDrawdownConfig",
|
|
"CooldownProtection",
|
|
"CooldownConfig",
|
|
"StoplossGuardProtection",
|
|
"StoplossGuardConfig",
|
|
"LowPerformanceProtection",
|
|
"LowPerformanceConfig",
|
|
"ProtectionManager",
|
|
]
|