当前位置: 首页>>代码示例>>C#>>正文


C# Security.ToSecurityId方法代码示例

本文整理汇总了C#中Security.ToSecurityId方法的典型用法代码示例。如果您正苦于以下问题:C# Security.ToSecurityId方法的具体用法?C# Security.ToSecurityId怎么用?C# Security.ToSecurityId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Security的用法示例。


在下文中一共展示了Security.ToSecurityId方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetHistoricalTicks

		/// <summary>
		/// To get historical ticks.
		/// </summary>
		/// <param name="security">The instrument for which you need to get all trades.</param>
		/// <param name="count">Maximum ticks count.</param>
		/// <param name="isSuccess">Whether all data were obtained successfully or the download process has been interrupted.</param>
		/// <returns>Historical ticks.</returns>
		public IEnumerable<ExecutionMessage> GetHistoricalTicks(Security security, long count, out bool isSuccess)
		{
			if (security == null)
				throw new ArgumentNullException(nameof(security));

			this.AddInfoLog(LocalizedStrings.Str2144Params, security, count);

			var transactionId = TransactionIdGenerator.GetNextId();

			var info = RefTuple.Create(new List<ExecutionMessage>(), new SyncObject(), false, security, false);
			_ticksInfo.Add(transactionId, info);

			SendInMessage(new MarketDataMessage
			{
				SecurityId = security.ToSecurityId(),
				DataType = MarketDataTypes.Trades,
				Count = count,
				IsSubscribe = true,
				TransactionId = transactionId,
			});

			lock (info.Second)
			{
				if (!info.Third)
					info.Second.Wait();
			}

			isSuccess = info.Fifth;

			return info.First;
		}
开发者ID:vikewoods,项目名称:StockSharp,代码行数:38,代码来源:BarChartTrader.cs

示例2: SendInHistorySourceMessage

		private void SendInHistorySourceMessage(Security security, MarketDataTypes dataType, object arg, Func<DateTimeOffset, IEnumerable<Message>> getMessages)
		{
			var isSubscribe = getMessages != null;

			if (isSubscribe)
			{
				if (_historySourceSubscriptions.ChangeSubscribers(Tuple.Create(security.ToSecurityId(), dataType, arg), true) != 1)
					return;
			}
			else
			{
				if (_historySourceSubscriptions.ChangeSubscribers(Tuple.Create(security.ToSecurityId(), dataType, arg), false) != 0)
					return;
			}

			SendInMessage(new HistorySourceMessage
			{
				IsSubscribe = isSubscribe,
				SecurityId = security.ToSecurityId(),
				DataType = dataType,
				Arg = arg,
				GetMessages = getMessages
			});
		}
开发者ID:qiujoe,项目名称:StockSharp,代码行数:24,代码来源:HistoryEmulationConnector.cs

示例3: GetHistoricalTicks

		/// <summary>
		/// Получить исторических тиков.
		/// </summary>
		/// <param name="security">Инструмент, для которого необходимо получить все сделки.</param>
		/// <param name="from">Дата начала периода.</param>
		/// <param name="to">Дата окончания периода.</param>
		/// <param name="isSuccess">Успешно ли получены все данные или процесс загрузки был прерван.</param>
		/// <returns>Исторические сделки.</returns>
		public IEnumerable<Trade> GetHistoricalTicks(Security security, DateTime from, DateTime to, out bool isSuccess)
		{
			if (security == null)
				throw new ArgumentNullException("security");

			this.AddInfoLog(LocalizedStrings.Str2145Params, security, from, to);

			var transactionId = TransactionIdGenerator.GetNextId();

			var info = new RefFive<List<Trade>, SyncObject, bool, Security, bool>(new List<Trade>(), new SyncObject(), false, security, false);
			_ticksInfo.Add(transactionId, info);

			SendInMessage(new MarketDataMessage
			{
				SecurityId = security.ToSecurityId(),
				DataType = MarketDataTypes.Trades,
				From = from,
				To = to,
				IsSubscribe = true,
				TransactionId = transactionId,
			});

			lock (info.Second)
			{
				if (!info.Third)
					info.Second.Wait();
			}

			isSuccess = info.Fifth;

			return info.First;
		}
