本文整理汇总了C#中StockSharp.InteractiveBrokers.Native.IBSocket.ReadDateTime方法的典型用法代码示例。如果您正苦于以下问题:C# IBSocket.ReadDateTime方法的具体用法?C# IBSocket.ReadDateTime怎么用?C# IBSocket.ReadDateTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StockSharp.InteractiveBrokers.Native.IBSocket
的用法示例。
在下文中一共展示了IBSocket.ReadDateTime方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadMyTrade
private void ReadMyTrade(IBSocket socket, ServerVersions version)
{
/* requestId */
if (version >= ServerVersions.V7)
socket.ReadInt();
// http://www.interactivebrokers.com/en/software/api/apiguide/java/execution.htm
var transactionId = socket.ReadInt();
//Handle the 2^31-1 == 0 bug
if (transactionId == int.MaxValue)
transactionId = 0;
//Read Contract Fields
var contractId = version >= ServerVersions.V5 ? socket.ReadInt() : -1;
var secName = socket.ReadStr();
var type = socket.ReadSecurityType();
var expiryDate = socket.ReadExpiry();
var strike = socket.ReadDecimal();
var optionType = socket.ReadOptionType();
var multiplier = version >= ServerVersions.V9 ? socket.ReadMultiplier() : null;
var boardCode = socket.ReadBoardCode();
var currency = socket.ReadCurrency();
var secCode = socket.ReadLocalCode(secName);
var secClass = (version >= ServerVersions.V10) ? socket.ReadStr() : null;
var tradeId = socket.ReadStr();
var time = socket.ReadDateTime("yyyyMMdd HH:mm:ss");
var portfolio = socket.ReadStr();
/* exchange */
socket.ReadStr();
var side = socket.ReadTradeSide();
var volume = socket.ReadDecimal();
var price = socket.ReadDecimal();
var permId = version >= ServerVersions.V2 ? socket.ReadInt() : (int?)null;
var clientId = version >= ServerVersions.V3 ? socket.ReadInt() : (int?)null;
var liquidation = version >= ServerVersions.V4 ? socket.ReadInt() : (int?)null;
var cumulativeQuantity = version >= ServerVersions.V6 ? socket.ReadInt() : (int?)null;
var averagePrice = version >= ServerVersions.V6 ? socket.ReadDecimal() : (decimal?)null;
var orderRef = version >= ServerVersions.V8 ? socket.ReadStr() : null;
var evRule = version >= ServerVersions.V9 ? socket.ReadStr() : null;
var evMultiplier = version >= ServerVersions.V9 ? socket.ReadDecimal() : (decimal?)null;
var secId = new SecurityId
{
SecurityCode = secCode,
BoardCode = GetBoardCode(boardCode),
InteractiveBrokers = contractId,
};
SendOutMessage(new SecurityMessage
{
SecurityId = secId,
Name = secName,
SecurityType = type,
ExpiryDate = expiryDate,
Strike = strike,
OptionType = optionType,
Currency = currency,
Multiplier = multiplier ?? 0,
Class = secClass
});
// заявка была создана руками
if (transactionId == 0)
return;
_secIdByTradeIds[tradeId] = secId;
var execMsg = new ExecutionMessage
{
ExecutionType = ExecutionTypes.Transaction,
OriginalTransactionId = transactionId,
TradeStringId = tradeId,
OriginSide = side,
TradePrice = price,
TradeVolume = volume,
PortfolioName = portfolio,
ServerTime = time,
SecurityId = secId,
HasTradeInfo = true,
};
if (permId != null)
execMsg.SetPermId(permId.Value);
if (clientId != null)
execMsg.SetClientId(clientId.Value);
if (liquidation != null)
execMsg.SetLiquidation(liquidation.Value);
if (cumulativeQuantity != null)
execMsg.SetCumulativeQuantity(cumulativeQuantity.Value);
if (averagePrice != null)
execMsg.SetAveragePrice(averagePrice.Value);
//.........这里部分代码省略.........