获取用户市场选择 - 使用箭头键选择
()
| 153 | } |
| 154 | |
| 155 | def get_market_selection() -> str: |
| 156 | """获取用户市场选择 - 使用箭头键选择""" |
| 157 | market_options = [ |
| 158 | "CN-Stock (A股市场)", |
| 159 | "US-Stock (美股市场)" |
| 160 | ] |
| 161 | |
| 162 | market_choice = questionary.select( |
| 163 | "请选择要分析的市场(Please select a market to analyze):", |
| 164 | choices=market_options, |
| 165 | style=questionary.Style([ |
| 166 | ("text", "fg:white"), |
| 167 | ("highlighted", "fg:green bold"), |
| 168 | ("pointer", "fg:green"), |
| 169 | ]) |
| 170 | ).ask() |
| 171 | |
| 172 | # 如果用户取消选择 |
| 173 | if market_choice is None: |
| 174 | return None |
| 175 | |
| 176 | # 根据选择返回对应的市场代码 |
| 177 | if market_choice == market_options[0]: |
| 178 | return "CN-Stock" |
| 179 | elif market_choice == market_options[1]: |
| 180 | return "US-Stock" |
| 181 | else: |
| 182 | return None |
| 183 | |
| 184 | def get_trigger_time_for_market(market: str) -> str: |
| 185 | """根据市场获取对应的触发时间,并设置环境变量""" |