public SystemProcessOperationContext(
            ISystemProcessContext systemProcessContext,
            ISystemProcessOperationRepository systemProcessOperationRepository,
            ISystemProcessOperationRunRuleContextFactory runRuleContextFactory,
            ISystemProcessOperationDistributeRuleContextFactory distributeRuleContextFactory,
            ISystemProcessOperationFileUploadContextFactory uploadFileFactory,
            ISystemProcessOperationDataRequestContextFactory dataRequestFactory,
            IOperationLogging operationLogging)
        {
            this._systemProcessContext =
                systemProcessContext ?? throw new ArgumentNullException(nameof(systemProcessContext));

            this._systemProcessOperationRepository = systemProcessOperationRepository
                                                     ?? throw new ArgumentNullException(
                                                               nameof(systemProcessOperationRepository));

            this._runRuleContextFactory =
                runRuleContextFactory ?? throw new ArgumentNullException(nameof(runRuleContextFactory));

            this._distributeRuleContextFactory = distributeRuleContextFactory
                                                 ?? throw new ArgumentNullException(
                                                           nameof(distributeRuleContextFactory));

            this._uploadFileFactory = uploadFileFactory ?? throw new ArgumentNullException(nameof(uploadFileFactory));

            this._dataRequestFactory =
                dataRequestFactory ?? throw new ArgumentNullException(nameof(dataRequestFactory));

            this._operationLogging = operationLogging ?? throw new ArgumentNullException(nameof(operationLogging));
        }
