| | |
| | | from db.redis_manager_delegate import RedisUtils |
| | | from log_module.log import hx_logger_l2_transaction, logger_debug |
| | | from strategy import data_cache |
| | | from strategy.trade_setting import TradeSetting |
| | | from trade import huaxin_trade_api, huaxin_trade_data_update |
| | | from trade.huaxin_trade_record_manager import DelegateRecordManager, DealRecordManager, MoneyManager, PositionManager |
| | | from utils import tool, huaxin_util, socket_util |
| | |
| | | # 获取每次买入的金额 |
| | | money = data_cache.BUY_MONEY_PER_CODE |
| | | response_data = json.dumps({"code": 0, "data": {"money": money}}) |
| | | elif url.path == "/get_trade_settings": |
| | | fdata = {"running": TradeSetting().get_running(), "auto_sell": TradeSetting().get_auto_sell(), |
| | | "auto_buy": TradeSetting().get_auto_buy()} |
| | | response_data = json.dumps({"code": 0, "data": fdata}) |
| | | |
| | | elif url.path == "/set_trade_settings": |
| | | 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": |
| | | try: |
| | | fdata = {} |