开发者ID:KaerMorhen,项目名称:StockSharp,代码行数:40,代码来源:BarChartTrader.cs

示例4: Process

		private void Process(IStorageRegistry storageRegistry, Security security, StorageFormats format, IMarketDataDrive drive)
		{
			this.GuiSync(() =>
			{
				_visibleEntries.Clear();
			
				Columns.RemoveRange(_candleColumns.Values);
				_candleColumns.Values.ForEach(c => FormatRules.Remove(c));
				_candleColumns.Clear();
			});

			if (security == null)
				return;

			var dict = new Dictionary<DateTime, MarketDataEntry>();

			drive = drive ?? storageRegistry.DefaultDrive;

			var candles = new Dictionary<string, DataType>();

			lock (_syncObject)
			{
				if (_isChanged)
					return;
			}

			foreach (var tuple in drive.GetAvailableDataTypes(security.ToSecurityId(), format))
			{
				if (tuple.MessageType.IsCandleMessage())
					continue;

				var key = tuple.MessageType.Name.Replace("CandleMessage", string.Empty) + " " + tuple.Arg;
				candles.Add(key, tuple.Clone());
			}

			var candleNames = candles.Keys.ToArray();

			if (candleNames.Length > 0)
			{
				this.GuiSync(() =>
				{
					foreach (var candleName in candleNames)
					{
						var column = new DataGridTextColumn
						{
							Header = candleName,
							Binding = new Binding
							{
								Path = new PropertyPath("Candles[{0}]".Put(candleName)),
								Converter = new BoolToCheckMarkConverter()
							}
						};
						//var cbElement = new FrameworkElementFactory(typeof(CheckBox));

						//var column = new DataGridTemplateColumn
						//{
						//	Header = candle,
						//	CellStyle = new Style(),
						//	//SortMemberPath = "Candles[{0}]".Put(key)
						//	CellTemplate = new DataTemplate(typeof(CheckBox))
						//	{
						//		VisualTree = cbElement,
						//	}
						//};

						//var bind = new Binding { Path = new PropertyPath("Candles[{0}]".Put(candle)) };
						
						//cbElement.SetBinding(ToggleButton.IsCheckedProperty, bind);
						//cbElement.SetValue(IsHitTestVisibleProperty, false);
						//cbElement.SetValue(HorizontalAlignmentProperty, HorizontalAlignment.Center);

						Columns.Add(column);
						_candleColumns.Add(candleName, column);

						//ApplyFormatRules(column);
					}

					//ApplyFormatRules();
				});
			}

			Add(dict, storageRegistry.GetTickMessageStorage(security, drive, format).Dates, candleNames, e => e.IsTick = true);
			Add(dict, storageRegistry.GetQuoteMessageStorage(security, drive, format).Dates, candleNames, e => e.IsDepth = true);
			Add(dict, storageRegistry.GetLevel1MessageStorage(security, drive, format).Dates, candleNames, e => e.IsLevel1 = true);
			Add(dict, storageRegistry.GetOrderLogMessageStorage(security, drive, format).Dates, candleNames, e => e.IsOrderLog = true);

			foreach (var c in candleNames)
			{
				var candleName = c;

				lock (_syncObject)
				{
					if (_isChanged)
						return;
				}

				var tuple = candles[candleName];
				Add(dict, storageRegistry.GetCandleMessageStorage(tuple.MessageType, security, tuple.Arg, drive, format).Dates, candleNames, e => e.Candles[candleName] = true);
			}

//.........这里部分代码省略.........
开发者ID:sunwayru,项目名称:StockSharp,代码行数:101,代码来源:MarketDataGrid.xaml.cs

示例5: StartBtnClick


//.........这里部分代码省略.........
			});
			
			var logManager = new LogManager();
			var fileLogListener = new FileLogListener("sample.log");
			logManager.Listeners.Add(fileLogListener);
			//logManager.Listeners.Add(new DebugLogListener());	// for track logs in output window in Vusial Studio (poor performance).

			var generateDepths = GenDepthsCheckBox.IsChecked == true;
			var maxDepth = MaxDepth.Text.To<int>();
			var maxVolume = MaxVolume.Text.To<int>();

			var secCode = secIdParts[0];
			var board = ExchangeBoard.GetOrCreateBoard(secIdParts[1]);

			foreach (var set in settings)
			{
				if (set.Item1.IsChecked == false)
					continue;

				var progressBar = set.Item2;
				var statistic = set.Item3;
				var emulationInfo = set.Item4;

				// create test security
				var security = new Security
				{
					Id = SecId.Text, // sec id has the same name as folder with historical data
					Code = secCode,
					Board = board,
				};

				var level1Info = new Level1ChangeMessage
				{
					SecurityId = security.ToSecurityId(),
					ServerTime = startTime,
				}
				.TryAdd(Level1Fields.PriceStep, 10m)
				.TryAdd(Level1Fields.StepPrice, 6m)
				.TryAdd(Level1Fields.MinPrice, 10m)
				.TryAdd(Level1Fields.MaxPrice, 1000000m)
				.TryAdd(Level1Fields.MarginBuy, 10000m)
				.TryAdd(Level1Fields.MarginSell, 10000m);

				// test portfolio
				var portfolio = new Portfolio
				{
					Name = "test account",
					BeginValue = 1000000,
				};

				// create backtesting connector
				var connector = new HistoryEmulationConnector(
					new[] { security },
					new[] { portfolio })
				{
					MarketEmulator =
					{
						Settings =
						{
							// match order if historical price touched our limit order price. 
							// It is terned off, and price should go through limit order price level
							// (more "severe" test mode)
							MatchOnTouch = false,
						}
					},
开发者ID:yoykiee,项目名称:StockSharp,代码行数:66,代码来源:MainWindow.xaml.cs

示例6: StartBtnClick

		private void StartBtnClick(object sender, RoutedEventArgs e)
		{
			// if process was already started, will stop it now
			if (_connector != null && _connector.State != EmulationStates.Stopped)
			{
				_strategy.Stop();
				_connector.Disconnect();
				_logManager.Sources.Clear();

				_connector = null;
				return;
			}

			// create test security
			var security = new Security
			{
				Id = "[email protected]",
				Code = "AAPL",
				Name = "AAPL Inc",
				Board = ExchangeBoard.Nasdaq,
			};

			var startTime = new DateTime(2009, 6, 1);
			var stopTime = new DateTime(2009, 9, 1);

			var level1Info = new Level1ChangeMessage
			{
				SecurityId = security.ToSecurityId(),
				ServerTime = startTime,
			}
			.TryAdd(Level1Fields.PriceStep, 10m)
			.TryAdd(Level1Fields.StepPrice, 6m)
			.TryAdd(Level1Fields.MinPrice, 10m)
			.TryAdd(Level1Fields.MaxPrice, 1000000m)
			.TryAdd(Level1Fields.MarginBuy, 10000m)
			.TryAdd(Level1Fields.MarginSell, 10000m);

			// test portfolio
			var portfolio = new Portfolio
			{
				Name = "test account",
				BeginValue = 1000000,
			};

			var timeFrame = TimeSpan.FromMinutes(5);

			// create backtesting connector
			_connector = new HistoryEmulationConnector(
				new[] { security },
				new[] { portfolio })
			{
				HistoryMessageAdapter =
				{
					// set history range
					StartDate = startTime,
					StopDate = stopTime,
				},

				// set market time freq as time frame
				MarketTimeChangedInterval = timeFrame,
			};

			_logManager.Sources.Add(_connector);

			var candleManager = new CandleManager(_connector);

			var series = new CandleSeries(typeof(TimeFrameCandle), security, timeFrame);

			// create strategy based on 80 5-min и 10 5-min
			_strategy = new SmaStrategy(series, new SimpleMovingAverage { Length = 80 }, new SimpleMovingAverage { Length = 10 })
			{
				Volume = 1,
				Security = security,
				Portfolio = portfolio,
				Connector = _connector,
			};

			_connector.NewSecurities += securities =>
			{
				if (securities.All(s => s != security))
					return;

				// fill level1 values
				_connector.SendInMessage(level1Info);

				_connector.RegisterTrades(new RandomWalkTradeGenerator(_connector.GetSecurityId(security)));
				_connector.RegisterMarketDepth(new TrendMarketDepthGenerator(_connector.GetSecurityId(security)) { GenerateDepthOnEachTrade = false });

				// start strategy before emulation started
				_strategy.Start();
				candleManager.Start(series);

				// start historical data loading when connection established successfully and all data subscribed
				_connector.Start();
			};

			// fill parameters panel
			ParameterGrid.Parameters.Clear();
			ParameterGrid.Parameters.AddRange(_strategy.StatisticManager.Parameters);

//.........这里部分代码省略.........
开发者ID:hbwjz,项目名称:StockSharp,代码行数:101,代码来源:MainWindow.xaml.cs

示例7: StartEmulation

		private void StartEmulation()
		{
			if (_connector != null && _connector.State != EmulationStates.Stopped)
				throw new InvalidOperationException(LocalizedStrings.Str3015);

			if (Strategy == null)
				throw new InvalidOperationException("Strategy not selected.");

			var strategy = (EmulationDiagramStrategy)Strategy;

			if (strategy.DataPath.IsEmpty() || !Directory.Exists(strategy.DataPath))
				throw new InvalidOperationException(LocalizedStrings.Str3014);

			strategy
				.Composition
				.Parameters
				.ForEach(p =>
				{
					if (p.Type == typeof(Security) && p.Value == null)
						throw new InvalidOperationException(LocalizedStrings.Str1380);
				});

			strategy.Reset();
			Reset();

			var securityId = "[email protected]";
			var secGen = new SecurityIdGenerator();
			var secIdParts = secGen.Split(securityId);
			var secCode = secIdParts.SecurityCode;
			var board = ExchangeBoard.GetOrCreateBoard(secIdParts.BoardCode);
			var timeFrame = strategy.CandlesTimeFrame;
			var useCandles = strategy.MarketDataSource == MarketDataSource.Candles;

			// create test security
			var security = new Security
			{
				Id = securityId, // sec id has the same name as folder with historical data
				Code = secCode,
				Board = board,
			};

			// storage to historical data
			var storageRegistry = new StorageRegistry
			{
				// set historical path
				DefaultDrive = new LocalMarketDataDrive(strategy.DataPath)
			};

			var startTime = strategy.StartDate.ChangeKind(DateTimeKind.Utc);
			var stopTime = strategy.StopDate.ChangeKind(DateTimeKind.Utc);

			// ProgressBar refresh step
			var progressStep = ((stopTime - startTime).Ticks / 100).To<TimeSpan>();

			// set ProgressBar bounds
			TicksAndDepthsProgress.Value = 0;
			TicksAndDepthsProgress.Maximum = 100;

			var level1Info = new Level1ChangeMessage
			{
				SecurityId = security.ToSecurityId(),
				ServerTime = startTime,
			}
				.TryAdd(Level1Fields.PriceStep, secIdParts.SecurityCode == "RIZ2" ? 10m : 1)
				.TryAdd(Level1Fields.StepPrice, 6m)
				.TryAdd(Level1Fields.MinPrice, 10m)
				.TryAdd(Level1Fields.MaxPrice, 1000000m)
				.TryAdd(Level1Fields.MarginBuy, 10000m)
				.TryAdd(Level1Fields.MarginSell, 10000m);

			// test portfolio
			var portfolio = new Portfolio
			{
				Name = "test account",
				BeginValue = 1000000,
			};

			var securityProvider = ConfigManager.GetService<ISecurityProvider>();

			// create backtesting connector
			_connector = new HistoryEmulationConnector(securityProvider, new[] { portfolio }, new StorageRegistry())
			{
				EmulationAdapter =
				{
					Emulator =
					{
						Settings =
						{
							// match order if historical price touched our limit order price. 
							// It is terned off, and price should go through limit order price level
							// (more "severe" test mode)
							MatchOnTouch = false,
						}
					}
				},

				UseExternalCandleSource = useCandles,

				HistoryMessageAdapter =
				{
//.........这里部分代码省略.........
开发者ID:zjxbetter,项目名称:StockSharp,代码行数:101,代码来源:StrategyControl.xaml.cs

示例8: StartBtnClick

		private void StartBtnClick(object sender, RoutedEventArgs e)
		{
			if (HistoryPath.Text.IsEmpty() || !Directory.Exists(HistoryPath.Text))
			{
				MessageBox.Show(this, LocalizedStrings.Str3014);
				return;
			}

			if (Math.Abs(TestingProcess.Value - 0) > double.Epsilon)
			{
				MessageBox.Show(this, LocalizedStrings.Str3015);
				return;
			}

			var logManager = new LogManager();
			var fileLogListener = new FileLogListener("sample.log");
			logManager.Listeners.Add(fileLogListener);

			// SMA periods
			var periods = new[]
			{
				new Tuple<int, int, Color>(80, 10, Colors.DarkGreen),
				new Tuple<int, int, Color>(70, 8, Colors.Red),
				new Tuple<int, int, Color>(60, 6, Colors.DarkBlue)
			};

			// storage to historical data
			var storageRegistry = new StorageRegistry
			{
				// set historical path
				DefaultDrive = new LocalMarketDataDrive(HistoryPath.Text)
			};

			var timeFrame = TimeSpan.FromMinutes(5);

			// create test security
			var security = new Security
			{
				Id = "[email protected]", // sec id has the same name as folder with historical data
				Code = "RIZ2",
				Name = "RTS-12.12",
				Board = ExchangeBoard.Forts,
			};

			var startTime = new DateTime(2012, 10, 1);
			var stopTime = new DateTime(2012, 10, 31);

			var level1Info = new Level1ChangeMessage
			{
				SecurityId = security.ToSecurityId(),
				ServerTime = startTime,
			}
			.TryAdd(Level1Fields.PriceStep, 10m)
			.TryAdd(Level1Fields.StepPrice, 6m)
			.TryAdd(Level1Fields.MinPrice, 10m)
			.TryAdd(Level1Fields.MaxPrice, 1000000m)
			.TryAdd(Level1Fields.MarginBuy, 10000m)
			.TryAdd(Level1Fields.MarginSell, 10000m);

			// test portfolio
			var portfolio = new Portfolio
			{
				Name = "test account",
				BeginValue = 1000000,
			};

			// create backtesting connector
			var batchEmulation = new BatchEmulation(new[] { security }, new[] { portfolio }, storageRegistry)
			{
				EmulationSettings =
				{
					MarketTimeChangedInterval = timeFrame,
					StartTime = startTime,
					StopTime = stopTime,

					// count of parallel testing strategies
					BatchSize = periods.Length,
				}
			};

			// handle historical time for update ProgressBar
			batchEmulation.ProgressChanged += (curr, total) => this.GuiAsync(() => TestingProcess.Value = total);

			batchEmulation.StateChanged += (oldState, newState) =>
			{
				if (batchEmulation.State != EmulationStates.Stopped)
					return;

				this.GuiAsync(() =>
				{
					if (batchEmulation.IsFinished)
					{
						TestingProcess.Value = TestingProcess.Maximum;
						MessageBox.Show(this, LocalizedStrings.Str3024.Put(DateTime.Now - _startEmulationTime));
					}
					else
						MessageBox.Show(this, LocalizedStrings.cancelled);
				});
			};

//.........这里部分代码省略.........
开发者ID:reddream,项目名称:StockSharp,代码行数:101,代码来源:MainWindow.xaml.cs

示例9: TraderOnValuesChanged

		private void TraderOnValuesChanged(Security security, IEnumerable<KeyValuePair<Level1Fields, object>> changes, DateTimeOffset serverTime, DateTime localTime)
		{
			var wnd = _level1Windows.TryGetValue(security);

			if (wnd == null)
				return;

			var msg = new Level1ChangeMessage
			{
				SecurityId = security.ToSecurityId(),
				ServerTime = serverTime,
				LocalTime = localTime
			};
			msg.Changes.AddRange(changes);
			wnd.Level1Grid.Messages.Add(msg);
		}
开发者ID:reddream,项目名称:StockSharp,代码行数:16,代码来源:SecuritiesWindow.xaml.cs

示例10: StartButtonOnClick

		private void StartButtonOnClick(object sender, RoutedEventArgs e)
		{
			_logManager.Sources.Clear();
			_bufferedChart.ClearAreas();

			Curve.Clear();
			PositionCurve.Clear();

			if (HistoryPathTextBox.Text.IsEmpty() || !Directory.Exists(HistoryPathTextBox.Text))
			{
				MessageBox.Show("Wrong path.");
				return;
			}

			if (_connector != null && _connector.State != EmulationStates.Stopped)
			{
				MessageBox.Show("Already launched.");
				return;
			}

			if (Composition == null)
			{
				MessageBox.Show("No strategy selected.");
				return;
			}

			var secGen = new SecurityIdGenerator();
			var secIdParts = secGen.Split(SecusityTextBox.Text);
			var secCode = secIdParts.SecurityCode;
			var board = ExchangeBoard.GetOrCreateBoard(secIdParts.BoardCode);
			var timeFrame = (TimeSpan)TimeFrameComboBox.SelectedItem;
			var useCandles = (string)MarketDataTypeComboBox.SelectedItem != "Ticks";

			// create test security
			var security = new Security
			{
				Id = SecusityTextBox.Text, // sec id has the same name as folder with historical data
				Code = secCode,
				Board = board,
			};

			// storage to historical data
			var storageRegistry = new StorageRegistry
			{
				// set historical path
				DefaultDrive = new LocalMarketDataDrive(HistoryPathTextBox.Text)
			};

			var startTime = ((DateTime)FromDatePicker.Value).ChangeKind(DateTimeKind.Utc);
			var stopTime = ((DateTime)ToDatePicke.Value).ChangeKind(DateTimeKind.Utc);

			// ProgressBar refresh step
			var progressStep = ((stopTime - startTime).Ticks / 100).To<TimeSpan>();

			// set ProgressBar bounds
			TicksAndDepthsProgress.Value = 0;
			TicksAndDepthsProgress.Maximum = 100;

			var level1Info = new Level1ChangeMessage
			{
				SecurityId = security.ToSecurityId(),
				ServerTime = startTime,
			}
			.TryAdd(Level1Fields.PriceStep, secIdParts.SecurityCode == "RIZ2" ? 10m : 1)
			.TryAdd(Level1Fields.StepPrice, 6m)
			.TryAdd(Level1Fields.MinPrice, 10m)
			.TryAdd(Level1Fields.MaxPrice, 1000000m)
			.TryAdd(Level1Fields.MarginBuy, 10000m)
			.TryAdd(Level1Fields.MarginSell, 10000m);

			// test portfolio
			var portfolio = new Portfolio
			{
				Name = "test account",
				BeginValue = 1000000,
			};

			// create backtesting connector
			_connector = new HistoryEmulationConnector(
				new[] { security },
				new[] { portfolio })
			{
				EmulationAdapter =
				{
					Emulator =
					{
						Settings =
						{
							// match order if historical price touched our limit order price. 
							// It is terned off, and price should go through limit order price level
							// (more "severe" test mode)
							MatchOnTouch = false,
						}
					}
				},

				UseExternalCandleSource = useCandles,

				HistoryMessageAdapter =
				{
//.........这里部分代码省略.........
开发者ID:kknet,项目名称:StockSharp,代码行数:101,代码来源:EmulationControl.xaml.cs

示例11: Process

		private void Process(IStorageRegistry storageRegistry, Security security, StorageFormats format, IMarketDataDrive drive)
		{
			this.GuiSync(() =>
			{
				_visibleEntries.Clear();
			
				Columns.RemoveRange(_candleColumns.Values);
				_candleColumns.Values.ForEach(c => FormatRules.Remove(c));
				_candleColumns.Clear();
			});

			if (security == null)
				return;

			var dict = new Dictionary<DateTime, MarketDataEntry>();

			drive = drive ?? storageRegistry.DefaultDrive;

			var candles = new Dictionary<string, Tuple<Type, object>>();

			lock (_syncObject)
			{
				if (_isChanged)
					return;
			}

			foreach (var tuple in drive.GetCandleTypes(security.ToSecurityId(), format))
			{
				foreach (var arg in tuple.Item2)
				{
					var key = tuple.Item1.Name.Replace("CandleMessage", string.Empty) + " " + arg;
					candles.Add(key, Tuple.Create(tuple.Item1, arg));
				}
			}

			var candleNames = candles.Keys.ToArray();

			if (candleNames.Length > 0)
			{
				this.GuiSync(() =>
				{
					foreach (var candleName in candleNames)
					{
						var column = new DataGridTextColumn
						{
							Header = candleName,
							Binding = new Binding
							{
								Path = new PropertyPath("Candles[{0}]".Put(candleName)),
								Converter = new BoolToCheckMarkConverter()
							}
						};
						//var cbElement = new FrameworkElementFactory(typeof(CheckBox));

						//var column = new DataGridTemplateColumn
						//{
						//	Header = candle,
						//	CellStyle = new Style(),
						//	//SortMemberPath = "Candles[{0}]".Put(key)
						//	CellTemplate = new DataTemplate(typeof(CheckBox))
						//	{
						//		VisualTree = cbElement,
						//	}
						//};

						//var bind = new Binding { Path = new PropertyPath("Candles[{0}]".Put(candle)) };
						
						//cbElement.SetBinding(ToggleButton.IsCheckedProperty, bind);
						//cbElement.SetValue(IsHitTestVisibleProperty, false);
						//cbElement.SetValue(HorizontalAlignmentProperty, HorizontalAlignment.Center);

						Columns.Add(column);
						_candleColumns.Add(candleName, column);

						//ApplyFormatRules(column);
					}

					//ApplyFormatRules();
				});
			}

			Add(dict, storageRegistry.GetTickMessageStorage(security, drive, format), candleNames, e => e.IsTick = true);
			Add(dict, storageRegistry.GetQuoteMessageStorage(security, drive, format), candleNames, e => e.IsDepth = true);
			Add(dict, storageRegistry.GetLevel1MessageStorage(security, drive, format), candleNames, e => e.IsLevel1 = true);
			Add(dict, storageRegistry.GetOrderLogMessageStorage(security, drive, format), candleNames, e => e.IsOrderLog = true);

			foreach (var c in candleNames)
			{
				var candleName = c;

				lock (_syncObject)
				{
					if (_isChanged)
						return;
				}

				var tuple = candles[candleName];
				Add(dict, storageRegistry.GetCandleMessageStorage(tuple.Item1, security, tuple.Item2, drive, format), candleNames, e => e.Candles[candleName] = true);
			}

//.........这里部分代码省略.........
开发者ID:reddream,项目名称:StockSharp,代码行数:101,代码来源:MarketDataGrid.xaml.cs


注:本文中的Security.ToSecurityId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。