public IMonitor_Door Run(Monitor_UnderlyingPrice.Signal signal) { if (signal == Monitor_UnderlyingPrice.Signal.Rebalance) { // Canceling 상태로 재빨리 옮겨야 한다. Monitor_Door_Canceling next = new Monitor_Door_Canceling(_parent, _orders); return next; } // 위험해 보이는 주문은 취소하고 너무 많이 취소 했다면 다시 진행하도록 한다. int canceledCountThisTurn = CancelDangerousOrders(); _canceledOrderCount += canceledCountThisTurn; int cancedOrderPercent = 100 * _canceledOrderCount / (1 + _orders.Count); if (cancedOrderPercent >= 10) { Monitor_Door_Canceling next = new Monitor_Door_Canceling(_parent, _orders); return next; } int emptyChannel = GetEmptyChannelCount(); for (int i = 0; i < emptyChannel; ++i) { EnterNewDoorOrder(); } return this; }
public IMonitor_Door ChangeStateIfPossible(MonitorController_Door.MonitorState targetState) { // Canceling이 오면 바로 반응한다. if (targetState == MonitorController_Door.MonitorState.Canceling) { Monitor_Door_Canceling next = new Monitor_Door_Canceling(_parent, _orders); return next; } return null; }