private async Task LoadStoredCandles(CandleMonitorData candleMonitorData, DateTime?from, CandleSource candleSource) { // Pre load anything we've already got and fire it off on the event var series = await candleMonitorData.DataSource.Load(from); // Fire the new candles event _logger.LogTrace("{settings} CandleMonitor.StartupAsync firing CandlesReceivedEvent for source {candleSource}", candleMonitorData.Settings, candleSource); try { _candleProducer.Send(new CandlesReceivedEventArgs(candleMonitorData.Settings, series, candleSource)); } catch (Exception e) { _logger.LogError(e, "{settings} CandleMonitor.StartupAsync.OnCandlesReceived threw an error", candleMonitorData.Settings); } }
public override async Task DoPeriodicWorkAsync() { _logger.LogDebug("Example Producer DummyService Doing Periodic Work"); // make something up to send _producer.Send(new CandlesReceivedEventArgs( new MarketFeedSettings(ProductType.BtcUsd, CandleGranularity.Hour1), new TimeSeries("dummy", new List <Tick> { new Tick(LocalDateTime.FromDateTime(DateTime.Now), 100, 110, 90, 112, 3) }), CandleSource.RestCall)); await Task.CompletedTask; }