public SuggestedStrategiesService(IOptionsPlayUow uow, IPredictionAndStdDevService predictionAndStdDevService, IMarketDataService marketDataService, IStrategyService strategyService)
     : base(uow)
 {
     _predictionAndStdDevService = predictionAndStdDevService;
     _marketDataService          = marketDataService;
     _strategyService            = strategyService;
 }
Пример #2
0
        public static string Cooperation(WorkflowContext context, ExecutingContext executeContext)
        {
            string           resultTo        = String.Empty;
            Node             current         = context.Current;
            AbstractWorkflow workflowService = WorkflowGlobalServiceProvider.Resolve <AbstractWorkflow>();

            IWorkflowCooperationService workflowCooperationService = workflowService.NodeService.WorkflowCooperationService;
            IStrategyService            strategyService            = (IStrategyService)Utils.CreateInstance(current.Assistant);
            string instanceID = context.Instance.InstanceID;

            workflowService.NodeService.WorkflowCooperationService.Persistent(new WorkflowCooperation
            {
                NodeID       = current.NID,
                InstanceID   = context.Instance.InstanceID,
                TransitionID = context.TransitionID,
                CreateTime   = DateTime.Now
            });

            IList <WorkflowCooperation> records = workflowCooperationService.Query(instanceID).Where(e => e.NodeID == current.NID).ToList();

            executeContext.Result = strategyService.Check(records);
            if (executeContext.Result)
            {
                IWorkflowCooperationDecision workflowCooperationDecision = (IWorkflowCooperationDecision)Utils.CreateInstance(current.Cooperation);
                resultTo = workflowCooperationDecision.Execute(records);
                workflowService.NodeService.WorkflowCooperationService.Delete(instanceID, current.NID);
            }
            else
            {
                workflowService.Actions.ForEach(pluin => pluin.ActionExecute(executeContext));
            }
            return(resultTo);
        }
 /// <summary>
 /// Creates a new instance of <see cref="SimulationService"/>
 /// </summary>
 /// <param name="strategyService"></param>
 /// <param name="indicatorsService"></param>
 /// <param name="companyService"></param>
 /// <param name="priceService"></param>
 public SimulationService(IStrategyService strategyService, IIndicatorsService indicatorsService, ICompanyService companyService, IPriceService priceService)
 {
     _strategyService   = strategyService;
     _indicatorsService = indicatorsService;
     _companyService    = companyService;
     _priceService      = priceService;
 }
Пример #4
0
 public PlacementsController(IPlacementService placementService, IStrategyService strategyService, ICreativeService creativeService, IMappingEngine mapping)
 {
     _placementService = placementService;
     _strategyService  = strategyService;
     _creativeService  = creativeService;
     _mapping          = mapping;
 }
        /// <summary>Initializes a new instance of the <see cref="LevelsViewPresenter"/> class.</summary>
        /// <param name="view">The view.</param>
        /// <param name="msgBoxService">The msg box service.</param>
        /// <param name="fileBrowserService">The file browser service.</param>
        /// <param name="eventAggregator">The event aggregator.</param>
        /// <param name="fileManagerService">The file Manager Service.</param>
        /// <param name="strategyService"></param>
        public LevelsViewPresenter(
            ILevelsView view,
            IMessageBoxService msgBoxService,
            IFileBrowserService fileBrowserService,
            IEventAggregator eventAggregator,
            IFileManagerService fileManagerService,
            IStrategyService strategyService)
        {
            // Wire up our services
            this.msgBoxService = msgBoxService;
            this.fileBrowserService = fileBrowserService;
            this.fileManagerService = fileManagerService;
            this.eventAggregator = eventAggregator;
            this.strategyService = strategyService;

            this.view = view;

            view.ViewLoad += this.LevelsViewOnViewLoad;
            view.SelectionChanged += this.LevelsViewOnSelectionChanged;
            view.LevelDrag += this.OnLevelItemDrag;
            view.LevelDragDrop += this.OnLevelDragDrop;
            view.LevelDragEnter += this.OnLevelDragEnter;

            view.Tree.AllowDrop = true;

            this.eventAggregator.GetEvent<SaveLevelsMessage>().Subscribe(this.OnSaveLevels);
            this.eventAggregator.GetEvent<AddLevelMessage>().Subscribe(this.OnAddLevel);
            this.eventAggregator.GetEvent<RemoveLevelMessage>().Subscribe(this.OnRemoveLevel);
            this.eventAggregator.GetEvent<OpenPartMessage>().Subscribe(this.OnOpenParts);
            this.eventAggregator.GetEvent<SaveStrategyMessage>().Subscribe(this.OnSaveStrategyEvent);
            this.eventAggregator.GetEvent<OpenStrategyMessage>().Subscribe(this.OnLoadStrategyEvent);
            this.eventAggregator.GetEvent<OpenLevelsMessage>().Subscribe(this.OnOpenLevelsEvent);
        }
