| | |
| | | 获取交易参数 |
| | | @return: |
| | | """ |
| | | result = strategy_params_settings.settings.to_json_str() |
| | | return {"code": 0, "data": result} |
| | | result = strategy_params_settings.StrategyParamsSettingsManager().get_settings().to_json_str() |
| | | return {"code": 0, "data": json.loads(result)} |
| | | |
| | | def __on_set_settings(self, data): |
| | | """ |
| | | 设置交易参数 |
| | | @return: |
| | | """ |
| | | settings = strategy_params_settings.StrategyParamsSettingsManager().get_settings() |
| | | for k in data: |
| | | settings.__setattr__(k, data[k]) |
| | | strategy_params_settings.StrategyParamsSettingsManager().set_settings(settings) |
| | | # 同步参数设置 |
| | | return {"code": 0, "data": {}} |
| | | |
| | | def __on_get_env(self, need_hsitory_data): |
| | | """ |
| | |
| | | else: |
| | | # 如果在16:00之后采用下一个交易日 |
| | | day = TradeDateManager().get_next_trade_day(tool.get_now_date_str()) |
| | | fdata["history_data"]["leading_limit_up_block_codes_count"] = env_info.get_leading_limit_up_block_codes_count( |
| | | fdata["history_data"][ |
| | | "leading_limit_up_block_codes_count"] = env_info.get_leading_limit_up_block_codes_count( |
| | | day) |
| | | |
| | | if tool.get_now_time_str() < '16:00:00': |
| | |
| | | result_json = {} |
| | | if ctype == "get_settings": |
| | | result_json = self.__on_get_settings() |
| | | elif ctype == 'set_settings': |
| | | del data["ctype"] |
| | | result_json = self.__on_set_settings(data) |
| | | elif ctype == 'get_env': |
| | | result_json = self.__on_get_env(data.get("history")) |
| | | elif ctype == 'update_leading_limit_up_datas': |