@@ -24,6 +24,8 @@ class StrategyParameter(BaseModel):
2424 name : str
2525 group : str
2626 is_advanced : bool = False
27+ pretty_name : str
28+ description : str
2729 type : str
2830 prompt : str
2931 default : Optional [Any ]
@@ -61,17 +63,77 @@ def is_advanced_parameter(name: str) -> bool:
6163
6264 return True
6365
66+ def get_strategy_display_info () -> Dict [str , Dict [str , str ]]:
67+ """
68+ Returns user-friendly names and descriptions for each strategy
69+ """
70+ return {
71+ # Directional Trading Strategies
72+ "bollinger_v1" : {
73+ "pretty_name" : "Bollinger Bands Strategy" ,
74+ "description" : "Buys when price is low and sells when price is high based on Bollinger Bands."
75+ },
76+ "dman_v3" : {
77+ "pretty_name" : "Smart DCA Strategy" ,
78+ "description" : "Automatically adjusts buy/sell levels based on market conditions with multiple take-profit targets."
79+ },
80+ "macd_bb_v1" : {
81+ "pretty_name" : "MACD + Bollinger Strategy" ,
82+ "description" : "Uses two popular indicators to find better entry and exit points for trades."
83+ },
84+ "supertrend_v1" : {
85+ "pretty_name" : "SuperTrend Strategy" ,
86+ "description" : "Follows market trends to find good times to buy and sell."
87+ },
88+
89+ # Market Making Strategies
90+ "dman_maker_v2" : {
91+ "pretty_name" : "Smart Market Maker" ,
92+ "description" : "Places buy and sell orders that automatically adjust to market conditions."
93+ },
94+ "pmm_dynamic" : {
95+ "pretty_name" : "Dynamic Market Maker" ,
96+ "description" : "Places orders with spreads that adapt to market volatility."
97+ },
98+ "pmm_simple" : {
99+ "pretty_name" : "Simple Market Maker" ,
100+ "description" : "Places basic buy and sell orders with fixed spreads."
101+ },
102+
103+ # Generic Strategies
104+ "spot_perp_arbitrage" : {
105+ "pretty_name" : "Spot-Futures Arbitrage" ,
106+ "description" : "Profits from price differences between spot and futures markets."
107+ },
108+ "xemm_multiple_levels" : {
109+ "pretty_name" : "Multi-Exchange Market Maker" ,
110+ "description" : "Places orders across different exchanges to capture price differences."
111+ }
112+ }
113+
64114def convert_to_strategy_parameter (name : str , field : ModelField ) -> StrategyParameter :
65115 param = StrategyParameter (
66- name = snake_case_to_real_name (name ),
67- group = determine_parameter_group (name ),
116+ name = name ,
68117 type = str (field .type_ .__name__ ),
69118 prompt = field .description if hasattr (field , 'description' ) else "" ,
70119 default = field .default ,
71120 required = field .required or field .default is not None ,
72121 is_advanced = is_advanced_parameter (name ),
122+ group = determine_parameter_group (name ),
123+ pretty_name = name .replace ('_' , ' ' ).title (),
124+ description = "" ,
73125 )
74126
127+ # Get strategy display info
128+ strategy_info = get_strategy_display_info ()
129+
130+ # Try to find matching strategy info
131+ for strategy_name , info in strategy_info .items ():
132+ if strategy_name in name .lower ():
133+ param .pretty_name = info ["pretty_name" ]
134+ param .description = info ["description" ]
135+ break
136+
75137 # structure of field
76138 client_data = field .field_info .extra .get ('client_data' )
77139 if client_data is not None and param .prompt == "" :
@@ -93,8 +155,7 @@ def convert_to_strategy_parameter(name: str, field: ModelField) -> StrategyParam
93155 param .display_type = "slider"
94156 elif param .type == "bool" :
95157 param .display_type = "toggle"
96-
97- # Check for specific use cases
158+
98159 if "connector" in name .lower ():
99160 param .is_connector = True
100161 if "trading_pair" in name .lower ():
@@ -109,11 +170,11 @@ def convert_to_strategy_parameter(name: str, field: ModelField) -> StrategyParam
109170 param .min_value = Decimal (0 )
110171 if any (word in name .lower () for word in ["time" , "interval" , "duration" ]):
111172 param .is_timespan = True
112- param .min_value = 0
113- if param .type == "int" :
114- param .is_integer = True
115- if any (word in name .lower () for word in ["executors" , "workers" ]):
116- param .display_type = "slider"
173+ param .min_value = 0
174+ if param .type == "int" :
175+ param .is_integer = True
176+ if any (word in name .lower () for word in ["executors" , "workers" ]):
177+ param .display_type = "slider"
117178 param .min_value = 1
118179 try :
119180 if issubclass (field .type_ , Enum ):
@@ -146,10 +207,6 @@ def determine_parameter_group(name: str) -> str:
146207 return "Other"
147208
148209
149- def snake_case_to_real_name (snake_case : str ) -> str :
150- return " " .join ([word .capitalize () for word in snake_case .split ("_" )])
151-
152-
153210@functools .lru_cache (maxsize = 1 )
154211def get_all_strategy_maps () -> Dict [str , Dict [str , StrategyParameter ]]:
155212 strategy_maps = {}
0 commit comments