コード例 #1
0
ファイル: FireScheduler.cs プロジェクト: riyanhax/TradingApp
 public FireScheduler(ILoggerFactory logger, ISettings settings, ITelegram telegram, IForecaster forecaster)
 {
     _logger     = logger.CreateLogger("BotTools");
     _settings   = settings;
     _telegram   = telegram;
     _forecaster = forecaster;
 }
        public override void Start()
        {
            CheckIfInputsAreProvided();
            DataObjects.BSDataObject[] inputs = new DataObjects.BSDataObject[Inputs.Count];
            Inputs.TryPopRange(inputs);
            //TODO: improve to allow multiple DataObjects to be used as inputs
            if (inputs.Length != 2)
                throw new NoInputProvidenException();

            if (!inputs.Any(x => x is IForecastingModel))
                throw new IncorrectInputs();
            IForecastingModel model;
            DataObjects.BSDataObject inputData;

            //This part is very, very bad!
            int i = 0;
            model = inputs[i] as IForecastingModel;
            if (null == model)
            {
                i = 1;
                model = inputs[i] as IForecastingModel;
            }
            inputData = inputs[Math.Abs(i - 1)];
            //End of very, very bad part.
            double[][] modelInput, modelOutput;
            model.InputProvider.GenerateInputAndOutput(inputData.DataArray, out modelInput, out modelOutput);
            forecaster = new BasicForecaster(model);
            modelOutput = forecaster.CalculateOutput(modelInput);
            //Also not very good - 1) think about new object name - it can be specified by user or something.
            //2) Check that modelOutput is exactly 1 row.
            double[] output = new double[modelOutput.LongLength];
            for (long j = 0; j < output.LongLength; ++j)
                output[j] = modelOutput[j][0];
            Output = new DataObjects.BSDataObject(output, inputData.Offset + model.InputSize, inputData.ObjName);
        }
コード例 #3
0
 public DataController(IHelpers helpers, IForecaster forecaster, ISettings settings, ITelegram telegram, ILoggerFactory logger)
 {
     _helpers    = helpers;
     _forecaster = forecaster;
     _settings   = settings;
     _telegram   = telegram;
     _logger     = logger.CreateLogger("Controller.DataController");
 }
        public Reforecast(
            dBEnergyCatapultPresumedOpenDataChallangeContext dbClient,
            IEnumerable <IForecaster <ForecastRequest, ForecastResult> > forcasters,
            IMapper mapper,
            IConfiguration config)
        {
            // TODO: Don't inject DB into here, better to inject an abstration (but this is quick and dirty)
            this.dbClient = dbClient ?? throw new ArgumentNullException(nameof(dbClient));
            this.mapper   = mapper ?? throw new ArgumentNullException(nameof(mapper));
            this.config   = config ?? throw new ArgumentNullException(nameof(config));

            this.pvForecaster     = forcasters.Single(f => f.Name == "PV Forecaster");
            this.demandForecaster = forcasters.Single(f => f.Name == "Demand Forecaster");

            this.dbClient.ChangeTracker.AutoDetectChangesEnabled = false;
        }
コード例 #5
0
 public MainWindow()
 {
     InitializeComponent();
     Forecaster     = new Forecaster();
     CurrentWeather = new CurrentWeather();
     DayWeather     = new DayWeather();
     WeekWeather    = new WeekWeather();
     this.CurrentPage.DataContext      = CurrentWeather;
     this.WeekForecastPage.DataContext = DayWeather;
     CreateDayForecast();
     this.WeekForecastPage.DataContext = WeekWeather;
     CreateWeekForecast();
     FillWeatherPages("London");
     PlaceBox.Items.Add(new TextBlock()
     {
         Text = "London"
     });
 }
コード例 #6
0
 public void DetachData(IForecaster o)
 {
     _forecasters.Remove(o);
 }
コード例 #7
0
 public void AttachData(IForecaster o)
 {
     _forecasters.Add(o);
 }
コード例 #8
0
 public HomeController(IForecaster forecaster, ILoggerFactory logger)
 {
     _forecaster = forecaster;
     _logger     = logger.CreateLogger("Controller.HomeController");
 }
コード例 #9
0
 public StatsViewComponent(IForecaster forecaster)
 {
     _forecaster = forecaster;
 }