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 TickOptionComputation(ResponseComposer c) { var version = c.GetVersion(); RequestId = c.ReadInt(); TickType = c.ReadEnum <TickType>(); ImpliedVolatility = c.ReadDoubleNullable(); if (ImpliedVolatility == -1) { ImpliedVolatility = null; } Delta = c.ReadDoubleNullable(); if (Delta == -2) { Delta = null; } if (version >= 6 || TickType == TickType.ModelOptionComputation || TickType == TickType.DelayedModelOption) { OptPrice = c.ReadDoubleNullable(); if (OptPrice == -1) { OptPrice = null; } PvDividend = c.ReadDoubleNullable(); if (PvDividend == -1) { PvDividend = null; } } if (version >= 6) { Gamma = c.ReadDoubleNullable(); if (Gamma == -2) { Gamma = null; } Vega = c.ReadDoubleNullable(); if (Vega == -2) { Vega = null; } Theta = c.ReadDoubleNullable(); if (Theta == -2) { Theta = null; } UndPrice = c.ReadDoubleNullable(); if (UndPrice == -1) { UndPrice = null; } } }