dragon_strategy_config.py 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. from __future__ import annotations
  2. from dataclasses import dataclass, field, replace
  3. @dataclass(frozen=True)
  4. class StrategyConfig:
  5. disabled_rules: frozenset[str] = field(default_factory=frozenset)
  6. post_exit_confirmation_window_days: int = 10
  7. aux_sell_same_side_once_per_cycle: bool = True
  8. aux_sell_duplicate_cooldown_days: int = 5
  9. aux_sell_high_zone_kdj_only_block_c1: float = 85.0
  10. aux_sell_high_zone_kdj_only_block_b1: float = -0.02
  11. aux_sell_high_zone_warning_c1: float = 80.0
  12. aux_sell_strong_break_c1: float = 60.0
  13. aux_sell_strong_break_b1: float = -0.05
  14. aux_sell_stronger_c1_delta: float = 8.0
  15. aux_sell_stronger_b1_delta: float = 0.05
  16. aux_sell_high_zone_rearm_c1_delta: float = 2.0
  17. state_crash_followthrough_window_days: int = 5
  18. state_crash_followthrough_repeat_cooldown_days: int = 4
  19. state_crash_followthrough_c1_max: float = 80.0
  20. state_crash_followthrough_a1_max: float = 0.01
  21. state_crash_followthrough_b1_max: float = -0.15
  22. glued_high_weak_rebound_high_c1: float = 68.0
  23. glued_high_weak_rebound_high_b1: float = -0.08
  24. glued_high_weak_rebound_mid_c1: float = 50.0
  25. glued_high_weak_rebound_mid_b1: float = -0.15
  26. glued_high_weak_rebound_ql_c1_low: float = 35.0
  27. glued_high_weak_rebound_ql_c1_high: float = 55.0
  28. glued_high_weak_rebound_ql_b1: float = -0.06
  29. glued_high_weak_rebound_ql_a1: float = -0.013
  30. glued_followthrough_pending_enabled: bool = False
  31. glued_followthrough_confirm_window_bars: int = 3
  32. glued_followthrough_allow_mid_zone_very_weak_b1: bool = False
  33. glued_followthrough_allow_high_zone_weak_b1: bool = False
  34. glued_followthrough_allow_ql_rebound_weak_followthrough: bool = False
  35. glued_followthrough_require_ql_buy_reconfirm: bool = True
  36. glued_followthrough_require_close_break_signal_close: bool = True
  37. glued_followthrough_require_b1_repair: bool = True
  38. glued_followthrough_b1_repair_min: float = 0.02
  39. glued_followthrough_exit_hold_kdj_only_enabled: bool = False
  40. glued_followthrough_exit_hold_kdj_only_days_max: int = 12
  41. glued_followthrough_exit_hold_kdj_only_c1_low: float = 55.0
  42. glued_followthrough_exit_hold_kdj_only_c1_high: float = 60.0
  43. glued_followthrough_exit_hold_kdj_only_a1_min: float = 0.0
  44. glued_followthrough_exit_hold_kdj_only_b1_min: float = -0.02
  45. glued_selective_hot_c1_min: float = 0.0
  46. glued_selective_hot_c1_max: float = 999.0
  47. glued_selective_hot_b1_min: float = 1.0
  48. glued_selective_low_c1_min: float = 0.0
  49. glued_selective_low_c1_max: float = 0.0
  50. glued_selective_low_b1_max: float = -999.0
  51. deep_oversold_filter1_c1_low: float = 13.0
  52. deep_oversold_filter1_c1_high: float = 15.0
  53. deep_oversold_filter1_a1_min: float = -0.04
  54. deep_oversold_filter1_b1_max: float = -0.08
  55. deep_oversold_filter2_c1_low: float = 13.0
  56. deep_oversold_filter2_c1_high: float = 14.5
  57. deep_oversold_filter2_a1_min: float = -0.04
  58. deep_oversold_filter2_b1_min: float = -0.06
  59. deep_oversold_entry_c1_max: float = 16.0
  60. deep_oversold_entry_a1_min: float = -0.09
  61. deep_oversold_entry_b1_min: float = -0.10
  62. deep_oversold_shallow_ql_fallback: bool = True
  63. deep_oversold_positive_b1_fallback_a1_min: float = -0.02
  64. deep_oversold_block_positive_b1_rebound: bool = False
  65. deep_oversold_block_shallow_false_start_without_ql: bool = False
  66. deep_oversold_confirm_weak_with_ql: bool = False
  67. deep_oversold_confirm_window_bars: int = 2
  68. deep_oversold_selective_positive_b1_c1_max: float = 0.0
  69. deep_oversold_selective_shallow_c1_min: float = 0.0
  70. deep_oversold_selective_shallow_b1_min: float = 1.0
  71. deep_oversold_selective_mixed_c1_max: float = 0.0
  72. deep_oversold_selective_mixed_require_no_ql: bool = False
  73. oversold_recovery_c1_low: float = 18.0
  74. oversold_recovery_c1_high: float = 22.0
  75. oversold_recovery_a1_min: float = -0.03
  76. oversold_recovery_a1_max: float = 0.0
  77. oversold_recovery_b1_min: float = -0.02
  78. oversold_reversal_after_ql_block_c1_low: float = 23.0
  79. oversold_reversal_after_ql_block_c1_high: float = 26.0
  80. oversold_reversal_after_ql_block_b1_min: float = -0.12
  81. oversold_reversal_after_ql_block_a1_min: float = -0.035
  82. oversold_reversal_after_ql_entry_c1_low: float = 20.0
  83. oversold_reversal_after_ql_entry_c1_high: float = 26.0
  84. oversold_reversal_after_ql_entry_a1_min: float = -0.04
  85. oversold_reversal_after_ql_entry_a1_max: float = 0.0
  86. oversold_reversal_after_ql_entry_b1_min: float = -0.22
  87. oversold_reversal_after_ql_entry_b1_max: float = 0.0
  88. post_sell_rebound_block_high_c1: float = 22.0
  89. post_sell_rebound_block_high_a1_min: float = -0.035
  90. post_sell_rebound_block_high_b1_max: float = -0.07
  91. post_sell_rebound_block_low_c1: float = 15.0
  92. post_sell_rebound_block_low_a1_min: float = -0.04
  93. post_sell_rebound_block_low_b1_max: float = -0.095
  94. post_sell_rebound_entry1_c1_low: float = 18.0
  95. post_sell_rebound_entry1_c1_high: float = 30.0
  96. post_sell_rebound_entry1_a1_min: float = -0.045
  97. post_sell_rebound_entry1_a1_max: float = 0.0
  98. post_sell_rebound_entry1_b1_low: float = -0.09
  99. post_sell_rebound_entry1_b1_high: float = -0.04
  100. post_sell_rebound_entry2_c1_high: float = 19.0
  101. post_sell_rebound_entry2_a1_min: float = -0.04
  102. post_sell_rebound_entry2_a1_max: float = 0.0
  103. post_sell_rebound_entry2_b1_low: float = -0.13
  104. post_sell_rebound_entry2_b1_high: float = -0.09
  105. predictive_b1_break_short_holding_days_max: int = 2
  106. predictive_b1_break_short_a1_min: float = -0.02
  107. predictive_b1_break_short_a1_max: float = 0.0
  108. predictive_b1_break_short_b1_max: float = -0.13
  109. predictive_b1_break_short_c1_low: float = 50.0
  110. predictive_b1_break_short_c1_high: float = 70.0
  111. predictive_b1_break_long_holding_days_min: int = 40
  112. predictive_b1_break_long_max_c1: float = 80.0
  113. predictive_b1_break_long_max_a1: float = 0.15
  114. predictive_b1_break_long_max_b1: float = 0.30
  115. predictive_b1_break_long_ql_days_max: int = 7
  116. predictive_b1_break_long_a1_min: float = -0.02
  117. predictive_b1_break_long_a1_max: float = 0.0
  118. predictive_b1_break_long_b1_max: float = -0.12
  119. predictive_b1_break_long_c1_low: float = 60.0
  120. predictive_b1_break_long_c1_high: float = 65.0
  121. enable_knife_take_profit_2_wait_ql: bool = True
  122. def with_updates(self, **kwargs) -> "StrategyConfig":
  123. if "disabled_rules" in kwargs and not isinstance(kwargs["disabled_rules"], frozenset):
  124. kwargs["disabled_rules"] = frozenset(kwargs["disabled_rules"])
  125. return replace(self, **kwargs)