public MonitorController_Door(STR_Door parent) { Parent = parent; double targetStrikeOffset = Parent.Input.DoorStrikeOffset; double moveBuffer = Parent.Input.MoveBuffer; MonitorPrice = new Monitor_UnderlyingPrice(targetStrikeOffset, moveBuffer); _monitorDoor = new Monitor_Door_Ready(this); _futureCode = KospiFutureUtil.Ins().KFI.Code; _monitorTime = DateUtil.GetTodayDateTime(12 + 2 + Const.kHourAdjustment_End, 59, 59); this.EnterAfterCancel = false; this.EnterMinCount = true; }
public void ChangeStateIfPossible(MonitorState targetState) { if (!IsValidTime()) { // 더 이상 현물 주문이 나갈 수 없는 상태이다. return; } IMonitor_Door next = _monitorDoor.ChangeStateIfPossible(targetState); if (next != null) { logger.Info("Change state {0} -> {1}", _monitorDoor.GetStateString(), next.GetStateString()); _monitorDoor = next; } }
public void Run() { RawMarketData rmd = RmdManager.Ins().GetDataClone(_futureCode); if (rmd == null) { logger.Error("rmd is null. {0}", _futureCode); Util.KillWithNotice("rmd is null"); return; } if (!IsValidTime()) { return; } if (Util.IsValidPrice(rmd.CurPrice)) { Monitor_UnderlyingPrice.Signal signal = MonitorPrice.Run(rmd); IMonitor_Door next = _monitorDoor.Run(signal); if (next == _monitorDoor) { } else { logger.Info("Change state(2) {0} -> {1}", _monitorDoor.GetStateString(), next.GetStateString()); } _monitorDoor = next; } }