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();
            }
        }
Esempio n. 2
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));
                }
            }
        }
Esempio n. 3
0
 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();
 }
Esempio n. 5
0
        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));
            }
        }
Esempio n. 8
0
        internal SoftDollarTiers(ResponseComposer c)
        {
            RequestId = c.ReadInt();
            var n = c.ReadInt();

            for (int i = 0; i < n; i++)
            {
                Tiers.Add(new SoftDollarTier(c));
            }
        }
Esempio n. 9
0
        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));
            }
        }
Esempio n. 11
0
        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();
 }
Esempio n. 13
0
        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();
        }
Esempio n. 14
0
 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();
 }
Esempio n. 15
0
 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));
            }
        }
Esempio n. 17
0
 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();
 }
Esempio n. 18
0
 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();
 }
Esempio n. 19
0
 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();
     }
 }
Esempio n. 20
0
 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();
 }
Esempio n. 21
0
        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));
            }
        }
Esempio n. 22
0
 internal HistoricalTick(ResponseComposer c)
 {
     Time = c.ReadLong();
     c.ReadInt(); // ?
     Price = c.ReadDouble();
     Size  = c.ReadLong();
 }
Esempio n. 23
0
        internal override void Deserialize(ResponseComposer c)
        {
            base.Deserialize(c);

            ConId    = c.ReadInt();
            Exchange = c.ReadString();
        }
Esempio n. 24
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();
 }
Esempio n. 25
0
 internal TickMarketDataType(ResponseComposer c)
 {
     c.IgnoreVersion();
     RequestId      = c.ReadInt();
     TickType       = TickType.MarketDataType; //
     MarketDataType = c.ReadEnum <MarketDataType>();
 }
Esempio n. 26
0
 internal NewsBulletin(ResponseComposer c)
 {
     c.IgnoreVersion();
     MessageId = c.ReadInt();
     Type      = c.ReadEnum <NewsBulletinType>();
     Message   = c.ReadString();
     Origin    = c.ReadString();
 }
Esempio n. 27
0
 internal HistoricalNews(ResponseComposer c)
 {
     RequestId    = c.ReadInt();
     Time         = c.ReadString();
     ProviderCode = c.ReadString();
     ArticleId    = c.ReadString();
     Headline     = c.ReadString();
 }
Esempio n. 28
0
 internal TickNews(ResponseComposer c)
 {
     RequestId    = c.ReadInt();
     TimeStamp    = c.ReadLong();
     ProviderCode = c.ReadString();
     ArticleId    = c.ReadString();
     Headline     = c.ReadString();
     ExtraData    = c.ReadString();
 }
Esempio n. 29
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();
 }
Esempio n. 30
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();
 }