Пример #6
0
 public SimulationService(ISimulationRepository simulationRepository, IPopulationService populationService,
                          IStrategyService strategyService, ISimulationSettingsProvider simulationSettingsProdiver)
 {
     _populationService    = populationService;
     _simulationRepository = simulationRepository;
     _strategyService      = strategyService;
     _simulationSettings   = simulationSettingsProdiver.GetSimulationSettings();
 }
Пример #7
0
 public PlacementService(IRepositoryAsync <Placement> placementRepositoryAsync, IStrategyService strategyService, ICreativeService creativeService, IClock clock, IBrandscreenContext brandscreenContext)
 {
     _placementRepositoryAsync = placementRepositoryAsync;
     _strategyService          = strategyService;
     _creativeService          = creativeService;
     _clock = clock;
     _brandscreenContext = brandscreenContext;
 }
Пример #8
0
        public void test_strategy_manager_as_service()
        {
            ChannelFactory <IStrategyService> channelFactory = new ChannelFactory <IStrategyService>("");

            IStrategyService proxy = channelFactory.CreateChannel();

            test_manager_as_service(proxy as ICommunicationObject, "IStrategyService");

            channelFactory.Close();
        }
Пример #9
0
        public Village(IDiceService diceService, IStrategyService strategyService, IRules rules)
        {
            _diceService     = diceService;
            _strategyService = strategyService;

            _charactersMap = new Dictionary <EFighterClass, Func <string, Qualification, ICharacter> >
            {
                { EFighterClass.Warrior, (name, qualification) => new Warrior(name, qualification, _strategyService, rules) },
                { EFighterClass.Ranger, (name, qualification) => new Archer(name, qualification, _strategyService, rules) },
            };
        }
Пример #10
0
        public StrategyManagerViewModel(ViewModelContext viewModelContext, IStrategyService strategyService)
            : base(viewModelContext)
        {
            this.strategyService = strategyService;

            AddStrategyCommand                = new ViewModelCommand(AddStrategy);
            DeleteStrategyCommand             = new ViewModelCommand(DeleteStrategy);
            AddStrategySubscriptionCommand    = new ViewModelCommand(AddStrategySubscription);
            DeleteStrategySubscriptionCommand = new ViewModelCommand(DeleteStrategySubscription);
            DeleteStrategyDependencyCommand   = new ViewModelCommand(DeleteStrategyDependency);
        }
        public StrategyManagerViewModel(ViewModelContext viewModelContext, IStrategyService strategyService, IStrategyFileManager strategyFileManager)
            : base(viewModelContext)
        {
            this.strategyService     = strategyService;
            this.strategyFileManager = strategyFileManager;

            AddStrategyCommand    = new ViewModelCommand(AddStrategy);
            DeleteStrategyCommand = new ViewModelCommand(DeleteStrategy);
            CloseCommand          = new ViewModelCommand(Close);

            SelectedStrategyViewModels      = new ObservableCollection <StrategyViewModel>();
            strategyObservableSubscriptions = new Dictionary <string, IDisposable>();
        }
Пример #12
0
        public StrategyViewModel(Strategy strategy, IStrategyService strategyService, IStrategyFileManager strategyFileManager, ILoggerFacade logger)
            : base(logger)
        {
            this.strategy            = strategy;
            this.strategyService     = strategyService;
            this.strategyFileManager = strategyFileManager;

            AddStrategySubscriptionCommand    = new ViewModelCommand(AddStrategySubscription);
            DeleteStrategySubscriptionCommand = new ViewModelCommand(DeleteStrategySubscription);
            DeleteStrategyDependencyCommand   = new ViewModelCommand(DeleteStrategyDependency);
            AddParameterSchemaCommand         = new ViewModelCommand(AddParameterSchema);

            OnPropertyChanged(string.Empty);
        }
