• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# OEC类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中OEC的典型用法代码示例。如果您正苦于以下问题:C# OEC类的具体用法?C# OEC怎么用?C# OEC使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: SessionOnOrderConfirmed

		private void SessionOnOrderConfirmed(OEC.API.Order order, int oldOrderId)
		{
			//if (oldOrderId > 0)
			//{
			//	SendOutMessage(new ExecutionMessage
			//	{
			//		ExecutionType = ExecutionTypes.Order,
			//		OrderId = oldOrderId,
			//		OrderState = OrderStates.Done,
			//	});	
			//}

			//SendOutMessage(new ExecutionMessage
			//{
			//	ExecutionType = ExecutionTypes.Order,
			//	OrderId = order.ID,
			//	OrderStatus = OrderStatus.ReceiveByServer,
			//});
		}
开发者ID:alexandrmalov,项目名称:StockSharp,代码行数:19,代码来源:OpenECryMessageAdapter_Transaction.cs


示例2: SessionOnContractChanged

		private void SessionOnContractChanged(OEC.API.Contract contract)
		{

		}
开发者ID:osya,项目名称:StockSharp,代码行数:4,代码来源:OpenECryMessageAdapter_MarketData.cs


示例3: SessionOnBarsReceived

		private void SessionOnBarsReceived(Subscription subscription, OEC.API.Bar[] bars)
		{
			ProcessBars(subscription, bars, false);
		}
开发者ID:osya,项目名称:StockSharp,代码行数:4,代码来源:OpenECryMessageAdapter_MarketData.cs


示例4: GetBoardCode

		private static string GetBoardCode(string exchange, OEC.API.Contract contract, string defaultBoardCode)
		{
			return exchange ?? contract.Exchange.Name ?? defaultBoardCode;
		}
开发者ID:osya,项目名称:StockSharp,代码行数:4,代码来源:OpenECryMessageAdapter_MarketData.cs


示例5: SessionOnContractsChanged

		private void SessionOnContractsChanged(OEC.API.BaseContract contract)
		{

		}
开发者ID:osya,项目名称:StockSharp,代码行数:4,代码来源:OpenECryMessageAdapter_MarketData.cs


示例6: SessionOnHistoryReceived

		private void SessionOnHistoryReceived(Subscription subscription, OEC.API.Bar[] bars)
		{
			ProcessBars(subscription, bars, true);
		}
开发者ID:osya,项目名称:StockSharp,代码行数:4,代码来源:OpenECryMessageAdapter_MarketData.cs


示例7: SessionOnDealQuoteUpdated

		private void SessionOnDealQuoteUpdated(OEC.API.DealQuote quote)
		{

		}
开发者ID:osya,项目名称:StockSharp,代码行数:4,代码来源:OpenECryMessageAdapter_MarketData.cs


示例8: SessionOnPriceTick

		private void SessionOnPriceTick(OEC.API.Contract contract, Price price)
		{
			ProcessContract(contract, 0);
		}
开发者ID:zjxbetter,项目名称:StockSharp,代码行数:4,代码来源:OpenECryMessageAdapter_MarketData.cs


示例9: SessionOnDomChanged

		private void SessionOnDomChanged(OEC.API.Contract contract)
		{
			ProcessContract(contract, 0);

			var dom = contract.DOM;

			var bids = new List<QuoteChange>();
			var asks = new List<QuoteChange>();

			var hasExchange = false;

			for (var i = 0; i < dom.BidExchanges.Length; i++)
			{
				var boardCode = GetBoardCode(dom.BidExchanges[i], contract, null);

				if (!hasExchange)
					hasExchange = !boardCode.IsEmpty() && boardCode != contract.Exchange.Name;

				bids.Add(new QuoteChange(Sides.Buy, contract.Cast(dom.BidLevels[i]) ?? 0, dom.BidSizes[i]) { BoardCode = boardCode });
			}

			for (var i = 0; i < dom.AskExchanges.Length; i++)
			{
				var boardCode = GetBoardCode(dom.AskExchanges[i], contract, null);

				if (!hasExchange)
					hasExchange = !boardCode.IsEmpty() && boardCode != contract.Exchange.Name;

				asks.Add(new QuoteChange(Sides.Sell, contract.Cast(dom.AskLevels[i]) ?? 0, dom.AskSizes[i]) { BoardCode = boardCode });
			}

			SendOutMessage(new QuoteChangeMessage
			{
				SecurityId = new SecurityId
				{
					SecurityCode = contract.Symbol,
					BoardCode = hasExchange ? AssociatedBoardCode : contract.Exchange.Name ?? AssociatedBoardCode
				},
				ServerTime = dom.LastUpdate.ApplyTimeZone(TimeHelper.Est),
				Bids = bids,
				Asks = asks,
			});
		}
