| | |
| | | from db import mysql_data_delegate as mysql_data, redis_manager_delegate as redis_manager |
| | | from db.mysql_data_delegate import Mysqldb |
| | | from db.redis_manager_delegate import RedisUtils |
| | | from l2.l2_data_manager import OrderBeginPosInfo |
| | | from log_module import async_log_util |
| | | from output import kp_client_msg_manager |
| | | from trade import trade_data_manager, l2_trade_util, trade_juejin, trade_huaxin, trade_constant |
| | |
| | | |
| | | from log_module.log import * |
| | | from trade.huaxin.huaxin_trade_record_manager import TradeOrderIdManager |
| | | from trade.trade_data_manager import AccountMoneyManager |
| | | from trade.trade_data_manager import AccountMoneyManager, RadicalBuyDealCodesManager |
| | | from utils import import_util, tool, huaxin_util |
| | | |
| | | trade_gui = import_util.import_lib("trade.trade_gui") |
| | |
| | | # 设置交易账户的可用金额 |
| | | |
| | | |
| | | |
| | | # 保存交易成功的数据 |
| | | def save_trade_success_data(datas, day=datetime.datetime.now().strftime("%Y%m%d")): |
| | | time_str = tool.get_now_time_str() |
| | |
| | | try: |
| | | if constant.API_TRADE_ENABLE: |
| | | count = tool.get_buy_volume(price) |
| | | if mode == OrderBeginPosInfo.MODE_RADICAL: |
| | | # 激进买入金额为1手 |
| | | count = 100 |
| | | if constant.TRADE_WAY == constant.TRADE_WAY_JUEJIN: |
| | | trade_juejin.order_volume(code, price, count) |
| | | elif constant.TRADE_WAY == constant.TRADE_WAY_HUAXIN: |
| | |
| | | # 加入黑名单 |
| | | if not l2_trade_util.is_in_forbidden_trade_codes(code): |
| | | l2_trade_util.forbidden_trade(code, "buy success", force=True) |
| | | RadicalBuyDealCodesManager().add_deal_code(code) |
| | | # 取s消所有的挂单 |
| | | if constant.API_TRADE_ENABLE: |
| | | if constant.TRADE_WAY == constant.TRADE_WAY_JUEJIN: |