Пример #13
0
 public PortfolioOrchestrator(
     IPortfolioManager portfolioManager,
     IMarketWorkTimeService marketWorkTimeService,
     IMarketDataProviderQueryable marketDataProviderQueryable,
     IMarketDataService marketDataService,
     IStrategyService strategyService,
     IAccountManager accountManager)
 {
     _portfolioManager            = portfolioManager;
     _marketWorkTimeService       = marketWorkTimeService;
     _marketDataProviderQueryable = marketDataProviderQueryable;
     _marketDataService           = marketDataService;
     _strategyService             = strategyService;
     _accountManager = accountManager;
 }
Пример #14
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Accumulator"/> class
        /// </summary>
        /// <param name="strategyService"> A service from which the algorithmic strategies are retrieved </param>
        /// <param name="specificationService"> A service of specifications that the sentence (or path) must satisfy </param>
        public Accumulator(IStrategyService strategyService, ISpecificationService specificationService)
        {
            if (strategyService == null)
            {
                throw new ArgumentNullException("strategyService");
            }

            if (specificationService == null)
            {
                throw new ArgumentNullException("specificationService");
            }

            this._strategyService = strategyService;
            this._specificationService = specificationService;
        }
 public StrategiesController(IStrategyService strategyService,
                             IStrategyTargetingService strategyTargetingService,
                             IStrategyTargetingUpdateService strategyTargetingUpdateService,
                             ICampaignService campaignService,
                             IMappingEngine mapping,
                             IClock clock,
                             ICacheManager cacheManager)
 {
     _strategyService                = strategyService;
     _strategyTargetingService       = strategyTargetingService;
     _strategyTargetingUpdateService = strategyTargetingUpdateService;
     _campaignService                = campaignService;
     _mapping      = mapping;
     _clock        = clock;
     _cacheManager = cacheManager;
 }
Пример #16
0
        public StrategyViewModel(ViewModelContext viewModelContext, IStrategyService strategyService)
            : base(viewModelContext)
        {
            this.strategyService = strategyService;

            CanConnect   = true;
            IsConnected  = false;
            IsConnecting = false;

            Notifications = new ObservableCollection <Message>();

            RunCommand                = new ViewModelCommand(RunStrategy);
            MonitorCommand            = new ViewModelCommand(MonitorStrategy);
            DisconnectCommand         = new ViewModelCommand(Disconnect);
            StopCommand               = new ViewModelCommand(StopStrategy);
            ClearNotificationsCommand = new ViewModelCommand(ClearNotifications);
        }
Пример #17
0
        protected void Discuss(WorkflowContext context, Node current, ExecutingContext executeContext, string actorID)
        {
            string instanceID = context.Instance.InstanceID;

            IWorkflowCooperationService workflowCooperationService = workflowService.NodeService.WorkflowCooperationService;
            IStrategyService            strategyService            = workflowService.StrategyService;

            workflowService.NodeService.WorkflowCooperationService.Persistent(new WorkflowCooperation
            {
                NID            = Guid.NewGuid().ToString(),
                NodeID         = current.NID,
                InstanceID     = context.Instance.InstanceID,
                TransitionID   = context.TransitionID,
                CreateDateTime = DateTime.Now
            });

            IList <WorkflowCooperation> records = workflowCooperationService.Query(instanceID)
                                                  .Where(e => e.NodeID == current.NID)
                                                  .ToList();

            executeContext.Result = strategyService.Check(records);
            if (executeContext.Result)
            {
                string     to         = strategyService.Use().Execute(records);
                Transition transition = current.Transitions.FirstOrDefault(e => e.NID == to);
                Node       node       = workflowService.NodeService.Query(current.InstanceID)
                                        .Where(e => e.ID == transition.Destination).FirstOrDefault();

                this.Invoke(node, instanceID, transition, new ExecutingContext()
                {
                    From      = current,
                    To        = node,
                    Instance  = context.Instance,
                    Data      = context.Data,
                    Result    = executeContext.Result,
                    Direction = executeContext.Direction
                }, actorID, context);
            }
            else
            {
                workflowService.Actions.ForEach(pluin => pluin.ActionExecute(executeContext));
            }
        }