开发者ID:zjxbetter,项目名称:StockSharp,代码行数:43,代码来源:OpenECryMessageAdapter_MarketData.cs


示例10: ProcessContract

		private void ProcessContract(OEC.API.Contract contract, long originalTransactionId)
		{
			SendOutMessage(new SecurityMessage
			{
				SecurityId = contract.ToSecurityId(),
				Name = contract.Name,
				UnderlyingSecurityCode = contract.BaseSymbol,
				Currency = contract.Currency.Name.ToCurrency(),
				Strike = contract.Strike.ToDecimal(),
				ExpiryDate = contract.HasExpiration ? contract.ExpirationDate.ApplyTimeZone(TimeHelper.Est) : (DateTimeOffset?)null,
				PriceStep = contract.TickSize.ToDecimal(),
				Decimals = contract.PriceFormat > 0 ? contract.PriceFormat : (int?)null,
				OptionType = contract.IsOption ? (contract.Put ? OptionTypes.Put : OptionTypes.Call) : (OptionTypes?)null,
				SecurityType = contract.GetSecurityType(),
				OriginalTransactionId = originalTransactionId,
			});
		}
开发者ID:zjxbetter,项目名称:StockSharp,代码行数:17,代码来源:OpenECryMessageAdapter_MarketData.cs


示例11: SessionOnSymbolLookupReceived

		private void SessionOnSymbolLookupReceived(OEC.API.SymbolLookupCriteria criteria, ContractList contracts)
		{
			var transId = _lookups.TryGetValue(criteria);

			foreach (var contract in contracts)
			{
				ProcessContract(contract, contract.CurrentPrice, transId);
			}

			SendOutMessage(new SecurityLookupResultMessage { OriginalTransactionId = transId });
		}
开发者ID:zjxbetter,项目名称:StockSharp,代码行数:11,代码来源:OpenECryMessageAdapter_MarketData.cs


示例12: SessionOnCommandUpdated

		private void SessionOnCommandUpdated(OEC.API.Order order, Command command)
		{
			//var msg = "Команда обновилась: #{0}, {1}-{2}, order #{3}".Put(command.ID, command.Type, command.State, oecOrder.OrderString());
			//this.AddInfoLog(msg);

			////ProcessEvents(() =>
			////{
			//var currentOrder = _orderMap.GetLocalOrder(oecOrder);

			//if (currentOrder == null)
			//	throw new OECException("CommandUpdated: Локальная заявка для OEC заявки '{0}' не найдена.".Put(oecOrder.OrderString()));

			//if (!(command.Type == CommandType.Modify || command.State == CommandState.Failed))
			//{
			//	// при необходимости будет обработано при получении OrderStateChanged
			//	currentOrder.Messages.Add(msg);
			//	return;
			//}

			//switch (command.State)
			//{
			//	case CommandState.Sent:
			//	{
			//		// Type == Modify
			//		var newOrder = _orderMap.GetLocalOrder(command.Version);
			//		if (newOrder == null)
			//			throw new OECException("CommandUpdated2: Локальная заявка для версии '{0}' не найдена.".Put(command.Version));

			//		if (command.ID > 0 && newOrder.Id <= 0)
			//		{
			//			var updatemsg = "OecCbOnCommandUpdated: Команда на модификацию (oldId={0}) принята сервером. newId={1}".Put(newOrder.Id, command.ID);
			//			this.AddInfoLog(updatemsg);

			//			GetOrder(newOrder.Security, newOrder.Type, command.ID, id => newOrder, order =>
			//			{
			//				_orderMap.BindOrderToOecOrderVersion(order, command.Version);
			//				order.Messages.Add(updatemsg);
			//				order.Status = OrderStatus.ReceiveByServer;

			//				return true;
			//			});
			//		}
			//		break;
			//	}
			//	case CommandState.Executed:
			//	{
			//		// Type == Modify
			//		var prevOecOrderVersion = oecOrder.Versions.Current.GetPreviousExecutedVersion();
			//		if (prevOecOrderVersion == null)
			//		{
			//			var errmsg = "Предыдущая версия заявки '{0}' не найдена.".Put(oecOrder.OrderString());
			//			this.AddErrorLog(errmsg);
			//			throw new OECException(errmsg);
			//		}

			//		var oldOrder = _orderMap.GetLocalOrder(prevOecOrderVersion);
			//		if (oldOrder == null)
			//			throw new OECException("CommandUpdated3: Локальная заявка для версии '{0}' не найдена.".Put(prevOecOrderVersion));

			//		OnModifyCommandExecuted(oldOrder, currentOrder, oecOrder);
			//		break;
			//	}
			//	case CommandState.Failed:
			//	{
			//		switch (command.Type)
			//		{
			//			case CommandType.Create:
			//				// will be handled in OnOrderChanged
			//				this.AddWarningLog("Команда Create вернула ошибку: {0}", command.ResultComments);
			//				break;
			//			case CommandType.Modify:
			//				var newOrder = _orderMap.GetLocalOrder(command.Version);
			//				if (newOrder == null)
			//					throw new OECException("CommandUpdated4: Локальная заявка для версии '{0}' не найдена.".Put(command.Version));

			//				newOrder.Id = 0;
			//				newOrder.State = OrderStates.Done;
			//				newOrder.Status = OrderStatus.NotValidated;
			//				newOrder.LastChangeTime = command.ResultTimestamp;

			//				RaiseOrderFailed(newOrder, new OECException("Команда Modify завершилась неудачно, комментарий='{0}'".Put(command.ResultComments)));
			//				break;
			//			case CommandType.Cancel:
			//				RaiseOrderFailed(currentOrder, new OECException("Команда Cancel завершилась неудачно, комментарий='{0}'".Put(command.ResultComments)));
			//				break;
			//		}
			//		break;
			//	}
			//}
			//});
		}
