| | |
| | | |
| | | from strategy import data_cache, account_management |
| | | import data_server |
| | | from log_module.log import logger_debug |
| | | |
| | | from log_module.log import logger_debug, logger_common |
| | | |
| | | from trade import huaxin_trade_api, huaxin_trade_data_update, middle_api_protocol |
| | | from utils import huaxin_util, tool |
| | | |
| | | # 引入日志模块 |
| | | from strategy.logging_config import get_logger |
| | | # 获取logger实例 |
| | | logger = get_logger() |
| | | logger = logger_common |
| | | |
| | | |
| | | # 下单买入函数(按金额,以限价买)【按金额买 基础版】 |
| | |
| | | # 调用笼子价计算工具计算下单价格 |
| | | order_price = tool.get_buy_max_price(current_price) |
| | | buy_order = huaxin_trade_api.order(1, symbol[-6:], volume, order_price, blocking=True) |
| | | logger.info(f"current_price===={current_price} order_price===={order_price}") |
| | | logger.info(f"buy_order===={buy_order}") |
| | | orderStatusMsg = buy_order['data'].get('orderStatusMsg', None) |
| | | statusMsg = buy_order['data'].get('statusMsg', None) |
| | |
| | | # 调用笼子价计算工具计算下单价格 |
| | | order_price = tool.get_buy_min_price(current_price) |
| | | sell_order = huaxin_trade_api.order(2, symbol[-6:], volume, order_price, blocking=True) |
| | | logger.info(f"current_price===={current_price} order_price===={order_price}") |
| | | logger.info(f"sell_order===={sell_order}") |
| | | orderStatusMsg = sell_order['data'].get('orderStatusMsg', None) |
| | | statusMsg = sell_order['data'].get('statusMsg', None) |