Exemple #1
0
 public OptimalStoppingStrategy(
     ISearcher searcher,
     IStakingService stakingService,
     OptimalStoppingParameters parameters)
 {
     _searcher       = searcher;
     _stakingService = stakingService;
     _parameters     = parameters;
 }
Exemple #2
0
        public void OptimalStoppingStrategyTest()
        {
            var data       = CreateMarketData();
            var parameters = new OptimalStoppingParameters();

            var target = SimulateStrategy(data, x => x.Create(parameters));
            var actual = ToApprovedString(target);

            Approvals.Verify(actual);
        }
Exemple #3
0
        public void Optimise(DateTime fromDate, DateTime toDate)
        {
            _stakingService.Evaluate(fromDate, toDate);

            var potentials = Enumerable.Range(3, 60)
                             .Select(wait => new OptimalStoppingParameters
            {
                WaitTime    = 0,
                MaxWaitTime = wait,
                MinPrice    = decimal.MaxValue,
            });

            var optimum = _searcher.Maximum(potentials, fromDate, toDate);

            _parameters = (OptimalStoppingParameters)optimum;
        }
 public IStrategy Create(IParameters parameters)
 {
     return(parameters switch
     {
         LinearRegressionParameters p => Create(p),
         RelativeStrengthParameters p => Create(p),
         DeltaParameters p => Create(p),
         VolumeParameters p => Create(p),
         GradientParameters p => Create(p),
         EntropyParameters p => Create(p),
         StaticDatesParameters p => Create(p),
         MovingAverageParameters p => Create(p),
         HolidayEffectParameters p => Create(p),
         WeightedParameters p => Create(p),
         OptimalStoppingParameters p => Create(p),
         ProbabilityParameters p => Create(p),
         SpreadParameters p => Create(p),
         ClusteringParameters p => Create(p),
         _ => throw new NotImplementedException(),
     });