开发者ID:alexandrmalov,项目名称:StockSharp,代码行数:91,代码来源:OpenECryMessageAdapter_Transaction.cs


示例13: SessionOnCompoundPositionGroupChanged

		private void SessionOnCompoundPositionGroupChanged(OEC.API.CompoundPositionGroup group, OEC.API.CompoundLegPosition position)
		{

		}
开发者ID:alexandrmalov,项目名称:StockSharp,代码行数:4,代码来源:OpenECryMessageAdapter_Transaction.cs


示例14: SessionOnPriceChanged

		private void SessionOnPriceChanged(OEC.API.Contract contract, Price price)
		{
			ProcessContract(contract, price, 0);
		}
开发者ID:osya,项目名称:StockSharp,代码行数:4,代码来源:OpenECryMessageAdapter_MarketData.cs


示例15: SessionOnSymbolLookupReceived

		private void SessionOnSymbolLookupReceived(OEC.API.SymbolLookupCriteria criteria, ContractList contracts)
		{
			foreach (var contract in contracts)
			{
				ProcessContract(contract, contract.CurrentPrice, 0);
			}

			SendOutMessage(new SecurityLookupResultMessage());
		}
开发者ID:osya,项目名称:StockSharp,代码行数:9,代码来源:OpenECryMessageAdapter_MarketData.cs


示例16: SessionOnIndexComponentsReceived

		private void SessionOnIndexComponentsReceived(OEC.API.Contract contract)
		{
			ProcessContract(contract, contract.CurrentPrice, 0);
		}
开发者ID:osya,项目名称:StockSharp,代码行数:4,代码来源:OpenECryMessageAdapter_MarketData.cs


