internal OrderStatusReport(ResponseComposer c) { var serverVersion = c.Config.ServerVersionCurrent; var version = serverVersion >= ServerVersion.MarketCapPrice ? int.MaxValue : c.ReadInt(); OrderId = c.ReadInt(); Status = c.ReadStringEnum <OrderStatus>(); Filled = c.ReadDouble(); Remaining = c.ReadDouble(); AverageFillPrice = c.ReadDouble(); if (version >= 2) { PermanentId = c.ReadInt(); } if (version >= 3) { ParentId = c.ReadInt(); } if (version >= 4) { LastFillPrice = c.ReadDouble(); } if (version >= 5) { ClientId = c.ReadInt(); } if (version >= 6) { WhyHeld = c.ReadString(); } if (serverVersion >= ServerVersion.MarketCapPrice) { MktCapPrice = c.ReadDouble(); } }
internal static void Send(ResponseComposer p) { var version = p.GetVersion(); var requestId = p.ReadInt(); if (requestId == int.MaxValue) { p.ReadDouble(); // trigger parse exception for testing } var priceTickType = p.ReadEnum <TickType>(); var price = p.ReadDouble(); var size = version >= 2 ? p.ReadInt() : 0; var priceTick = new TickPrice(requestId, priceTickType, price, new TickAttrib(version >= 3? p: null)); p.Output(priceTick); if (version >= 2) { TickType tickTypeSize = GetTickTypeSize(priceTickType); if (tickTypeSize != TickType.Undefined) { p.Output(new TickSize(requestId, tickTypeSize, size)); } } }
internal TickSize(ResponseComposer c) { c.IgnoreVersion(); RequestId = c.ReadInt(); TickType = c.ReadEnum <TickType>(); Size = c.ReadInt(); }
internal TickReqParams(ResponseComposer c) { RequestId = c.ReadInt(); MinTick = c.ReadDouble(); BboExchange = c.ReadString(); SnapshotPermissions = c.ReadInt(); }
public HistoricalLastTicks(ResponseComposer c) { RequestId = c.ReadInt(); var n = c.ReadInt(); Ticks = Enumerable.Repeat(new HistoricalLastTick(c), n).ToList().AsReadOnly(); Done = c.ReadBool(); }
internal SecurityDefinitionOptionParameter(ResponseComposer c) { RequestId = c.ReadInt(); Exchange = c.ReadString(); UnderlyingContractId = c.ReadInt(); TradingClass = c.ReadString(); Multiplier = c.ReadString(); c.AddStringsToList(Expirations); c.AddStringsToList(Strikes); }
internal HistogramItems(ResponseComposer c) { RequestId = c.ReadInt(); var n = c.ReadInt(); for (int i = 0; i < n; i++) { Items.Add(new HistogramItem(c)); } }
internal SoftDollarTiers(ResponseComposer c) { RequestId = c.ReadInt(); var n = c.ReadInt(); for (int i = 0; i < n; i++) { Tiers.Add(new SoftDollarTier(c)); } }
internal MarketRule(ResponseComposer c) { MarketRuleId = c.ReadInt(); var n = c.ReadInt(); for (int i = 0; i < n; i++) { PriceIncrements.Add(new PriceIncrement(c)); } }
internal SymbolSamples(ResponseComposer c) { RequestId = c.ReadInt(); var n = c.ReadInt(); for (int i = 0; i < n; i++) { Descriptions.Add(new ContractDescription(c)); } }
internal ScannerData(ResponseComposer c) { c.RequireVersion(3); RequestId = c.ReadInt(); var n = c.ReadInt(); for (int i = 0; i < n; i++) { Items.Add(new ScannerDataItem(c)); } }
internal DeltaNeutralContract(ResponseComposer c, bool independent) { if (independent) { c.IgnoreVersion(); RequestId = c.ReadInt(); } ContractId = c.ReadInt(); Delta = c.ReadDouble(); Price = c.ReadDouble(); }
public HistoricalTicks(ResponseComposer c) { RequestId = c.ReadInt(); var n = c.ReadInt(); for (int i = 0; i < n; i++) { Ticks.Add(new HistoricalTick(c)); } Done = c.ReadBool(); }
internal ContractComboLeg(ResponseComposer c) { ContractId = c.ReadInt(); Ratio = c.ReadInt(); TradeAction = c.ReadStringEnum <TradeAction>(); Exchange = c.ReadString(); OpenClose = c.ReadEnum <ComboOpenClose>(); ComboShortSaleSlot = c.ReadEnum <ComboShortSaleSlot>(); DesignatedLocation = c.ReadString(); ExemptCode = c.ReadInt(); }
internal HistoricalData(ResponseComposer c) { RequestId = c.ReadInt(); BarCount = c.ReadInt(); Date = c.ReadString(); Open = c.ReadDouble(); Close = c.ReadDouble(); High = c.ReadDouble(); Low = c.ReadDouble(); WAP = c.ReadDouble(); Volume = c.ReadLong(); }
internal SmartComponents(ResponseComposer c) { RequestId = c.ReadInt(); var n = c.ReadInt(); for (var i = 0; i < n; i++) { var bitNumber = c.ReadInt(); var exchange = c.ReadString(); var exchangeLetter = c.ReadChar(); Map.Add(bitNumber, new KeyValuePair <string, char>(exchange, exchangeLetter)); } }
internal TickExchangeForPhysical(ResponseComposer c) { c.IgnoreVersion(); RequestId = c.ReadInt(); TickType = c.ReadEnum <TickType>(); BasisPoints = c.ReadDouble(); FormattedBasisPoints = c.ReadString(); ImpliedFuturesPrice = c.ReadDouble(); HoldDays = c.ReadInt(); FutureExpiry = c.ReadString(); DividendImpact = c.ReadDouble(); DividendsToLastTradeDate = c.ReadDouble(); }
internal RealtimeBar(ResponseComposer c) { c.IgnoreVersion(); RequestId = c.ReadInt(); Time = Instant.FromUnixTimeSeconds(long.Parse(c.ReadString(), NumberFormatInfo.InvariantInfo)); Open = c.ReadDouble(); High = c.ReadDouble(); Low = c.ReadDouble(); Close = c.ReadDouble(); Volume = c.ReadLong(); Wap = c.ReadDouble(); Count = c.ReadInt(); }
internal MarketDepth(ResponseComposer c, bool isLevel2) { c.IgnoreVersion(); RequestId = c.ReadInt(); Position = c.ReadInt(); MarketMaker = isLevel2 ? c.ReadString() : string.Empty; Operation = c.ReadEnum <MarketDepthOperation>(); Side = c.ReadEnum <MarketDepthSide>(); Price = c.ReadDouble(); Size = c.ReadInt(); if (isLevel2 && c.Config.SupportsServerVersion(ServerVersion.SmartDepth)) { IsSmartDepth = c.ReadBool(); } }
public PnLSingle(ResponseComposer c) { RequestId = c.ReadInt(); Pos = c.ReadInt(); DailyPnL = c.ReadDouble(); if (c.Config.SupportsServerVersion(ServerVersion.UnrealizedPnl)) { UnrealizedPnL = c.ReadDouble(); } if (c.Config.SupportsServerVersion(ServerVersion.RealizedPnl)) { RealizedPnL = c.ReadDouble(); } Value = c.ReadDouble(); }
internal HistoricalBars(ResponseComposer c) // a one-shot deal { if (!c.Config.SupportsServerVersion(ServerVersion.SyntRealtimeBats)) { c.RequireVersion(3); } RequestId = c.ReadInt(); Start = c.ReadLocalDateTime(DateTimePattern); End = c.ReadLocalDateTime(DateTimePattern); var n = c.ReadInt(); for (var i = 0; i < n; i++) { Bars.Add(new HistoricalBar(c)); } }
internal HistoricalTick(ResponseComposer c) { Time = c.ReadLong(); c.ReadInt(); // ? Price = c.ReadDouble(); Size = c.ReadLong(); }
internal override void Deserialize(ResponseComposer c) { base.Deserialize(c); ConId = c.ReadInt(); Exchange = c.ReadString(); }
internal PortfolioValue(ResponseComposer c) { c.RequireVersion(8); Contract = new Contract { ContractId = c.ReadInt(), Symbol = c.ReadString(), SecurityType = c.ReadStringEnum <SecurityType>(), LastTradeDateOrContractMonth = c.ReadString(), Strike = c.ReadDouble(), Right = c.ReadStringEnum <RightType>(), Multiplier = c.ReadString(), PrimaryExchange = c.ReadString(), Currency = c.ReadString(), LocalSymbol = c.ReadString(), TradingClass = c.ReadString() }; Position = c.ReadDouble(); MarketPrice = c.ReadDouble(); MarketValue = c.ReadDouble(); AverageCost = c.ReadDouble(); UnrealizedPnl = c.ReadDouble(); RealizedPnl = c.ReadDouble(); Account = c.ReadString(); }
internal TickMarketDataType(ResponseComposer c) { c.IgnoreVersion(); RequestId = c.ReadInt(); TickType = TickType.MarketDataType; // MarketDataType = c.ReadEnum <MarketDataType>(); }
internal NewsBulletin(ResponseComposer c) { c.IgnoreVersion(); MessageId = c.ReadInt(); Type = c.ReadEnum <NewsBulletinType>(); Message = c.ReadString(); Origin = c.ReadString(); }
internal HistoricalNews(ResponseComposer c) { RequestId = c.ReadInt(); Time = c.ReadString(); ProviderCode = c.ReadString(); ArticleId = c.ReadString(); Headline = c.ReadString(); }
internal TickNews(ResponseComposer c) { RequestId = c.ReadInt(); TimeStamp = c.ReadLong(); ProviderCode = c.ReadString(); ArticleId = c.ReadString(); Headline = c.ReadString(); ExtraData = c.ReadString(); }
internal HistoricalLastTick(ResponseComposer c) { Time = c.ReadLong(); TickAttribLast = new TickAttribLast(c.ReadInt()); Price = c.ReadDouble(); Size = c.ReadLong(); Exchange = c.ReadString(); SpecialConditions = c.ReadString(); }
internal HistoricalBidAskTick(ResponseComposer c) { Time = c.ReadLong(); TickAttribBidAsk = new TickAttribBidAsk(c.ReadInt()); PriceBid = c.ReadDouble(); PriceAsk = c.ReadDouble(); SizeBid = c.ReadLong(); SizeAsk = c.ReadLong(); }