Esempio n. 2
0
        public SystemProcessOperationRuleRunGraphType(
            ISystemProcessOperationRepository operationRepository,
            IDataLoaderContextAccessor dataLoaderAccessor)
        {
            this.AuthorizeWith(PolicyManifest.UserPolicy);

            this.Field(i => i.Id).Description("Identifier for the system process operation rule run");
            this.Field(i => i.CorrelationId, true).Description("Correlation id for the system process operation rule run");
            this.Field(i => i.IsBackTest, true).Description("Back test flag for the rule run");
            this.Field(i => i.IsForceRun, true).Description("Force run flag for the rule run");
            this.Field(i => i.RuleDescription).Description("Rule description for the rule run");
            this.Field(i => i.RuleParameterId, true).Description("Rule id");
            this.Field(i => i.RuleTypeId, true).Description("Rule category id");
            this.Field(i => i.RuleVersion).Description("The version of the rule ran");
            this.Field(i => i.ScheduleRuleStart).Type(new DateTimeGraphType()).Description(
                "The start date for the rule run. The actual data for the rule run is pushed out by the rule time window");
            this.Field(i => i.ScheduleRuleEnd).Type(new DateTimeGraphType()).Description(
                "The end date for the rule run. This is the date in the data, not in the real world");

            this.Field <SystemProcessOperationGraphType>(
                "processOperation",
                resolve: context =>
            {
                var loader = dataLoaderAccessor.Context.GetOrAddLoader(
                    $"GetSystemProcessOperationById-{context.Source.SystemProcessOperationId}",
                    () => operationRepository.GetForId(context.Source.SystemProcessOperationId));

                return(loader.LoadAsync());
            });
        }
 public DashboardModel(
     ISystemProcessRepository systemProcessRepository,
     ISystemProcessOperationRuleRunRepository systemProcessRuleRunRepository,
     ISystemProcessOperationRepository systemProcessOperationRepository,
     ISystemProcessOperationDistributeRuleRepository systemProcessDistributeRepository,
     IExceptionRepository exceptionRepository,
     IApiHeartbeat apiHeartbeat,
     ISystemProcessOperationUploadFileRepository systemProcessUploadFileRepository,
     ILogger <DashboardModel> logger)
 {
     this._systemProcessRepository = systemProcessRepository
                                     ?? throw new ArgumentNullException(nameof(systemProcessRepository));
     this._systemProcessRuleRunRepository = systemProcessRuleRunRepository
                                            ?? throw new ArgumentNullException(
                                                      nameof(systemProcessRuleRunRepository));
     this._systemProcessOperationRepository = systemProcessOperationRepository
                                              ?? throw new ArgumentNullException(
                                                        nameof(systemProcessOperationRepository));
     this._systemProcessDistributeRepository = systemProcessDistributeRepository
                                               ?? throw new ArgumentNullException(
                                                         nameof(systemProcessDistributeRepository));
     this._exceptionRepository =
         exceptionRepository ?? throw new ArgumentNullException(nameof(exceptionRepository));
     this._apiHeartbeat = apiHeartbeat ?? throw new ArgumentNullException(nameof(apiHeartbeat));
     this._systemProcessUploadFileRepository = systemProcessUploadFileRepository
                                               ?? throw new ArgumentNullException(
                                                         nameof(systemProcessUploadFileRepository));
     this._logger = logger ?? throw new ArgumentNullException(nameof(logger));
 }
        public RuleBreachGraphType(
            IOrderRepository orders,
            ISystemProcessOperationRepository operationRepository,
            IDataLoaderContextAccessor dataLoaderAccessor)
        {
            this.AuthorizeWith(PolicyManifest.UserPolicy);

            this.Field(t => t.Id).Description("Primary Key");
            this.Field(t => t.CorrelationId, true).Description("Correlation identifier for rule runs");
            this.Field(t => t.IsBackTest).Description("Was the rule run part of a back test?");
            this.Field(t => t.CreatedOn).Type(new DateTimeGraphType())
            .Description("Rule breach created by the rule engine");
            this.Field(t => t.Title, true).Description("Title description of the rule breach");
            this.Field(t => t.Description, true).Description("Detailed explanation of why the rule was breached");
            this.Field(t => t.Venue, true).Description("Name of the market that the rule breach occurred on");
            this.Field(t => t.StartOfPeriodUnderInvestigation).Type(new DateTimeGraphType())
            .Description("Oldest order in the rule breach orders");
            this.Field(t => t.EndOfPeriodUnderInvestigation).Type(new DateTimeGraphType())
            .Description("Youngest order in the rule breach orders");
            this.Field(t => t.AssetCfi, true).Description(
                "Asset CFI code. Six letters to categorise the type of asset such as E for equities or D for debt instruments");
            this.Field(t => t.ReddeerEnrichmentId, true)
            .Description("Identifier for the financial instrument in the security master list");
            this.Field(t => t.RuleId, true).Description("Rule run id");

            this.Field <OrganisationTypeEnumGraphType>(
                "organisationFactor",
                resolve: context => context.Source.OrganisationFactor);
            this.Field(t => t.OrganisationalFactorValue, true).Description(
                "The organisational factor value for the organisational factor type i.e. for funds 'The medallion fund'");
            this.Field(t => t.SystemOperationId).Description("sys op id");

            this.Field <SystemProcessOperationGraphType>(
                "processOperation",
                resolve: context =>
            {
                var loader = dataLoaderAccessor.Context.GetOrAddLoader(
                    $"GetSystemProcessOperationById-{context.Source.SystemOperationId}",
                    () => operationRepository.GetForId(context.Source.SystemOperationId));

                return(loader.LoadAsync());
            });

            this.Field <ListGraphType <OrderGraphType> >(
                "orders",
                resolve: context =>
            {
                var loader = dataLoaderAccessor.Context.GetOrAddCollectionBatchLoader <int, IOrder>(
                    $"GetRuleBreachOrdersByRuleBreachId-{context.Source.Id}",
                    orders.GetAllForRuleBreach);

                return(loader.LoadAsync(context.Source.Id));
            });
        }
