Esempio n. 1
0
        public void LinearRegressionStrategyTest()
        {
            var data       = CreateMarketData();
            var parameters = new LinearRegressionParameters();

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

            Approvals.Verify(actual);
        }
Esempio n. 2
0
 public LinearRegressionStrategy(
     IMarketDataCache marketDataCache,
     ISearcher searcher,
     IStakingService stakingService,
     LinearRegressionParameters parameters)
 {
     _searcher        = searcher;
     _marketDataCache = marketDataCache;
     _stakingService  = stakingService;
     _parameters      = parameters;
 }
Esempio n. 3
0
        public void Optimise(DateTime fromDate, DateTime endDate)
        {
            _stakingService.Evaluate(fromDate, endDate);

            var potentials = Enumerable.Range(30, 200).Select(x =>
                                                              new LinearRegressionParameters {
                Lookback = x
            });

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

            _parameters = (LinearRegressionParameters)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(),
     });