Пример #18
0
        /// <summary>Initializes a new instance of the <see cref="ShellView"/> class.</summary>
        /// <param name="msgBoxService">The msg Box Service.</param>
        /// <param name="fileBrowserService">The file Browser Service.</param>
        /// <param name="eventAggregator">The event Aggregator.</param>
        /// <param name="operationscommands"></param>
        /// <param name="levelscommands"></param>
        /// <param name="fileManagerService"></param>
        /// <param name="buttonsCommands"></param>
        /// <param name="strategyService"></param>
        public ShellView(IMessageBoxService msgBoxService, 
            IFileBrowserService fileBrowserService, 
            IEventAggregator eventAggregator,
            List<IToolbarCommand> operationscommands, 
            List<IToolbarCommand> levelscommands, 
            IFileManagerService fileManagerService, 
            List<IButtonsCommand> buttonsCommands, 
            IStrategyService strategyService)
        {
            this.InitializeComponent();

            // Wire up our view presenters
            var toolbarOperationsView = new ToolbarButtonView { Dock = DockStyle.Top };
            var toolbarViewPresenter = new ToolbarViewPresenter(toolbarOperationsView, operationscommands);

            var toolbarLevelsView = new ToolbarButtonView { Dock = DockStyle.Top };
            var toolbarLevelsViewPresenter = new ToolbarViewPresenter(toolbarLevelsView, levelscommands);


            var buttonView = new ButtonBarView { Dock = DockStyle.Fill };
            var buttonViewPresenter = new ButtonBarViewPresenter(buttonView, buttonsCommands);

            var levelView = new LevelsView { Dock = DockStyle.Fill, Margin = new Padding(5) };
            var levelViewPresenter = new LevelsViewPresenter(levelView, msgBoxService, fileBrowserService, eventAggregator, fileManagerService, strategyService);

            var opsView = new OperationsView { Dock = DockStyle.Fill, Margin = new Padding(5) };
            var opsViewPresenter = new OperationsViewPresenter(opsView, msgBoxService, fileBrowserService, eventAggregator, strategyService);

            // Wire up the views
            this.buttonBarView = buttonView;
            this.toolbarOperationsButtonView = toolbarOperationsView;
            this.toolbarLevelsButtonView = toolbarLevelsView;
            this.levelsView = levelView;
            this.operationsView = opsView;

            this.eventAggregator = eventAggregator;
            this.eventAggregator.GetEvent<CloseShellMessage>().Subscribe(this.OnCloseShell);
           
            // Place the views in the correct regions
            this.InjectViews();
        }
Пример #19
0
        protected Character(string name, Qualification qualification, IStrategyService strategyService, IRules rules)
        {
            Name             = name;
            _qualification   = qualification;
            _strategyService = strategyService;
            _stats           = rules.GetStats(_qualification);
            Id = Guid.NewGuid();

            HealthChanged += OnHealthChanged;

            _conditionMap = new Dictionary <int, EWounds>
            {
                { 0, EWounds.Dead },
                { (int)(0.1 * _stats.Health), EWounds.Faint },
                { (int)(0.2 * _stats.Health), EWounds.ReallyBad },
                { (int)(0.3 * _stats.Health), EWounds.Badly },
                { (int)(0.5 * _stats.Health), EWounds.Injured },
                { (int)(0.7 * _stats.Health), EWounds.SlightlyInjured },
                { (int)(0.9 * _stats.Health), EWounds.Scratched },
                { _stats.Health, EWounds.Healthy }
            };
        }