Esempio n. 5
0
 public SystemProcessOperationContextFactory(
     ISystemProcessOperationRepository operationContext,
     ISystemProcessOperationRunRuleContextFactory ruleRunRepository,
     ISystemProcessOperationDistributeRuleContextFactory distributeRuleFactory,
     IOperationLogging operationLogging,
     ISystemProcessOperationFileUploadContextFactory fileUploadFactory,
     ISystemProcessOperationDataRequestContextFactory dataRequestFactory)
 {
     this._operationRepository   = operationContext ?? throw new ArgumentNullException(nameof(operationContext));
     this._ruleRunFactory        = ruleRunRepository ?? throw new ArgumentNullException(nameof(ruleRunRepository));
     this._distributeRuleFactory =
         distributeRuleFactory ?? throw new ArgumentNullException(nameof(distributeRuleFactory));
     this._operationLogging   = operationLogging ?? throw new ArgumentNullException(nameof(operationLogging));
     this._fileUploadFactory  = fileUploadFactory ?? throw new ArgumentNullException(nameof(fileUploadFactory));
     this._dataRequestFactory =
         dataRequestFactory ?? throw new ArgumentNullException(nameof(dataRequestFactory));
 }
        public SystemProcessOperationUploadFileGraphType(
            ISystemProcessOperationRepository operationRepository,
            IDataLoaderContextAccessor dataLoaderAccessor)
        {
            this.AuthorizeWith(PolicyManifest.AdminPolicy);

            this.Field(i => i.Id).Description("Identifier for the system process operation upload file");
            this.Field <SystemProcessOperationGraphType>(
                "processOperation",
                resolve: context =>
            {
                var loader = dataLoaderAccessor.Context.GetOrAddLoader(
                    $"GetSystemProcessOperationById-{context.Source.Id}",
                    () => operationRepository.GetForId(context.Source.Id));

                return(loader.LoadAsync());
            });

            this.Field(i => i.FilePath, true).Description("The path of the file uploaded from disk");
            this.Field(i => i.FileType, true).Description("The type of the file being uploaded");
        }
Esempio n. 7
0
        public SystemProcessOperationDataSynchroniserRequestGraphType(
            ISystemProcessOperationRepository operationRepository,
            ISystemProcessOperationRuleRunRepository ruleRunRepository,
            IDataLoaderContextAccessor dataLoaderAccessor)
        {
            this.AuthorizeWith(PolicyManifest.AdminPolicy);

            this.Field(i => i.Id).Description("Identifier for the system process operation data synchroniser request");
            this.Field(i => i.QueueMessageId, true).Description("Queue message id");

            this.Field(i => i.RuleRunId, true).Description("Rule run identifier for the data synchroniser");
            this.Field <ListGraphType <SystemProcessOperationRuleRunGraphType> >(
                "ruleRun",
                resolve: context =>
            {
                IQueryable <ISystemProcessOperationRuleRun> IdQuery(IQueryable <ISystemProcessOperationRuleRun> i)
                {
                    return(i.Where(x => x.SystemProcessOperationId == context.Source.RuleRunId));
                }

                var loader = dataLoaderAccessor.Context.GetOrAddLoader(
                    $"GetSystemProcessOperationRuleRunById-{context.Source.RuleRunId}",
                    () => ruleRunRepository.Query(IdQuery));

                return(loader.LoadAsync());
            });

            this.Field <SystemProcessOperationGraphType>(
                "processOperation",
                resolve: context =>
            {
                var loader = dataLoaderAccessor.Context.GetOrAddLoader(
                    $"GetSystemProcessOperationById-{context.Source.Id}",
                    () => operationRepository.GetForId(context.Source.Id));

                return(loader.LoadAsync());
            });
        }
        public SystemProcessOperationDistributeRuleGraphType(
            ISystemProcessOperationRepository operationRepository,
            IDataLoaderContextAccessor dataLoaderAccessor)
        {
            this.AuthorizeWith(PolicyManifest.AdminPolicy);

            this.Field(i => i.Id).Description("Identifier for the system process operation distribute rule");
            this.Field <SystemProcessOperationGraphType>(
                "processOperation",
                resolve: context =>
            {
                var loader = dataLoaderAccessor.Context.GetOrAddLoader(
                    $"GetSystemProcessOperationById-{context.Source.Id}",
                    () => operationRepository.GetForId(context.Source.Id));

                return(loader.LoadAsync());
            });

            this.Field(i => i.ScheduleRuleInitialStart).Type(new DateTimeGraphType())
            .Description("Scheduled rule start before distribution");
            this.Field(i => i.ScheduleRuleInitialEnd, true).Type(new DateTimeGraphType())
            .Description("Scheduled rule end before distribution");
            this.Field(i => i.RulesDistributed, true).Description("Rules distributed by the disassemble operation");
        }