/// <summary> /// 撤销挂单。 /// </summary> public void CancelOpenHangingOrder() { CheckBackgroundWorker("未成交撤单"); if (m_arbitrageOrder.HasUnFinishOrderBook == false) { AutoTraderNotice notice = CreateTraderNotice(AutoTraderNoticeType.Order, "没有未完成委托单,无需撤单"); SafeFireAutoTraderNotice(notice); return; } else { string text = "正在进行撤单操作"; AutoTraderNotice notice = CreateTraderNotice(text); SafeFireAutoTraderNotice(notice); WriteTraderNoticeLog(notice); } //未完成单先撤单 foreach (ArbitrageTask task in m_arbitrageOrder.OpenTaskGroup.TaskList) { if (task.HasUnFinishOrderBook) { List <USeOrderBook> unFinishOrderBooks = task.UnFinishOrderBooks; foreach (USeOrderBook orderBook in unFinishOrderBooks) { string message = string.Empty; bool cancelResult = m_orderDriver.CancelOrder(orderBook.OrderNum, orderBook.Instrument, out message); if (cancelResult == false) { AutoTraderNotice errorNotice = CreateTraderNotice(AutoTraderNoticeType.Order, "撤单失败"); SafeFireAutoTraderNotice(errorNotice); } } } } { AutoTraderNotice notice = CreateTraderNotice("撤单完成,等待撤单结果"); SafeFireAutoTraderNotice(notice); WriteTraderNoticeLog(notice); } }