/// <summary> /// The set missing market data judgement. /// </summary> /// <param name="orderUnderAnalysis"> /// The order under analysis. /// </param> private void SetMissingMarketDataJudgement(Order orderUnderAnalysis) { var noTradesParameters = JsonConvert.SerializeObject(this.EquitiesParameters); var noTradesJudgement = new HighProfitJudgement( this.RuleContext.RuleParameterId(), this.RuleContext.CorrelationId(), orderUnderAnalysis?.ReddeerOrderId?.ToString(), orderUnderAnalysis?.OrderId, null, null, null, noTradesParameters, true, false); this.JudgementService.Judgement(new HighProfitJudgementContext(noTradesJudgement, false)); }
/// <summary> /// The no revenue or cost judgement. /// </summary> /// <param name="orderUnderAnalysis"> /// The order under analysis. /// </param> private void NoRevenueOrCostJudgement(Order orderUnderAnalysis) { var noRevenueJsonParameters = JsonConvert.SerializeObject(this.EquitiesParameters); var noRevenueJudgement = new HighProfitJudgement( this.RuleContext.RuleParameterId(), this.RuleContext.CorrelationId(), orderUnderAnalysis?.ReddeerOrderId?.ToString(), orderUnderAnalysis?.OrderId, null, null, null, noRevenueJsonParameters, false, false); this.JudgementService.Judgement(new HighProfitJudgementContext(noRevenueJudgement, false)); }
/// <summary> /// The set judgement for full analysis. /// </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.EquitiesParameters); var judgement = new HighProfitJudgement( this.RuleContext.RuleParameterId(), this.RuleContext.CorrelationId(), orderUnderAnalysis?.ReddeerOrderId?.ToString(), orderUnderAnalysis?.OrderId, absoluteHighProfit, absoluteHighProfitCurrency, percentageHighProfit, jsonParameters, false, false); this.JudgementService.Judgement( new HighProfitJudgementContext( judgement, hasHighProfitAbsolute || hasHighProfitPercentage, ruleBreachContext, this.EquitiesParameters, absoluteProfit, absoluteProfit.Currency.Symbol, profitRatio, hasHighProfitAbsolute, hasHighProfitPercentage, exchangeRateProfits)); }
public async Task SaveHighProfit_SavesHighProfit_ToDb() { var connectionStringFactory = new ConnectionStringFactory(this._configuration); var repo = new JudgementRepository(connectionStringFactory, this._logger); var hpJudgement = new HighProfitJudgement( "rule-1", "rule-correlation-1", "order100", "ABCD-100", 100, "EUR", 92, "some params", false, false); await repo.SaveAsync(hpJudgement); Assert.IsTrue(true); }
public HighProfitJudgementContext( HighProfitJudgement judgement, bool projectToAlert, IRuleBreachContext ruleBreachContext, IHighProfitsRuleEquitiesParameters equitiesParameters, Money?absoluteProfits, string absoluteProfitCurrency, decimal?relativeProfits, bool hasAbsoluteProfitBreach, bool hasRelativeProfitBreach, IExchangeRateProfitBreakdown profitBreakdown) { this.Judgement = judgement; this.RaiseRuleViolation = projectToAlert; this.RuleBreachContext = ruleBreachContext; this.EquitiesParameters = equitiesParameters; this.AbsoluteProfits = absoluteProfits; this.AbsoluteProfitCurrency = absoluteProfitCurrency; this.RelativeProfits = relativeProfits; this.HasAbsoluteProfitBreach = hasAbsoluteProfitBreach; this.HasRelativeProfitBreach = hasRelativeProfitBreach; this.ExchangeRateProfits = profitBreakdown; }
public HighProfitJudgementContext(HighProfitJudgement judgement, bool projectToAlert) { this.Judgement = judgement; this.RaiseRuleViolation = projectToAlert; }