Ejemplo n.º 1
0
        /// <summary>
        /// The set missing market data judgement covers downstream processing logic for its logical code flow branch.
        /// </summary>
        /// <param name="orderUnderAnalysis">
        /// The order under analysis.
        /// </param>
        private void SetMissingMarketDataJudgement(Order orderUnderAnalysis)
        {
            var noTradesParameters = JsonConvert.SerializeObject(this.FixedIncomeParameters);
            var noTradesJudgement  = new FixedIncomeHighProfitJudgement(
                this.RuleCtx.RuleParameterId(),
                this.RuleCtx.CorrelationId(),
                orderUnderAnalysis?.ReddeerOrderId?.ToString(),
                orderUnderAnalysis?.OrderId,
                null,
                null,
                null,
                noTradesParameters,
                true,
                false);

            this.JudgementService.Judgement(new FixedIncomeHighProfitJudgementContext(noTradesJudgement, false));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// The no revenue or cost judgement performs final work and calls downstream
        /// side effects for this logic branch.
        /// </summary>
        /// <param name="orderUnderAnalysis">
        /// The order under analysis.
        /// </param>
        private void NoRevenueOrCostJudgement(Order orderUnderAnalysis)
        {
            var noRevenueJsonParameters = JsonConvert.SerializeObject(this.FixedIncomeParameters);

            var noRevenueJudgement = new FixedIncomeHighProfitJudgement(
                this.RuleCtx.RuleParameterId(),
                this.RuleCtx.CorrelationId(),
                orderUnderAnalysis?.ReddeerOrderId?.ToString(),
                orderUnderAnalysis?.OrderId,
                null,
                null,
                null,
                noRevenueJsonParameters,
                false,
                false);

            this.JudgementService.Judgement(new FixedIncomeHighProfitJudgementContext(noRevenueJudgement, false));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// The set judgement for full analysis covers downstream logic for its code branch.
        /// </summary>
        /// <param name="absoluteProfit">
        /// The absolute profit.
        /// </param>
        /// <param name="profitRatio">
        /// The profit ratio.
        /// </param>
        /// <param name="hasHighProfitAbsolute">
        /// The has high profit absolute.
        /// </param>
        /// <param name="hasHighProfitPercentage">
        /// The has high profit percentage.
        /// </param>
        /// <param name="exchangeRateProfits">
        /// The exchange rate profits.
        /// </param>
        /// <param name="ruleBreachContext">
        /// The rule breach context.
        /// </param>
        /// <param name="orderUnderAnalysis">
        /// The order under analysis.
        /// </param>
        private void SetJudgementForFullAnalysis(
            Money absoluteProfit,
            decimal profitRatio,
            bool hasHighProfitAbsolute,
            bool hasHighProfitPercentage,
            IExchangeRateProfitBreakdown exchangeRateProfits,
            RuleBreachContext ruleBreachContext,
            Order orderUnderAnalysis)
        {
            var absoluteHighProfit = hasHighProfitAbsolute ? absoluteProfit.Value : (decimal?)null;

            var absoluteHighProfitCurrency = hasHighProfitAbsolute ? absoluteProfit.Currency.Code : null;

            var percentageHighProfit = hasHighProfitPercentage ? profitRatio : (decimal?)null;

            var jsonParameters = JsonConvert.SerializeObject(this.FixedIncomeParameters);
            var judgement      = new FixedIncomeHighProfitJudgement(
                this.RuleCtx.RuleParameterId(),
                this.RuleCtx.CorrelationId(),
                orderUnderAnalysis?.ReddeerOrderId?.ToString(),
                orderUnderAnalysis?.OrderId,
                absoluteHighProfit,
                absoluteHighProfitCurrency,
                percentageHighProfit,
                jsonParameters,
                false,
                false);

            this.JudgementService.Judgement(
                new FixedIncomeHighProfitJudgementContext(
                    judgement,
                    hasHighProfitAbsolute || hasHighProfitPercentage,
                    ruleBreachContext,
                    this.FixedIncomeParameters,
                    absoluteProfit,
                    absoluteProfit.Currency.Symbol,
                    profitRatio,
                    hasHighProfitAbsolute,
                    hasHighProfitPercentage,
                    exchangeRateProfits));
        }