Ejemplo n.º 1
0
        //Execute rule logic
        override protected bool ExcuteRuleLogic(Niffle message)
        {
            if (IsTickMessageEmpty(message))
            {
                return(false);
            }

            if (DateTime.TryParse(message.Tick.TimeStamp, out Now))
            {
                //First Tick recieved will be the first after OpenForTrading has service has notified this service - therefore use this Tick time as OpenTime
                //The OpenTime may be updated by receiving an update to state data
                if (ReduceRiskAfterOpen > TimeSpan.Zero)
                {
                    SetReduceRiskTime(Now);
                }

                if (DateTimeZoneCalc.IsTimeAfter(Now, ReduceRiskTime))
                {
                    PublishStateUpdate(Data.State.ISREDUCERISKTIME, true);
                    IsActive = false;
                    return(true);
                }
            }
            return(false);
        }
Ejemplo n.º 2
0
        //Execute rule logic
        override protected bool ExcuteRuleLogic(Niffle message)
        {
            if (IsTickMessageEmpty(message))
            {
                return(false);
            }
            if (ReduceRiskTime == TimeSpan.Zero)
            {
                return(false);
            }

            DateTime Now = DateTime.FromBinary(message.Tick.TimeStamp);

            if (DateTimeZoneCalc.IsTimeAfter(Now, ReduceRiskTime))
            {
                StateManager.SetInitialState(new State
                {
                    { State.ISREDUCERISKTIME, true },
                    { State.REDUCERISKTIME, message.Tick.TimeStamp }
                });

                SetActiveState(false);
                return(true);
            }
            return(false);
        }
Ejemplo n.º 3
0
        //Execute rule logic
        override protected bool ExcuteRuleLogic(Niffle message)
        {
            if (IsTickMessageEmpty(message))
            {
                return(false);
            }
            if (CloseTime == TimeSpan.Zero)
            {
                return(false);
            }

            DateTime Now = DateTime.FromBinary(message.Tick.TimeStamp);

            if (DateTimeZoneCalc.IsTimeAfter(Now, CloseTime))
            {
                StateManager.SetInitialStateAsync(new State
                {
                    { State.ISOPENTIME, false },
                    { State.CLOSETIME, message.Tick.TimeStamp }
                });

                SetActiveState(false);
                return(true);
            }
            return(false);
        }
Ejemplo n.º 4
0
 private bool IsOpenTime(DateTime now)
 {
     return(DateTimeZoneCalc.IsTimeAfter(now, OpenTime));
 }