| | |
| | | "auto_buy": TradeSetting().get_auto_buy()} |
| | | response_data = json.dumps({"code": 0, "data": fdata}) |
| | | |
| | | elif url.path == "/set_trade_settings": |
| | | logger_debug.info(f"set_trade_settings: {params_dict}") |
| | | running = params_dict.get("running") |
| | | auto_sell = params_dict.get("auto_sell") |
| | | auto_buy = params_dict.get("auto_buy") |
| | | if running is not None: |
| | | TradeSetting().set_running(int(running)) |
| | | if auto_sell is not None: |
| | | TradeSetting().set_auto_sell(int(auto_sell)) |
| | | if auto_buy is not None: |
| | | TradeSetting().set_auto_buy(int(auto_buy)) |
| | | response_data = json.dumps({"code": 0, "data": {}}) |
| | | |
| | | elif url.path == "/get_env": |
| | | request_id = params_dict.get("request_id") |
| | | use_time_list = [] |
| | |
| | | else: |
| | | huaxin_trade_api.add_trade_callback_data(body) |
| | | result_str = json.dumps({"code": 0}) |
| | | elif url.path == "/set_trade_settings": |
| | | params = self.__parse_request() |
| | | if not self.__is_sign_right(params): |
| | | result_str = json.dumps({"code": 1001, "msg": "签名错误"}) |
| | | return |
| | | logger_debug.info(f"set_trade_settings: {params}") |
| | | running = params.get("running") |
| | | auto_sell = params.get("auto_sell") |
| | | auto_buy = params.get("auto_buy") |
| | | if running is not None: |
| | | TradeSetting().set_running(int(running)) |
| | | if auto_sell is not None: |
| | | TradeSetting().set_auto_sell(int(auto_sell)) |
| | | if auto_buy is not None: |
| | | TradeSetting().set_auto_buy(int(auto_buy)) |
| | | result_str = json.dumps({"code": 0, "data": {}}) |
| | | |
| | | elif url.path == "/buy": |
| | | # 签名验证 |
| | | params = self.__parse_request() |