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


C# OEC类代码示例

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


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


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