Ejemplo n.º 1
0
        public void GetMatchingRules_NumericValueNotMatch_RuleNotReturned()
        {
            // Arrange
            IRulesService <TestModel> engine = RulesService <TestModel> .CreateDefault();

            // Act
            var numericValueTest       = 5;
            var numericValueOtherValue = 6;
            var matching = engine.GetMatchingRules(
                new TestModel {
                NumericField = numericValueTest
            },
                new[] {
                new RulesConfig {
                    Id            = Guid.NewGuid(),
                    RulesOperator = Rule.InterRuleOperatorType.And,
                    RulesGroups   = new RulesGroup[] {
                        new RulesGroup {
                            RulesOperator = Rule.InterRuleOperatorType.And,
                            Rules         = new[] {
                                new Rule {
                                    ComparisonOperator = Rule.ComparisonOperatorType.Equal, ComparisonValue = numericValueOtherValue.ToString(), ComparisonPredicate = nameof(TestModel.NumericField)
                                }
                            }
                        }
                    }
                }
            });

            // Assert
            Assert.Empty(matching.Data);
        }
Ejemplo n.º 2
0
 public SignalsService(ILoggingService loggingService, IHealthCheckService healthCheckService, ITradingService tradingService, IRulesService rulesService)
 {
     this.loggingService     = loggingService;
     this.healthCheckService = healthCheckService;
     this.tradingService     = tradingService;
     this.rulesService       = rulesService;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="customerRepository">FDNS Object Customer repository</param>
 /// <param name="storageRepository">FDNS Storage repository</param>
 /// <param name="indexingService">FDNS Indexing service</param>
 /// <param name="rulesService">FDNS Rules service</param>
 /// <param name="customerImporter">Customer importer</param>
 public CustomerController(IObjectRepository <Customer> customerRepository, IStorageRepository storageRepository, IIndexingService indexingService, IRulesService rulesService, ICustomerImporter customerImporter)
 {
     _customerRepository = customerRepository;
     _storageRepository  = storageRepository;
     _indexingService    = indexingService;
     _rulesService       = rulesService;
     _customerImporter   = customerImporter;
 }
 public SignalRulesTimedTask(ILoggingService loggingService, IHealthCheckService healthCheckService, ITradingService tradingService, IRulesService rulesService, ISignalsService signalsService)
 {
     this.loggingService     = loggingService;
     this.healthCheckService = healthCheckService;
     this.tradingService     = tradingService;
     this.rulesService       = rulesService;
     this.signalsService     = signalsService;
 }
Ejemplo n.º 5
0
        public void Start()
        {
            loggingService.Info($"Start Trading service (Virtual: {Config.VirtualTrading})...");

            IsTradingSuspended = true;

            orderingService = Application.Resolve <IOrderingService>();
            rulesService    = Application.Resolve <IRulesService>();
            OnTradingRulesChanged();
            rulesService.RegisterRulesChangeCallback(OnTradingRulesChanged);
            Exchange.Start(Config.VirtualTrading);
            signalsService = Application.Resolve <ISignalsService>();

            if (!Config.VirtualTrading)
            {
                Account = new ExchangeAccount(loggingService, notificationService, healthCheckService, signalsService, this);
            }
            else
            {
                Account = new VirtualAccount(loggingService, notificationService, healthCheckService, signalsService, this);
            }

            accountRefreshTimedTask = tasksService.AddTask(
                name: nameof(AccountRefreshTimedTask),
                task: new AccountRefreshTimedTask(loggingService, healthCheckService, this),
                interval: Config.AccountRefreshInterval * 1000 / Application.Speed,
                startDelay: Constants.TaskDelays.ZeroDelay,
                startTask: false,
                runNow: true,
                skipIteration: 0);

            if (signalsService.Config.Enabled)
            {
                signalsService.Start();
            }

            tradingTimedTask = tasksService.AddTask(
                name: nameof(TradingTimedTask),
                task: new TradingTimedTask(loggingService, notificationService, healthCheckService, signalsService, orderingService, this),
                interval: Config.TradingCheckInterval * 1000 / Application.Speed,
                startDelay: Constants.TaskDelays.NormalDelay,
                startTask: false,
                runNow: false,
                skipIteration: 0);

            tradingRulesTimedTask = tasksService.AddTask(
                name: nameof(TradingRulesTimedTask),
                task: new TradingRulesTimedTask(loggingService, notificationService, healthCheckService, rulesService, signalsService, this),
                interval: RulesConfig.CheckInterval * 1000 / Application.Speed,
                startDelay: Constants.TaskDelays.MidDelay,
                startTask: false,
                runNow: false,
                skipIteration: 0);

            IsTradingSuspended = false;

            loggingService.Info("Trading service started");
        }
Ejemplo n.º 6
0
        public RulesController(IRulesService _rs)
        {
            if (_rs == null)
            {
                throw new NotImplementedException("Rules service is not implemented");
            }

            rs = _rs;
        }
Ejemplo n.º 7
0
 public TradingRulesTimedTask(ILoggingService loggingService, INotificationService notificationService, IHealthCheckService healthCheckService, IRulesService rulesService, ISignalsService signalsService, ITradingService tradingService)
 {
     this.loggingService      = loggingService;
     this.notificationService = notificationService;
     this.healthCheckService  = healthCheckService;
     this.rulesService        = rulesService;
     this.signalsService      = signalsService;
     this.tradingService      = tradingService as TradingService;
 }
 public BacktestingSignalsService(ILoggingService loggingService, IHealthCheckService healthCheckService, ITasksService tasksService, ITradingService tradingService, IRulesService rulesService, IBacktestingService backtestingService)
 {
     this.loggingService     = loggingService;
     this.healthCheckService = healthCheckService;
     this.tasksService       = tasksService;
     this.tradingService     = tradingService;
     this.rulesService       = rulesService;
     this.backtestingService = backtestingService;
 }
Ejemplo n.º 9
0
        public void Start()
        {
            loggingService.Info($"Start Trading service (Virtual: {Config.VirtualTrading})...");

            IsTradingSuspended = true;

            rulesService = Application.Resolve <IRulesService>();
            OnTradingRulesChanged();
            rulesService.RegisterRulesChangeCallback(OnTradingRulesChanged);

            exchangeService.Start(Config.VirtualTrading);

            signalsService = Application.Resolve <ISignalsService>();

            if (!Config.VirtualTrading)
            {
                Account = new ExchangeAccount(loggingService, notificationService, healthCheckService, signalsService, this);
            }
            else
            {
                Account = new VirtualAccount(loggingService, notificationService, healthCheckService, signalsService, this);
            }

            accountTimedTask          = new AccountTimedTask(loggingService, healthCheckService, this);
            accountTimedTask.Interval = Config.AccountRefreshInterval * 1000 / Application.Speed;
            accountTimedTask.Run();
            Application.Resolve <ICoreService>().AddTask(nameof(AccountTimedTask), accountTimedTask);

            if (signalsService.Config.Enabled)
            {
                signalsService.Start();
            }

            tradingTimedTask                = new TradingTimedTask(loggingService, notificationService, healthCheckService, signalsService, this);
            tradingTimedTask.Interval       = Config.TradingCheckInterval * 1000 / Application.Speed;
            tradingTimedTask.StartDelay     = Constants.TimedTasks.StandardDelay;
            tradingTimedTask.LoggingEnabled = !isReplayingSnapshots;
            Application.Resolve <ICoreService>().AddTask(nameof(TradingTimedTask), tradingTimedTask);

            tradingRulesTimedTask          = new TradingRulesTimedTask(loggingService, notificationService, healthCheckService, rulesService, signalsService, this);
            tradingRulesTimedTask.Interval = RulesConfig.CheckInterval * 1000 / Application.Speed;
            Application.Resolve <ICoreService>().AddTask(nameof(TradingRulesTimedTask), tradingRulesTimedTask);

            IsTradingSuspended = false;

            loggingService.Info("Trading service started");
        }
 public PropertiesController(
     ICountriesService countriesService,
     ITownsService townsService,
     ICurrenciesService currenciesService,
     IPropertyCategoriesService propertyCategoriesService,
     IPropertiesService propertiesService,
     UserManager <ApplicationUser> userManager,
     IFacilitiesService facilitiesService,
     IRulesService rulesService,
     IWebHostEnvironment environment,
     IOffersService offersService)
     : base(townsService, currenciesService)
 {
     this.countriesService          = countriesService;
     this.propertyCategoriesService = propertyCategoriesService;
     this.propertiesService         = propertiesService;
     this.userManager       = userManager;
     this.facilitiesService = facilitiesService;
     this.rulesService      = rulesService;
     this.environment       = environment;
     this.offersService     = offersService;
 }
Ejemplo n.º 11
0
 public RulesController(IRulesService rules)
 {
     _rules = rules;
 }
Ejemplo n.º 12
0
 public CharactersController(IRulesService rules)
 {
     _rules = rules;
 }
Ejemplo n.º 13
0
 public RulesController(IRulesService rulesService, IMapper mapper)
 {
     _rulesService = rulesService;
     _mapper       = mapper;
 }
Ejemplo n.º 14
0
 public RulesController()
 {
     this.service = ServiceProxy.Create <IRulesService>(new Uri(Constants.RULES_SERVICE_URI));
 }
Ejemplo n.º 15
0
 public CharactersController(IRulesService rules)
 {
     _rules = rules;
 }
 public GetRulesQueryHandler(IRulesService rulesService, IGlobalRulesService globalRulesService)
 {
     _rulesService       = rulesService;
     _globalRulesService = globalRulesService;
 }
Ejemplo n.º 17
0
 /// <summary>
 ///     By applying dependency injection we make the purpose of the service more clear and segment the additional
 ///     responsitibilities
 ///     into injectable components
 /// </summary>
 public PaymentService(IDataStoreService dataStoreService, ILogService logService, IRulesService rulesService)
 {
     DataStoreService = dataStoreService;
     LogService       = logService;
     RulesService     = rulesService;
 }
Ejemplo n.º 18
0
 public CarManager(ICarDal carDal, IRulesService <IEntity> rules)
 {
     _carDal = carDal;
     _rules  = rules;
 }
 public ItemEventHandler(IRulesService rules)
 {
     Rules = rules;
 }
Ejemplo n.º 20
0
 public ColorManager(IColorDal colorDal, IRulesService <IEntity> rules)
 {
     _colorDal = colorDal;
     _rules    = rules;
 }
Ejemplo n.º 21
0
 public BrandManager(IBrandDal brandDal, IRulesService <IEntity> rules)
 {
     _brandDal = brandDal;
     _rules    = rules;
 }
Ejemplo n.º 22
0
 public RulesController(IRulesService rulesService)
 {
     _rulesService = rulesService;
 }
 public RunIftttRules(IRulesService rules)
 {
     Rules = rules;
 }
Ejemplo n.º 24
0
 public RulesViewModel()
 {
     _service = ServiceContainer.Resolve <IRulesService>();
 }