Ejemplo n.º 1
0
        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));
                }
            }
        }
Ejemplo n.º 2
0
 internal TickSize(ResponseComposer c)
 {
     c.IgnoreVersion();
     RequestId = c.ReadInt();
     TickType  = c.ReadEnum <TickType>();
     Size      = c.ReadInt();
 }
Ejemplo n.º 3
0
        internal override void Deserialize(ResponseComposer reader)
        {
            base.Deserialize(reader);

            ConId    = reader.Read <int>();
            Exchange = reader.ReadString();
        }
Ejemplo n.º 4
0
        internal override void Deserialize(ResponseComposer c)
        {
            base.Deserialize(c);

            ConId    = c.ReadInt();
            Exchange = c.ReadString();
        }
        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();
            }
        }
Ejemplo n.º 6
0
 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();
 }
Ejemplo n.º 7
0
 internal HistoricalTick(ResponseComposer c)
 {
     Time = c.ReadLong();
     c.ReadInt(); // ?
     Price = c.ReadDouble();
     Size  = c.ReadLong();
 }
Ejemplo n.º 8
0
 internal TickMarketDataType(ResponseComposer c)
 {
     c.IgnoreVersion();
     RequestId      = c.ReadInt();
     TickType       = TickType.MarketDataType; //
     MarketDataType = c.ReadEnum <MarketDataType>();
 }
Ejemplo n.º 9
0
 internal TickReqParams(ResponseComposer c)
 {
     RequestId           = c.ReadInt();
     MinTick             = c.ReadDouble();
     BboExchange         = c.ReadString();
     SnapshotPermissions = c.ReadInt();
 }
Ejemplo n.º 10
0
        internal override void Deserialize(ResponseComposer reader)
        {
            base.Deserialize(reader);

            SecType  = reader.ReadString();
            Exchange = reader.ReadString();
            Symbol   = reader.ReadString();
        }
Ejemplo n.º 11
0
        internal override void Deserialize(ResponseComposer c)
        {
            base.Deserialize(c);

            SecType  = c.ReadString();
            Exchange = c.ReadString();
            Symbol   = c.ReadString();
        }
Ejemplo n.º 12
0
 internal AccountValue(ResponseComposer c)
 {
     c.RequireVersion(2);
     Key      = c.ReadString();
     Value    = c.ReadString();
     Currency = c.ReadString();
     Account  = c.ReadString();
 }
Ejemplo n.º 13
0
 internal NewsBulletin(ResponseComposer c)
 {
     c.IgnoreVersion();
     MessageId = c.ReadInt();
     Type      = c.ReadEnum <NewsBulletinType>();
     Message   = c.ReadString();
     Origin    = c.ReadString();
 }
Ejemplo n.º 14
0
        public HistoricalLastTicks(ResponseComposer c)
        {
            RequestId = c.ReadInt();
            var n = c.ReadInt();

            Ticks = Enumerable.Repeat(new HistoricalLastTick(c), n).ToList().AsReadOnly();
            Done  = c.ReadBool();
        }
Ejemplo n.º 15
0
 internal HistoricalNews(ResponseComposer c)
 {
     RequestId    = c.ReadInt();
     Time         = c.ReadString();
     ProviderCode = c.ReadString();
     ArticleId    = c.ReadString();
     Headline     = c.ReadString();
 }
Ejemplo n.º 16
0
        internal MktDepthExchanges(ResponseComposer c)
        {
            var n = c.ReadInt();

            for (int i = 0; i < n; i++)
            {
                Exchanges.Add(new MktDepthExchange(c));
            }
        }
Ejemplo n.º 17
0
 internal ScannerDataItem(ResponseComposer c)
 {
     Rank         = c.ReadInt();
     ContractData = new ContractData(c, ContractDataType.ScannerContractData);
     Distance     = c.ReadString();
     Benchmark    = c.ReadString();
     Projection   = c.ReadString();
     ComboLegs    = c.ReadString();
 }
Ejemplo n.º 18
0
        internal FamilyCodes(ResponseComposer c)
        {
            var n = c.ReadInt();

            for (int i = 0; i < n; i++)
            {
                Codes.Add(new FamilyCode(c));
            }
        }
Ejemplo n.º 19
0
 internal AccountSummary(ResponseComposer c)
 {
     c.IgnoreVersion();
     RequestId = c.ReadInt();
     Account   = c.ReadString();
     Tag       = c.ReadString();
     Value     = c.ReadString();
     Currency  = c.ReadString();
 }
Ejemplo n.º 20
0
        internal NewsProviders(ResponseComposer c)
        {
            var n = c.ReadInt();

            for (int i = 0; i < n; i++)
            {
                Providors.Add(new NewsProvider(c));
            }
        }
Ejemplo n.º 21
0
 internal TickNews(ResponseComposer c)
 {
     RequestId    = c.ReadInt();
     TimeStamp    = c.ReadLong();
     ProviderCode = c.ReadString();
     ArticleId    = c.ReadString();
     Headline     = c.ReadString();
     ExtraData    = c.ReadString();
 }
Ejemplo n.º 22
0
 internal HistoricalLastTick(ResponseComposer c)
 {
     Time              = c.ReadLong();
     TickAttribLast    = new TickAttribLast(c.ReadInt());
     Price             = c.ReadDouble();
     Size              = c.ReadLong();
     Exchange          = c.ReadString();
     SpecialConditions = c.ReadString();
 }
Ejemplo n.º 23
0
 internal HistoricalBidAskTick(ResponseComposer c)
 {
     Time             = c.ReadLong();
     TickAttribBidAsk = new TickAttribBidAsk(c.ReadInt());
     PriceBid         = c.ReadDouble();
     PriceAsk         = c.ReadDouble();
     SizeBid          = c.ReadLong();
     SizeAsk          = c.ReadLong();
 }
Ejemplo n.º 24
0
        internal MarketRule(ResponseComposer c)
        {
            MarketRuleId = c.ReadInt();
            var n = c.ReadInt();

            for (int i = 0; i < n; i++)
            {
                PriceIncrements.Add(new PriceIncrement(c));
            }
        }
Ejemplo n.º 25
0
        internal HistogramItems(ResponseComposer c)
        {
            RequestId = c.ReadInt();
            var n = c.ReadInt();

            for (int i = 0; i < n; i++)
            {
                Items.Add(new HistogramItem(c));
            }
        }
Ejemplo n.º 26
0
 internal AccountUpdateMulti(ResponseComposer c)
 {
     c.IgnoreVersion();
     RequestId = c.ReadInt();
     Account   = c.ReadString();
     ModelCode = c.ReadString();
     Key       = c.ReadString();
     Value     = c.ReadString();
     Currency  = c.ReadString();
 }
 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);
 }
Ejemplo n.º 28
0
        internal SoftDollarTiers(ResponseComposer c)
        {
            RequestId = c.ReadInt();
            var n = c.ReadInt();

            for (int i = 0; i < n; i++)
            {
                Tiers.Add(new SoftDollarTier(c));
            }
        }
        internal SymbolSamples(ResponseComposer c)
        {
            RequestId = c.ReadInt();
            var n = c.ReadInt();

            for (int i = 0; i < n; i++)
            {
                Descriptions.Add(new ContractDescription(c));
            }
        }
Ejemplo n.º 30
0
        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;
                }
            }
        }