示例17: ProcessContract

		private void ProcessContract(OEC.API.Contract contract, Price currentPrice, long originalTransactionId)
		{
			var secId = contract.ToSecurityId();
			
			SendOutMessage(new SecurityMessage
			{
				SecurityId = secId,
				Name = contract.Name,
				UnderlyingSecurityCode = contract.BaseSymbol,
				Currency = contract.Currency.Name.ToCurrency(),
				Strike = contract.Strike.ToDecimal(),
				ExpiryDate = contract.HasExpiration ? contract.ExpirationDate.ApplyTimeZone(TimeHelper.Est) : (DateTimeOffset?)null,
				PriceStep = contract.TickSize.ToDecimal(),
				Decimals = contract.PriceFormat > 0 ? contract.PriceFormat : (int?)null,
				OptionType = contract.IsOption ? (contract.Put ? OptionTypes.Put : OptionTypes.Call) : (OptionTypes?)null,
				SecurityType = contract.GetSecurityType(),
				OriginalTransactionId = originalTransactionId,
			});

			if (currentPrice == null)
				return;

			SendOutMessage(new Level1ChangeMessage
			{
				SecurityId = secId,
				ServerTime = currentPrice.LastDateTime.ApplyTimeZone(TimeHelper.Est),
			}
			.TryAdd(Level1Fields.LastTradePrice, contract.Cast(currentPrice.LastPrice))
			.TryAdd(Level1Fields.BestAskPrice, contract.Cast(currentPrice.AskPrice))
			.TryAdd(Level1Fields.BestAskVolume, (decimal)currentPrice.AskVol)
			.TryAdd(Level1Fields.BestBidPrice, contract.Cast(currentPrice.BidPrice))
			.TryAdd(Level1Fields.BestBidVolume, (decimal)currentPrice.BidVol)
			.TryAdd(Level1Fields.Change, contract.Cast(currentPrice.Change))
			.TryAdd(Level1Fields.OpenInterest, (decimal)currentPrice.OpenInterest)
			.TryAdd(Level1Fields.OpenPrice, contract.Cast(currentPrice.OpenPrice))
			.TryAdd(Level1Fields.HighPrice, contract.Cast(currentPrice.HighPrice))
			.TryAdd(Level1Fields.LowPrice, contract.Cast(currentPrice.LowPrice))
			.TryAdd(Level1Fields.LastTradeVolume, (decimal)currentPrice.LastVol)
			.TryAdd(Level1Fields.SettlementPrice, contract.Cast(currentPrice.Settlement))
			.TryAdd(Level1Fields.Volume, (decimal)currentPrice.TotalVol)
			.TryAdd(Level1Fields.StepPrice, (decimal)contract.ContractSize)
			.Add(Level1Fields.State, contract.GetSecurityState()));
		}
开发者ID:osya,项目名称:StockSharp,代码行数:43,代码来源:OpenECryMessageAdapter_MarketData.cs


示例18: SessionOnHistogramReceived

		private void SessionOnHistogramReceived(Subscription subscription, OEC.API.Histogram hist)
		{

		}
开发者ID:osya,项目名称:StockSharp,代码行数:4,代码来源:OpenECryMessageAdapter_MarketData.cs


示例19: SessionOnTicksReceived

		private void SessionOnTicksReceived(Subscription subscription, OEC.API.Ticks ticks)
		{
			var contract = subscription.Contract;

			for (var i = 0; i < ticks.Exchanges.Length; i++)
			{
				SendOutMessage(new Level1ChangeMessage
				{
					SecurityId = new SecurityId
					{
						SecurityCode = contract.Symbol,
						BoardCode = GetBoardCode(ticks.Exchanges[i], contract, AssociatedBoardCode),
					},
					ServerTime = ticks.Timestamps[i].ApplyTimeZone(TimeHelper.Est)
				}
				.TryAdd(Level1Fields.LastTradePrice, contract.Cast(ticks.Prices[i]))
				.TryAdd(Level1Fields.LastTradeVolume, (decimal)ticks.Volumes32[i])
				.TryAdd(Level1Fields.BestBidPrice, contract.Cast(ticks.BidPrices[i]))
				.TryAdd(Level1Fields.BestAskPrice, contract.Cast(ticks.AskPrices[i])));	
			}
		}
开发者ID:osya,项目名称:StockSharp,代码行数:21,代码来源:OpenECryMessageAdapter_MarketData.cs


示例20: SessionOnDomChanged

		private void SessionOnDomChanged(OEC.API.Contract contract)
		{
			var dom = contract.DOM;

			var bids = new List<QuoteChange>();
			var asks = new List<QuoteChange>();

			for (var i = 0; i < dom.BidExchanges.Length; i++)
				bids.Add(new QuoteChange(Sides.Buy, contract.Cast(dom.BidLevels[i]) ?? 0, dom.BidSizes[i]) { BoardCode = GetBoardCode(dom.BidExchanges[i], contract, null) });

			for (var i = 0; i < dom.AskExchanges.Length; i++)
				asks.Add(new QuoteChange(Sides.Sell, contract.Cast(dom.AskLevels[i]) ?? 0, dom.AskSizes[i]) { BoardCode = GetBoardCode(dom.AskExchanges[i], contract, null) });

			SendOutMessage(new QuoteChangeMessage
			{
				SecurityId = new SecurityId
				{
					SecurityCode = contract.Symbol,
					BoardCode = AssociatedBoardCode
				},
				ServerTime = dom.LastUpdate.ApplyTimeZone(TimeHelper.Est),
				Bids = bids,
				Asks = asks,
			});
		}
开发者ID:osya,项目名称:StockSharp,代码行数:25,代码来源:OpenECryMessageAdapter_MarketData.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# OGen类代码示例发布时间:2022-05-24
下一篇:
C# ODocument类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap