private void ShowChartClick(object sender, RoutedEventArgs e) { var security = SelectedSecurity; _trader.RegisterTrades(security); var timeFrame = (TimeSpan)HistoryInterval.SelectedItem; var from = From.Value ?? DateTimeOffset.MinValue; var to = RealTime.IsChecked == true ? DateTimeOffset.MaxValue : To.Value ?? DateTimeOffset.MaxValue; if (from > to) { return; } var wnd = new ChartWindow { Title = "{0}, {1}, {2} - {3}".Put(security.Code, HistoryInterval.SelectedItem, from, to) }; wnd.Show(); var series = new CandleSeries { Security = security, Arg = timeFrame, CandleType = typeof(TimeFrameCandle) }; _trader.NewCandles += (candleSeries, candles) => { _trader.AddInfoLog("newcandles({0}):\n{1}", candles.Count(), candles.Select(c => c.ToString()).Join("\n")); if (candleSeries == series) { wnd.DrawCandles(candles); } }; _trader.SubscribeCandles(series, from, to); }
private void ShowChartClick(object sender, RoutedEventArgs e) { var security = SelectedSecurity; _trader.RegisterTrades(security); var timeFrame = (TimeSpan)HistoryInterval.SelectedItem; var from = (DateTimeOffset?)From.Value; var to = RealTime.IsChecked == true ? null : (DateTimeOffset?)To.Value; if (from > to) { return; } var wnd = new ChartWindow { Title = "{0}, {1}, {2} - {3}".Put(security.Code, HistoryInterval.SelectedItem, from, to) }; wnd.Show(); var series = new CandleSeries { Security = security, Arg = timeFrame, CandleType = typeof(TimeFrameCandle) }; _trader.CandleSeriesProcessing += (candleSeries, candle) => { _trader.AddInfoLog("New сandle({0})", candle); if (candleSeries == series) { wnd.DrawCandles(candle); } }; _trader.SubscribeCandles(series, from, to); }
private void ShowChartClick(object sender, RoutedEventArgs e) { var security = SelectedSecurity; _trader.RegisterTrades(security); var timeFrame = (TimeSpan)HistoryInterval.SelectedItem; var from = From.Value ?? DateTimeOffset.MinValue; var to = RealTime.IsChecked == true ? DateTimeOffset.MaxValue : To.Value ?? DateTimeOffset.MaxValue; if (from > to) { return; } var wnd = new ChartWindow { Title = "{0}, {1}, {2} - {3}".Put(security.Code, HistoryInterval.SelectedItem, from, to) }; wnd.Show(); var series = new CandleSeries { Security = security, Arg = timeFrame, CandleType = typeof(TimeFrameCandle) }; _trader.NewCandles += (candleSeries, candles) => { _trader.AddInfoLog("newcandles({0}):\n{1}", candles.Count(), candles.Select(c => c.ToString()).Join("\n")); if (candleSeries == series) wnd.DrawCandles(candles); }; _trader.SubscribeCandles(series, from, to); }