| | |
| | | from http.server import BaseHTTPRequestHandler |
| | | import urllib.parse as urlparse |
| | | |
| | | from log_module.log import hx_logger_l2_transaction |
| | | from log_module.log import hx_logger_l2_transaction, logger_debug |
| | | from strategy import data_cache |
| | | from trade import huaxin_trade_api, huaxin_trade_data_update |
| | | from trade.huaxin_trade_record_manager import DelegateRecordManager, DealRecordManager, MoneyManager, PositionManager |
| | |
| | | fdatas = [] |
| | | for code in codes: |
| | | data = data_cache.latest_code_market_info_dict.get(code) |
| | | logger_debug.info(f"获取L1行情接口:{code}-{data}") |
| | | if data: |
| | | fdatas.append(data) |
| | | response_data = json.dumps({"code": 0, "data": fdatas}) |
| | |
| | | price = tool.get_buy_max_price(current_price) |
| | | price = min(price, tool.get_limit_up_price(code,pre_price)) |
| | | else: |
| | | price = round(params.get("price"), 2) # 价格 |
| | | price = round(float(params.get("price")), 2) # 价格 |
| | | result = huaxin_trade_api.order(1, code, volume, price, blocking=True) |
| | | result_str = json.dumps(result) |
| | | elif url.path == "/sell": |