本文整理汇总了C#中StockSharp.InteractiveBrokers.Native.IBSocket.ReadBool方法的典型用法代码示例。如果您正苦于以下问题:C# IBSocket.ReadBool方法的具体用法?C# IBSocket.ReadBool怎么用?C# IBSocket.ReadBool使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StockSharp.InteractiveBrokers.Native.IBSocket
的用法示例。
在下文中一共展示了IBSocket.ReadBool方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadOpenOrder
private void ReadOpenOrder(IBSocket socket, ServerVersions version)
{
var transactionId = socket.ReadInt();
var contractId = version >= ServerVersions.V17 ? socket.ReadInt() : -1;
var secCode = socket.ReadStr();
var type = socket.ReadSecurityType();
var expiryDate = socket.ReadExpiry();
var strike = socket.ReadDecimal();
var optionType = socket.ReadOptionType();
var multiplier = version >= ServerVersions.V32 ? socket.ReadMultiplier() : null;
var boardCode = socket.ReadBoardCode();
var currency = socket.ReadCurrency();
secCode = version >= ServerVersions.V2 ? socket.ReadLocalCode(secCode) : null;
var secClass = (version >= ServerVersions.V32) ? socket.ReadStr() : null;
var ibCon = new IBOrderCondition();
// read order fields
var direction = socket.ReadOrderSide();
var volume = socket.ReadDecimal();
OrderTypes orderType;
IBOrderCondition.ExtendedOrderTypes? extendedType;
socket.ReadOrderType(out orderType, out extendedType);
ibCon.ExtendedType = extendedType;
var price = socket.ReadDecimal();
ibCon.StopPrice = socket.ReadDecimal();
var expiration = socket.ReadStr();
ibCon.Oca.Group = socket.ReadStr();
var portfolio = socket.ReadStr();
ibCon.IsOpenOrClose = socket.ReadStr() == "O";
ibCon.Origin = (IBOrderCondition.OrderOrigins)socket.ReadInt();
var comment = socket.ReadStr();
var clientId = version >= ServerVersions.V3 ? socket.ReadInt() : (int?)null;
int? permId = null;
if (version >= ServerVersions.V4)
{
permId = socket.ReadInt();
if (version < ServerVersions.V18)
{
// will never happen
/* order.m_ignoreRth = */
socket.ReadBool();
}
else
ibCon.OutsideRth = socket.ReadBool();
ibCon.Hidden = socket.ReadBool();
ibCon.SmartRouting.DiscretionaryAmount = socket.ReadDecimal();
}
if (version >= ServerVersions.V5)
ibCon.GoodAfterTime = socket.ReadNullDateTime(IBSocketHelper.TimeFormat);
if (version >= ServerVersions.V6)
{
// skip deprecated sharesAllocation field
socket.ReadStr();
}
if (version >= ServerVersions.V7)
{
ibCon.FinancialAdvisor.Group = socket.ReadStr();
ibCon.FinancialAdvisor.Allocation = socket.ReadFinancialAdvisor();
ibCon.FinancialAdvisor.Percentage = socket.ReadStr();
ibCon.FinancialAdvisor.Profile = socket.ReadStr();
}
var orderExpiryDate = version >= ServerVersions.V8 ? socket.ReadNullDateTime(IBSocketHelper.TimeFormat) : null;
var visibleVolume = volume;
if (version >= ServerVersions.V9)
{
ibCon.Agent = socket.ReadAgent();
ibCon.PercentOffset = socket.ReadDecimal();
ibCon.Clearing.SettlingFirm = socket.ReadStr();
ibCon.ShortSale.Slot = (IBOrderCondition.ShortSaleSlots)socket.ReadInt();
ibCon.ShortSale.Location = socket.ReadStr();
if (socket.ServerVersion == ServerVersions.V51)
socket.ReadInt(); //exempt code
else if (version >= ServerVersions.V23)
ibCon.ShortSale.ExemptCode = socket.ReadInt();
ibCon.AuctionStrategy = (IBOrderCondition.AuctionStrategies)socket.ReadInt();
ibCon.StartingPrice = socket.ReadDecimal();
ibCon.StockRefPrice = socket.ReadDecimal();
ibCon.Delta = socket.ReadDecimal();
ibCon.StockRangeLower = socket.ReadDecimal();
ibCon.StockRangeUpper = socket.ReadDecimal();
visibleVolume = socket.ReadInt();
if (version < ServerVersions.V18)
{
//.........这里部分代码省略.........
示例2: ReadTickPrice
private void ReadTickPrice(IBSocket socket, ServerVersions version)
{
var requestId = socket.ReadInt();
var priceField = (FieldTypes)socket.ReadInt();
var price = socket.ReadDecimal();
var volume = version >= ServerVersions.V2 ? socket.ReadInt() : (decimal?)null;
var canAutoExecute = version >= ServerVersions.V3 ? socket.ReadBool() : (bool?)null;
ProcessTick(requestId, priceField, price, volume);
}
示例3: ReadMarketDepth
private void ReadMarketDepth(IBSocket socket, ResponseMessages message)
{
var requestId = socket.ReadInt();
var secId = GetSecurityId(requestId);
/* position */
var pos = socket.ReadInt();
if (message == ResponseMessages.MarketDepthL2)
{
/* marketMaker */
secId.BoardCode = socket.ReadBoardCode();
}
var operation = socket.ReadInt();
var side = socket.ReadBool() ? Sides.Buy : Sides.Sell;
var price = socket.ReadDecimal();
var volume = socket.ReadInt();
var prevQuotes = _depths.SafeAdd(secId, key =>
Tuple.Create(new SortedDictionary<decimal, decimal>(new BackwardComparer<decimal>()), new SortedDictionary<decimal, decimal>()));
var quotes = side == Sides.Buy ? prevQuotes.Item1 : prevQuotes.Item2;
this.AddDebugLog("MD {0} {1} POS {2} PRICE {3} VOL {4}", secId, operation, pos, price, volume);
switch (operation)
{
case 0: // insert
{
if (!CollectionHelper.TryAdd(quotes, price, volume))
quotes[price] += volume;
break;
}
case 1: // update
{
if (quotes.Count > (pos + 1))
{
var sign = side == Sides.Buy ? 1 : -1;
if (quotes[pos + 1] * sign >= price * sign)
{
for (var i = quotes.Count - 1; i >= pos + 1; i--)
quotes.Remove(quotes[quotes.Keys.ElementAt(i)]);
}
}
if (quotes.Count > pos)
{
//if (quotes[quotes.Keys.ElementAt(pos)] == price)
// quotes[price] = volume;
//else
//{
// depth.Remove(quotes[pos]);
// depth.AddQuote(quote);
//}
quotes[price] = volume;
}
else
{
if (!CollectionHelper.TryAdd(quotes, price, volume))
quotes[price] += volume;
}
break;
}
case 2: // delete
{
if (quotes.Count > pos)
quotes.Remove(quotes.Keys.ElementAt(pos));
break;
}
}
SendOutMessage(new QuoteChangeMessage
{
SecurityId = secId,
Bids = prevQuotes.Item1.Select(p => new QuoteChange(Sides.Buy, p.Key, p.Value)).ToArray(),
Asks = prevQuotes.Item2.Select(p => new QuoteChange(Sides.Sell, p.Key, p.Value)).ToArray(),
ServerTime = this.CurrentTime.Convert(TimeZoneInfo.Utc),
});
}
示例4: ReadMarketDataType
private void ReadMarketDataType(IBSocket socket)
{
/* requestId */
socket.ReadInt();
IsRealTimeMarketData = socket.ReadBool();
//marketDataType(reqId, mdt);
}
示例5: ReadBondInfo
private void ReadBondInfo(IBSocket socket, ServerVersions version)
{
var requestId = version >= ServerVersions.V3 ? socket.ReadInt() : -1;
var secCode = socket.ReadStr();
var type = socket.ReadSecurityType();
var cusip = socket.ReadStr();
var coupon = socket.ReadDecimal();
var maturity = socket.ReadStr();
var issueDate = socket.ReadStr();
var ratings = socket.ReadStr();
var bondType = socket.ReadStr();
var couponType = socket.ReadStr();
var convertible = socket.ReadBool();
var callable = socket.ReadBool();
var putable = socket.ReadBool();
var description = socket.ReadStr();
var boardCode = socket.ReadBoardCode();
var currency = socket.ReadCurrency();
var marketName = socket.ReadStr();
var secClass = socket.ReadStr();
var contractId = socket.ReadInt();
var priceStep = socket.ReadDecimal();
var orderTypes = socket.ReadStr();
var validExchanges = socket.ReadStr();
var nextOptionDate = version >= ServerVersions.V2 ? socket.ReadStr() : null;
var nextOptionType = version >= ServerVersions.V2 ? socket.ReadStr() : null;
var nextOptionPartial = version >= ServerVersions.V2 ? socket.ReadBool() : (bool?)null;
var notes = version >= ServerVersions.V2 ? socket.ReadStr() : null;
var name = version >= ServerVersions.V4 ? socket.ReadStr() : null;
var evRule = version >= ServerVersions.V6 ? socket.ReadStr() : null;
var evMultiplier = version >= ServerVersions.V6 ? socket.ReadDecimal() : (decimal?)null;
var secId = new SecurityId
{
SecurityCode = secCode,
BoardCode = GetBoardCode(boardCode),
InteractiveBrokers = contractId,
};
if (version >= ServerVersions.V5)
socket.ReadSecurityId(secId);
var secMsg = new SecurityMessage
{
SecurityId = secId,
//Name = secName,
SecurityType = type,
Currency = currency,
Class = secClass,
PriceStep = priceStep,
};
secMsg.SetMarketName(marketName);
secMsg.SetOrderTypes(orderTypes);
secMsg.SetValidExchanges(validExchanges);
// TODO
//s.SetBondCusip(cusip);
//s.SetCoupon(coupon);
//s.SetMaturity(maturity);
//s.SetIssueDate(issueDate);
//s.SetRatings(ratings);
//s.SetBondType(bondType);
//s.SetCouponType(couponType);
//s.SetConvertible(convertible);
//s.SetCallable(callable);
//s.SetPutable(putable);
//s.SetDescription(description);
//if (nextOptionDate != null)
// s.SetNextOptionDate(nextOptionDate);
//if (nextOptionType != null)
// s.SetNextOptionType(nextOptionType);
//if (nextOptionPartial != null)
// s.SetNextOptionPartial(nextOptionPartial.Value);
//if (notes != null)
// s.SetNotes(notes);
if (evRule != null)
secMsg.SetEvRule(evRule);
if (evMultiplier != null)
secMsg.SetEvMultiplier(evMultiplier.Value);
SendOutMessage(secMsg);
}