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


C# OEC.ToString方法代码示例

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


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

示例1: oecClient_OnPriceChanged

		void oecClient_OnPriceChanged(OEC.API.Contract Contract, OEC.API.Price Price)
		{
			Symbol symbol = GetSymbolFromContract(Contract);

			if (symbol != null)
			{
				Trace.WriteLine(Contract.ToString() + " Price (" + symbol.ToString() + ")");

				SymbolPrice symbolPrice = null;
				if (!_symbolPrices.TryGetValue(symbol, out symbolPrice))
				{
					symbolPrice = new SymbolPrice();
					symbolPrice.symbol = symbol;
					symbolPrice.TotalVol = Price.TotalVol;
					_symbolPrices[symbol] = symbolPrice;
				}

				TickData data;

				if (symbolPrice.AskPrice != Price.AskPrice || symbolPrice.AskSize != Price.AskVol)
				{
					symbolPrice.AskPrice = Price.AskPrice;
					symbolPrice.AskSize = Price.AskVol;

					data = new TickData();
					data.time = Price.LastDateTime;
					data.tickType = TickType.Ask;
					data.price = Price.AskPrice;
					data.size = (UInt64)Price.AskVol;

					if (tickListener != null)
					{
						tickListener(symbol, data);
					}
				}

				if (symbolPrice.BidPrice != Price.BidPrice || symbolPrice.BidSize != Price.BidVol)
				{
					symbolPrice.BidPrice = Price.BidPrice;
					symbolPrice.BidSize = Price.BidVol;

					data = new TickData();
					data.time = Price.LastDateTime;
					data.tickType = TickType.Bid;
					data.price = Price.BidPrice;
					data.size = (UInt64)Price.BidVol;

					if (tickListener != null)
					{
						tickListener(symbol, data);
					}
				}

				if (symbolPrice.TotalVol != Price.TotalVol || symbolPrice.LastPrice != Price.LastPrice)
				{
					data = new TickData();
					data.time = Price.LastDateTime;
					data.tickType = TickType.Trade;
					data.price = Price.LastPrice;
					if (symbolPrice.TotalVol > Price.TotalVol)
					{
						data.size = 0;
					}
					else
					{
						data.size = (UInt64)(Price.TotalVol - symbolPrice.TotalVol);
					}

					symbolPrice.LastPrice = Price.LastPrice;
					symbolPrice.TotalVol = Price.TotalVol;

					if (tickListener != null)
					{
						tickListener(symbol, data);
					}
				}

				//data = new TickData();
				//data.time = DateTime.Now;
				//data.tickType = TickType.LastSize;
				//data.value = Price.LastVol;

				//if (tickListener != null)
				//{
				//    tickListener(symbol, data);
				//}

				if (symbolPrice.LowPrice != Price.LowPrice)
				{
					symbolPrice.LowPrice = Price.LowPrice;

					data = new TickData();
					data.time = Price.LastDateTime;
					data.tickType = TickType.LowPrice;
					data.price = Price.LowPrice;

					if (tickListener != null)
					{
						tickListener(symbol, data);
					}
//.........这里部分代码省略.........
开发者ID:sansong,项目名称:RightEdgePlugins,代码行数:101,代码来源:OECPlugin.cs

示例2: oecClient_OnLoginFailed

		void oecClient_OnLoginFailed(OEC.Data.FailReason Reason)
		{
			string error = "Login Failed: " + Reason.ToString();
			lastError = error;
			hadError = true;
			connectCompleted = true;
			connected = false;
			//DisplayError(Reason.ToString());
		}
开发者ID:sansong,项目名称:RightEdgePlugins,代码行数:9,代码来源:OECPlugin.cs

示例3: GetLocalOrder

			public BusinessEntities.Order GetLocalOrder(OEC.API.Version version, bool create = true)
			{
				if (_versionOrderSet.ContainsKey(version))
					return _versionOrderSet[version];

				_connector.AddWarningLog("GetLocalOrder({0}): заявка не найдена", version.ToString());

				if (!create || version.ID <= 0)
					return null;

				try
				{
					var portfolio = _connector.FindPortfolioByAccount(version.Order.Account, null);
					var security = _connector.FindSecurityByContract(version.Order.Contract);
					var vercopy = version;
					var orderType = version.Type.ToStockSharp();
					var order = _connector.GetOrder(security, orderType, version.ID, id =>
					{
						var ord = _connector.EntityFactory.CreateOrder(security, orderType, vercopy.ID);
						ord.Id = id;
						// TODO
						//_connector.InitNewOrder(ord);
						return ord;
					}, ord =>
					{
						ord.Portfolio = portfolio;
						ord.Security = security;
						ord.CopyFromOECOrderVersion(vercopy);

						return true;
					});

					BindOrderToOecOrderVersion(order, version);

					return order;
				}
				catch (Exception ex)
				{
					var msg = "Ошибка создания заявки S# по OEC версии '{0}': {1}".Put(version.ToString(), ex);
					_connector.AddWarningLog(msg);
					_connector.TransactionAdapter.SendOutMessage(new ErrorMessage { Error = ex });

					return null;
				}
			}
开发者ID:zjxbetter,项目名称:StockSharp,代码行数:45,代码来源:OECTrader_OrderMap.cs


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