| | |
| | | async_log_util.info(logger_trade, "{} trade.manager.start_buy 结束".format(code)) |
| | | |
| | | |
| | | def test_order(code, last_data, exec_index): |
| | | """ |
| | | TODO 测试下单 |
| | | @param code: |
| | | @param last_data: |
| | | @param exec_index: |
| | | @return: |
| | | """ |
| | | price = gpcode_manager.get_limit_up_price(code) |
| | | __buy(code, price, trade_constant.TRADE_STATE_NOT_TRADE, 0, last_data, last_data["index"], 0, exec_index=exec_index) |
| | | |
| | | |
| | | # 中断买入 |
| | | def break_buy(code, reason): |
| | | trade_data_manager.TradeBuyDataManager().remove_buy_position_info(code) |
| | |
| | | async_log_util.info(logger_trade, "{} trade_manager.__buy 开始".format(code)) |
| | | try: |
| | | if constant.API_TRADE_ENABLE: |
| | | can_buy, money, msg = BuyMoneyUtil.get_buy_data(tool.get_now_time_str(), mode, DealAndDelegateWithBuyModeDataManager().get_deal_codes_info(mode), DealAndDelegateWithBuyModeDataManager().get_delegates_codes_info(mode)) |
| | | can_buy, money, msg = BuyMoneyUtil.get_buy_data(tool.get_now_time_str(), mode, |
| | | DealAndDelegateWithBuyModeDataManager().get_deal_codes_info( |
| | | mode), |
| | | DealAndDelegateWithBuyModeDataManager().get_delegates_codes_info( |
| | | mode)) |
| | | if not can_buy: |
| | | raise Exception(msg) |
| | | count = tool.get_buy_volume_by_money(price, money) |
| | |
| | | if constant.TRADE_WAY == constant.TRADE_WAY_JUEJIN: |
| | | trade_juejin.order_volume(code, price, count) |
| | | elif constant.TRADE_WAY == constant.TRADE_WAY_HUAXIN: |
| | | if constant.IS_NEW_VERSION_PLACE_ORDER: |
| | | trade_huaxin.order_volume_new(code, price, count, last_data, exec_index=exec_index) |
| | | else: |
| | | order_ref = huaxin_util.create_order_ref() |
| | | TradeOrderIdManager().add_order_ref(code, order_ref) |
| | | trade_huaxin.order_volume(code, price, count, last_data, order_ref=order_ref, exec_index=exec_index) |