public void OnNext(IUniverseAlertEvent value)
        {
            this._logger.LogInformation(
                $"received on the OnNext() event from the alerts stream. Rule {value.Rule} operation context {value.Context?.Id()}");

            switch (value.Rule)
            {
            case Rules.CancelledOrders:
                this.CancelledOrders(value);
                break;

            case Rules.HighVolume:
                this.HighVolume(value);
                break;

            case Rules.Layering:
                this.Layering(value);
                break;

            case Rules.MarkingTheClose:
                this.MarkingTheClose(value);
                break;

            case Rules.Spoofing:
                this.Spoofing(value);
                break;

            case Rules.WashTrade:
                this.EquityWashTrade(value);
                break;

            case Rules.FixedIncomeWashTrades:
                this.FixedIncomeWashTrade(value);
                break;

            case Rules.Ramping:
                this.Ramping(value);
                break;

            case Rules.PlacingOrderWithNoIntentToExecute:
                this.PlacingOrdersWithoutIntentToExecute(value);
                break;

            default:
                this._logger.LogError(
                    $"met a rule type it did not identify {value.Rule}. This should be explicitly addressed.");
                break;
            }
        }
Ejemplo n.º 2
0
        public void Add(IUniverseAlertEvent alertEvent)
        {
            if (alertEvent == null)
            {
                return;
            }

            this._logger.LogInformation(
                $"received a new alert for rule {alertEvent.Rule}. Part of rule run {alertEvent.Context?.Id()}");

            foreach (var sub in this._observers)
            {
                sub.Value?.OnNext(alertEvent);
            }
        }
        private void Ramping(IUniverseAlertEvent alert)
        {
            if (alert.IsFlushEvent)
            {
                return;
            }

            var ruleBreach = (IRampingRuleBreach)alert.UnderlyingAlert;

            this.SetIsBackTest(ruleBreach);

            this._logger.LogInformation("ramping adding alert to ramping message sender");
            this._rampingRuleMessageSender.Send(ruleBreach);

            this._logger.LogInformation("ramping incrementing raw alert count by 1");
            this.Analytics.RampingAlertsRaw += 1;
        }
        private void PlacingOrdersWithoutIntentToExecute(IUniverseAlertEvent alert)
        {
            if (alert.IsFlushEvent)
            {
                return;
            }

            var ruleBreach = (IPlacingOrdersWithNoIntentToExecuteRuleBreach)alert.UnderlyingAlert;

            this.SetIsBackTest(ruleBreach);

            this._logger.LogInformation("adding alert to placing orders without intent to execute message sender");
            this._placingOrdersMessageSender.Send(ruleBreach);

            this._logger.LogInformation("placing orders without intent to execute incrementing raw alert count by 1");
            this.Analytics.PlacingOrdersAlertsRaw += 1;
        }
        private void FixedIncomeWashTrade(IUniverseAlertEvent alert)
        {
            if (alert.IsFlushEvent)
            {
                return;
            }

            var ruleBreach = (IWashTradeRuleBreach)alert.UnderlyingAlert;

            this.SetIsBackTest(ruleBreach);

            this._logger.LogInformation("Fixed income wash trade adding alert to the wash trade message sender");
            this._fixedIncomeWashTradeMessageSender.Send(ruleBreach);

            this._logger.LogInformation("Fixed income wash trade incrementing raw alert count by 1");
            this.Analytics.FixedIncomeWashTradeAlertsRaw += 1;
        }
        private void CancelledOrders(IUniverseAlertEvent alert)
        {
            if (alert.IsFlushEvent)
            {
                return;
            }

            var ruleBreach = (ICancelledOrderRuleBreach)alert.UnderlyingAlert;

            this.SetIsBackTest(ruleBreach);

            this._logger.LogInformation("cancelled orders adding alert to cancelled order message sender");
            this._cancelledOrderMessageSender.Send(ruleBreach);

            this._logger.LogInformation("cancelled orders incrementing raw alert count by 1");
            this.Analytics.CancelledOrderAlertsRaw += 1;
        }
        private void Spoofing(IUniverseAlertEvent alert)
        {
            if (alert.IsFlushEvent)
            {
                return;
            }

            var ruleBreach = (ISpoofingRuleBreach)alert.UnderlyingAlert;

            this.SetIsBackTest(ruleBreach);

            this._logger.LogInformation("spoofing adding alert to spoofing message sender");
            this._spoofingMessageSender.Send(ruleBreach);

            this._logger.LogInformation("spoofing incrementing raw and adjusted alert count by 1");
            this.Analytics.SpoofingAlertsRaw      += 1;
            this.Analytics.SpoofingAlertsAdjusted += 1;
        }
        private void MarkingTheClose(IUniverseAlertEvent alert)
        {
            if (alert.IsFlushEvent)
            {
                return;
            }

            var ruleBreach = (IMarkingTheCloseBreach)alert.UnderlyingAlert;

            this.SetIsBackTest(ruleBreach);

            this._logger.LogInformation("marking the close adding alert to marking the close message sender");
            this._markingTheCloseMessageSender.Send(ruleBreach);

            this._logger.LogInformation("marking the close incrementing raw and adjusted alert count by 1");
            this.Analytics.MarkingTheCloseAlertsRaw      += 1;
            this.Analytics.MarkingTheCloseAlertsAdjusted += 1;
        }
        private void HighVolume(IUniverseAlertEvent alert)
        {
            if (alert.IsDeleteEvent)
            {
                this._highVolumeMessageSender.Delete();
                return;
            }

            if (alert.IsFlushEvent)
            {
                return;
            }

            var ruleBreach = (IHighVolumeRuleBreach)alert.UnderlyingAlert;

            this.SetIsBackTest(ruleBreach);

            this._logger.LogInformation("high volume adding alert to high volume message sender");
            this._highVolumeMessageSender.Send(ruleBreach);

            this._logger.LogInformation("high volume incrementing raw alert count by 1");
            this.Analytics.HighVolumeAlertsRaw += 1;
        }