| | |
| | | import com.yami.trading.service.WalletService; |
| | | import com.yami.trading.service.data.DataService; |
| | | import com.yami.trading.service.item.ItemLeverageService; |
| | | import com.yami.trading.service.item.ItemPreMarketService; |
| | | import com.yami.trading.service.item.ItemService; |
| | | import com.yami.trading.service.rate.ExchangeRateService; |
| | | import com.yami.trading.service.syspara.SysparaService; |
| | |
| | | private UserService partyService; |
| | | @Autowired |
| | | private ItemService itemService; |
| | | @Autowired(required = false) |
| | | private ItemPreMarketService itemPreMarketService; |
| | | @Qualifier("dataService") |
| | | @Autowired |
| | | private DataService dataService; |
| | |
| | | |
| | | //rose 校验如果是数字货币,则7*24 |
| | | String type = item.getType(); |
| | | if(!type.equalsIgnoreCase(Item.cryptos)){ |
| | | //外汇交易后台接口 |
| | | if (!type.equalsIgnoreCase(Item.cryptos)) { |
| | | boolean preMarketActive = itemPreMarketService != null |
| | | && itemPreMarketService.isPreMarketTradingActive(order.getSymbol()); |
| | | boolean orderOpen = this.sysparaService.find("order_open").getBoolean(); |
| | | if (!orderOpen) { |
| | | if (!orderOpen && !preMarketActive && !itemService.isOpen(order.getSymbol())) { |
| | | throw new YamiShopBindException("不在交易时段"); |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | } |
| | | tryImmediatePreMarketFill(order); |
| | | } |
| | | |
| | | /** 盘前时段:市价/限价委托立即按盘前价成交,避免停留在委托队列 */ |
| | | private void tryImmediatePreMarketFill(ContractApplyOrder order) { |
| | | if (itemPreMarketService == null || !itemPreMarketService.isPreMarketTradingActive(order.getSymbol())) { |
| | | return; |
| | | } |
| | | if (!ContractApplyOrder.OFFSET_OPEN.equals(order.getOffset())) { |
| | | return; |
| | | } |
| | | Double prePrice = itemPreMarketService.getActivePreMarketPrice(order.getSymbol()); |
| | | if (prePrice == null) { |
| | | log.warn("盘前已激活但未取到盘前价 symbol={} orderNo={}", order.getSymbol(), order.getOrderNo()); |
| | | return; |
| | | } |
| | | Realtime realtime = new Realtime(); |
| | | realtime.setSymbol(order.getSymbol()); |
| | | realtime.setClose(prePrice); |
| | | contractOrderService.saveOpen(order, realtime); |
| | | } |
| | | |
| | | /** |