Пример #20
0
        public StrategyRunnerViewModel(
            ViewModelContext viewModelContext,
            AccountViewModel accountViewModel,
            SymbolsViewModel symbolsViewModel,
            OrdersViewModel ordersViewModel,
            StrategyParametersViewModel strategyParametersViewModel,
            IStrategyService strategyService,
            IServerMonitorCache serverMonitorCache,
            IStrategyAssemblyManager strategyAssemblyManager)
            : base(viewModelContext)
        {
            this.strategyService         = strategyService;
            this.serverMonitorCache      = serverMonitorCache;
            this.strategyAssemblyManager = strategyAssemblyManager;

            AccountViewModel            = accountViewModel;
            SymbolsViewModel            = symbolsViewModel;
            OrdersViewModel             = ordersViewModel;
            StrategyParametersViewModel = strategyParametersViewModel;

            CanRun       = false;
            CanMonitor   = false;
            IsConnected  = false;
            IsConnecting = false;

            Notifications = new ObservableCollection <Message>();

            RunCommand                = new ViewModelCommand(RunStrategy);
            MonitorCommand            = new ViewModelCommand(MonitorStrategy);
            DisconnectCommand         = new ViewModelCommand(Disconnect);
            StopCommand               = new ViewModelCommand(StopStrategy);
            ClearNotificationsCommand = new ViewModelCommand(ClearNotifications);

            ObserveOrders();
            ObserveSymbols();
            ObserveAccount();
            ObserveParameters();
            ObserveServerMonitorCache();
        }
        /// <summary>Initializes a new instance of the <see cref="OperationsViewPresenter"/> class.</summary>
        /// <param name="view">The view.</param>
        /// <param name="msgBoxService">The msg box service.</param>
        /// <param name="fileBrowserService">The file browser service.</param>
        /// <param name="eventAggregator">The event aggregator.</param>
        /// <param name="strategyService">The Strategy Service</param>
        public OperationsViewPresenter(IOperationsView view,
            IMessageBoxService msgBoxService,
            IFileBrowserService fileBrowserService,
            IEventAggregator eventAggregator,
            IStrategyService strategyService)
        {
            // Wire up our services
            this.msgBoxService = msgBoxService;
            this.fileBrowserService = fileBrowserService;
            this.eventAggregator = eventAggregator;
            this.strategyService = strategyService;

            this.view = view;
            view.ViewLoad += this.OperationsViewOnViewLoad;
            view.SelectionChanged += this.OperationsViewOnSelectionChanged;
            view.OperationDrag += this.OnOperationItemDrag;
            view.OperationDragDrop += this.OnOperationDragDrop;
            view.OperationDragEnter += this.OnOperationDragEnter;
            view.Tree.AllowDrop = true;

            // Event subscriptions
            this.eventAggregator.GetEvent<OperationsLibraryLoadMessage>().Subscribe(this.OnOperationsLibraryLoadEvent);
        }
 public StrategiesController(IStrategyService strategyService)
 {
     this._strategyService = strategyService;
 }
Пример #23
0
 public StrategiesOrchestrator(IStrategyService strategyService)
 {
     _strategyService = strategyService;
 }
 /// <summary>
 /// Creates a new instance of <see cref="StrategiesController"/>
 /// </summary>
 /// <param name="strategyService"></param>
 /// <param name="indicatorsService"></param>
 public StrategiesController(IStrategyService strategyService, IIndicatorsService indicatorsService)
 {
     _strategyService   = strategyService;
     _indicatorsService = indicatorsService;
 }
Пример #25
0
 public void init()
 {
     service = new StrategyService();
 }
Пример #26
0
 public StrategiesController(IStrategyService strategyService)
 {
     _strategyService = strategyService;
 }
Пример #27
0
 /// <summary>
 /// Creates a new instance of <see cref="SimulationsController"/>
 /// </summary>
 /// <param name="strategyService"></param>
 /// <param name="companyService"></param>
 /// <param name="simulationService"></param>
 public SimulationsController(IStrategyService strategyService, ICompanyService companyService, ISimulationService simulationService)
 {
     _strategyService   = strategyService;
     _companyService    = companyService;
     _simulationService = simulationService;
 }
Пример #28
0
 public StrategiesController(StrategiesOrchestrator strategiesOrchestrator, IStrategyService strategyService)
 {
     _strategiesOrchestrator = strategiesOrchestrator;
     _strategyService        = strategyService;
 }
Пример #29
0
 public GameController(ApplitactionDbContext dbcontext, IStrategyService service)
 {
     _dbcontext = dbcontext;
     _service   = service;
 }
Пример #30
0
 public Warrior(string name, Qualification qualification, IStrategyService strategyService, IRules rules) :
     base(name, qualification, strategyService, rules)
 {
     _currentStrategy = _strategyService.GetStrategy(EStrategies.Aggressive);
 }
Пример #31
0
 public StrategyServiceTests()
 {
     _service = new StrategyService(_strategyRepository.Object, _indicatorsService.Object);
     _strategyRepository.Setup(s => s.GetQueryable())
     .Returns(_strategies.GetTestAsyncQueryable());
 }
 public StrategiesApiController(IStrategyService service)
 {
     _service = service;
 }
Пример #33
0
 public CountryController(ApplitactionDbContext dbcontext, IStrategyService service, IUnitBuildingSetterService s2)
 {
     _dbcontext = dbcontext;
     _service   = service;
     _ibserv    = s2;
 }
Пример #34
0
 public Archer(string name, Qualification qualification, IStrategyService strategyService, IRules rules) :
     base(name, qualification, strategyService, rules)
 {
 }
Пример #35
0
 public GameService(IStrategyService strategyService, IGameSettingsProvider gameSettingsProvider)
 {
     _strategyService = strategyService;
     _gameSettings    = gameSettingsProvider.GetGameSettings();
 }