Пример #1
0
        /// <summary>
        /// Parses each field of a MarketDataRequest update.
        /// </summary>
        public void Parse()
        {
            int tagLength = tag.Length;

            if (tagLength == 2)
            {
                if (IsTag[tagLength](Tag.Trailer.CheckSum))
                {
                    trailer.CheckSum = ParseIntField();
                }
            }
            else if (tagLength == 3)
            {
                if (IsTag[tagLength](Tag.MarketDataRequest.MDReqID))
                {
                    ParseCharArrayField(MDReqID);
                }
            }
            else if (tagLength == 4)
            {
                if (IsTag[tagLength](Tag.MarketDataRequest.ApplID))
                {
                    ParseCharArrayField(ApplID);
                }
                else if (IsTag[tagLength](Tag.MarketDataRequest.ApplBeginSeqNo))
                {
                    ApplBeginSeqNo = ParseIntField();
                }
                else if (IsTag[tagLength](Tag.MarketDataRequest.ApplEndSeqNo))
                {
                    ApplEndSeqNo = ParseIntField();
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Parses each field of a SecurityStatus update.
        /// </summary>
        public void Parse()
        {
            int tagLength = tag.Length;

            if (tagLength == 2)
            {
                if (IsTag[tagLength](Tag.SecurityStatus.SecurityIDSource))
                {
                    SecurityIDSource = ParseCharField();
                }
                else if (IsTag[tagLength](Tag.SecurityStatus.SecurityID))
                {
                    ParseCharArrayField(SecurityID);
                }
                else if (IsTag[tagLength](Tag.SecurityStatus.Symbol))
                {
                    ParseCharArrayField(Symbol);
                }
                else if (IsTag[tagLength](Tag.SecurityStatus.TradeDate))
                {
                    TradeDate = ParseDateField();
                }
                else if (IsTag[tagLength](Tag.Trailer.CheckSum))
                {
                    trailer.CheckSum = ParseIntField();
                }
            }
            else if (tagLength == 3)
            {
                if (IsTag[tagLength](Tag.SecurityStatus.HighPx))
                {
                    HighPx = ParseIntField();
                }
                else if (IsTag[tagLength](Tag.SecurityStatus.LowPx))
                {
                    LowPx = ParseIntField();
                }
                else if (IsTag[tagLength](Tag.SecurityStatus.SecurityTradingStatus))
                {
                    SecurityTradingStatus = ParseIntField();
                }
                else if (IsTag[tagLength](Tag.SecurityStatus.HaltReason))
                {
                    HaltReason = ParseIntField();
                }
            }
            else if (tagLength == 4)
            {
                if (IsTag[tagLength](Tag.SecurityStatus.SecurityTradingEvent))
                {
                    SecurityTradingEvent = ParseIntField();
                }
            }
        }
Пример #3
0
        /// <summary>
        /// Parses each field of a QuoteRequest update.
        /// </summary>
        public void Parse()
        {
            int tagLength = tag.Length;

            if (tagLength == 2)
            {
                if (IsTag[tagLength](Tag.Trailer.CheckSum))
                {
                    trailer.CheckSum = ParseIntField();
                }
                else if (IsTag[tagLength](Tag.QuoteRequest.Symbol))
                {
                    ParseCharArrayField(Symbol);
                }
                else if (IsTag[tagLength](Tag.QuoteRequest.OrderQty))
                {
                    OrderQty = ParseIntField();
                }
                else if (IsTag[tagLength](Tag.QuoteRequest.Side))
                {
                    Side = ParseCharField();
                }
                else if (IsTag[tagLength](Tag.QuoteRequest.SecurityID))
                {
                    ParseCharArrayField(SecurityID);
                }
                else if (IsTag[tagLength](Tag.QuoteRequest.SecurityIDSource))
                {
                    SecurityIDSource = ParseCharField();
                }
            }
            else if (tagLength == 3)
            {
                if (IsTag[tagLength](Tag.QuoteRequest.QuoteReqID))
                {
                    ParseCharArrayField(QuoteReqID);
                }
                else if (IsTag[tagLength](Tag.QuoteRequest.NoRelatedSym))
                {
                    NoRelatedSym = ParseIntField();
                }
                else if (IsTag[tagLength](Tag.QuoteRequest.QuoteType))
                {
                    QuoteType = ParseIntField();
                }
            }

            throw new NotImplementedException("QuoteRequest_Parse method not yet implemented.");
        }
Пример #4
0
        private bool HasParsedTimestamp()
        {
            int tagLength = tag.Length;

            if (tagLength == 1)
            {
                if (IsTag[tagLength](Tag.Header.BodyLength))
                {
                    BodyLength = ParseIntField();
                }
            }
            else if (tagLength == 2)
            {
                if (IsTag[tagLength](Tag.Header.MsgType))
                {
                    MsgType = ParseCharField();
                }
                else if (IsTag[tagLength](Tag.Header.SenderCompID))
                {
                    ParseCharArrayField(SenderCompID);
                }
                else if (IsTag[tagLength](Tag.Header.MsgSeqNum))
                {
                    MsgSeqNum = ParseIntField();
                }
                else if (IsTag[tagLength](Tag.Header.SendingTime))
                {
                    SendingTime = ParseDateTimeWithMsField();

                    return(true); // Timestamp means we've reached the end of the header.
                }
                else if (IsTag[tagLength](Tag.Trailer.CheckSum))
                {
                    trailer.CheckSum = ParseIntField();
                }
            }
            else if (tagLength == 4)
            {
                if (IsTag[tagLength](Tag.Header.ApplVerID))
                {
                    ApplVerID = ParseCharField();
                }
            }

            return(false);
        }
Пример #5
0
        /// <summary>
        /// Parses each field of a MarketDataSnapshotFullRefresh update.
        /// </summary>
        public void Parse()
        {
            int tagLength = tag.Length;

            if (tagLength == 2)
            {
                if (IsTag[tagLength](Tag.Trailer.CheckSum))
                {
                    trailer.CheckSum = ParseIntField();
                }
                else if (IsTag[tagLength](Tag.MarketDataSnapshotFullRefresh.RptSeq))
                {
                    RptSeq = ParseIntField();
                }
                else if (IsTag[tagLength](Tag.MarketDataSnapshotFullRefresh.SecurityID))
                {
                    ParseCharArrayField(SecurityID);
                }
                else if (IsTag[tagLength](Tag.MarketDataSnapshotFullRefresh.SecurityIDSource))
                {
                    SecurityIDSource = ParseCharField();
                }
            }
            else if (tagLength == 3)
            {
                if (IsTag[tagLength](Tag.MarketDataSnapshotFullRefresh.TotNumReports))
                {
                    TotNumReports = ParseIntField();
                }
                else if (IsTag[tagLength](Tag.MarketDataSnapshotFullRefresh.NoMDEntries))
                {
                    NoMDEntries = ParseIntField();
                }
            }
            else if (tagLength == 4)
            {
                if (IsTag[tagLength](Tag.MarketDataSnapshotFullRefresh.MDBookType))
                {
                    MDBookType = ParseIntField();
                }
            }

            throw new NotImplementedException("MarketDataSnapshotFullRefresh_Parse method not yet implemented.");
        }
Пример #6
0
        /// <summary>
        /// Parses each field of a Logon update.
        /// </summary>
        public void Parse()
        {
            int tagLength = tag.Length;

            if (tagLength == 2)
            {
                if (IsTag[tagLength](Tag.Logon.EncryptMethod))
                {
                    EncryptMethod = ParseIntField();
                }
                else if (IsTag[tagLength](Tag.Trailer.CheckSum))
                {
                    trailer.CheckSum = ParseIntField();
                }
            }
            else if (tagLength == 3)
            {
                if (IsTag[tagLength](Tag.Logon.HeartBtInt))
                {
                    HeartBtInt = ParseIntField();
                }
                else if (IsTag[tagLength](Tag.Logon.Username))
                {
                    ParseCharArrayField(Username);
                }
                else if (IsTag[tagLength](Tag.Logon.Password))
                {
                    ParseCharArrayField(Password);
                }
            }
            else if (tagLength == 4)
            {
                if (IsTag[tagLength](Tag.Logon.DefaultApplVerID))
                {
                    DefaultApplVerID = ParseCharField();
                }
                else if (IsTag[tagLength](Tag.Logon.ApplID))
                {
                    ParseCharArrayField(ApplID);
                }
            }
        }
Пример #7
0
        /// <summary>
        /// Parses each field of a Logout update.
        /// </summary>
        public void Parse()
        {
            int tagLength = tag.Length;

            if (tagLength == 2)
            {
                if (IsTag[tagLength](Tag.Logout.Text))
                {
                    ParseCharArrayField(Text);
                }
                else if (IsTag[tagLength](Tag.Trailer.CheckSum))
                {
                    trailer.CheckSum = ParseIntField();
                }
            }
            else if (tagLength == 4)
            {
                if (IsTag[tagLength](Tag.Logout.ApplID))
                {
                    ParseCharArrayField(ApplID);
                }
            }
        }
Пример #8
0
        /// <summary>
        /// Parses each field of a SecurityDefinition update.
        /// </summary>
        public void Parse()
        {
            int tagLength = tag.Length;

            if (tagLength == 2)
            {
                if (IsTag[tagLength](Tag.Trailer.CheckSum))
                {
                    trailer.CheckSum = ParseIntField();
                }
                else if (IsTag[tagLength](Tag.SecurityDefinition.Symbol))
                {
                    ParseCharArrayField(Symbol);
                }
                else if (IsTag[tagLength](Tag.SecurityDefinition.SecurityID))
                {
                    ParseCharArrayField(SecurityID);
                }
                else if (IsTag[tagLength](Tag.SecurityDefinition.SecurityIDSource))
                {
                    SecurityIDSource = ParseCharField();
                }
                else if (IsTag[tagLength](Tag.SecurityDefinition.Currency))
                {
                    ParseCharArrayField(Currency);
                }
            }
            else if (tagLength == 3)
            {
                if (IsTag[tagLength](Tag.SecurityDefinition.TotNumReports))
                {
                    TotNumReports = ParseIntField();
                }
                else if (IsTag[tagLength](Tag.SecurityDefinition.NoEvents))
                {
                    NoEvents = ParseIntField();
                }
                else if (IsTag[tagLength](Tag.SecurityDefinition.SettlPriceType))
                {
                    SettlPriceType = ParseIntField();
                }
                else if (IsTag[tagLength](Tag.SecurityDefinition.SecurityDesc))
                {
                    ParseCharArrayField(SecurityDesc);
                }
                else if (IsTag[tagLength](Tag.SecurityDefinition.CFICode))
                {
                    ParseCharArrayField(CFICode);
                }
                else if (IsTag[tagLength](Tag.SecurityDefinition.UnderlyingProduct))
                {
                    UnderlyingProduct = ParseIntField();
                }
                else if (IsTag[tagLength](Tag.SecurityDefinition.SecurityExchange))
                {
                    ParseCharArrayField(SecurityExchange);
                }
                else if (IsTag[tagLength](Tag.SecurityDefinition.ExpirationCycle))
                {
                    ExpirationCycle = ParseIntField();
                }
                else if (IsTag[tagLength](Tag.SecurityDefinition.StrikePrice))
                {
                    StrikePrice = ParseIntField();
                }
                else if (IsTag[tagLength](Tag.SecurityDefinition.StrikeCurrency))
                {
                    ParseCharArrayField(StrikeCurrency);
                }
                else if (IsTag[tagLength](Tag.SecurityDefinition.MinTradeVol))
                {
                    MinTradeVol = ParseIntField();
                }
                else if (IsTag[tagLength](Tag.SecurityDefinition.SettlCurrency))
                {
                    ParseCharArrayField(SettlCurrency);
                }
            }
            else if (tagLength == 4)
            {
                if (IsTag[tagLength](Tag.SecurityDefinition.TradingReferencePrice))
                {
                    TradingReferencePrice = ParseIntField();
                }
                else if (IsTag[tagLength](Tag.SecurityDefinition.HighLimitPrice))
                {
                    HighLimitPrice = ParseIntField();
                }
                else if (IsTag[tagLength](Tag.SecurityDefinition.LowLimitPrice))
                {
                    LowLimitPrice = ParseIntField();
                }
                else if (IsTag[tagLength](Tag.SecurityDefinition.SecurityGroup))
                {
                    ParseCharArrayField(SecurityGroup);
                }
                else if (IsTag[tagLength](Tag.SecurityDefinition.PricingModel))
                {
                    PricingModel = ParseCharField();
                }
                else if (IsTag[tagLength](Tag.SecurityDefinition.MinCabPrice))
                {
                    MinCabPrice = ParseIntField();
                }
                else if (IsTag[tagLength](Tag.SecurityDefinition.UnitOfMeasureQty))
                {
                    UnitOfMeasureQty = ParseIntField();
                }
                else if (IsTag[tagLength](Tag.SecurityDefinition.MaxTradeVol))
                {
                    MaxTradeVol = ParseIntField();
                }
                else if (IsTag[tagLength](Tag.SecurityDefinition.NoMDFeedTypes))
                {
                    NoMDFeedTypes = ParseIntField();
                }
            }

            throw new NotImplementedException("SecurityDefinition_Parse method not yet implemented.");
        }
        /// <summary>
        /// Parses each field of a MarketDataIncrementalRefresh update.
        /// </summary>
        public void Parse()
        {
            int tagLength = tag.Length;

            if (tagLength == 2)
            {
                if (IsTag[tagLength](Tag.MarketDataIncrementalRefresh.SecurityIDSource))
                {
                    DataBlock[DataBlockCount].SecurityIDSource = ParseCharField();
                }
                else if (IsTag[tagLength](Tag.MarketDataIncrementalRefresh.SecurityID))
                {
                    ParseCharArrayField(DataBlock[DataBlockCount].SecurityID);
                }
                else if (IsTag[tagLength](Tag.MarketDataIncrementalRefresh.RptSeq))
                {
                    DataBlock[DataBlockCount].RptSeq = ParseIntField();
                }
                else if (IsTag[tagLength](Tag.MarketDataIncrementalRefresh.SettleDate))
                {
                    DataBlock[DataBlockCount].SettlDate = ParseDateField();
                }
                else if (IsTag[tagLength](Tag.MarketDataIncrementalRefresh.TradeDate))
                {
                    TradeDate = ParseDateField();
                }
                else if (IsTag[tagLength](Tag.Trailer.CheckSum))
                {
                    if (DataBlock[DataBlockCount].MDEntryType == Value.MDEntryType.Trade)
                    {
                        decoder.OnTradeParsed(DataBlock[DataBlockCount]);
                    }
                    else
                    {
                        decoder.OnQuoteParsed(DataBlock[DataBlockCount]);
                    }

                    trailer.CheckSum = ParseIntField();
                }
            }
            else if (tagLength == 3)
            {
                if (IsTag[tagLength](Tag.MarketDataIncrementalRefresh.MDEntryType))
                {
                    DataBlock[DataBlockCount].MDEntryType = ParseCharField();
                }
                else if (IsTag[tagLength](Tag.MarketDataIncrementalRefresh.MDEntryPx))
                {
                    DataBlock[DataBlockCount].MDEntryPx = ParseIntField();
                }
                else if (IsTag[tagLength](Tag.MarketDataIncrementalRefresh.MDEntrySize))
                {
                    DataBlock[DataBlockCount].MDEntrySize = ParseIntField();
                }
                else if (IsTag[tagLength](Tag.MarketDataIncrementalRefresh.QuoteCondition))
                {
                    DataBlock[DataBlockCount].QuoteCondition = ParseCharField();
                }
                else if (IsTag[tagLength](Tag.MarketDataIncrementalRefresh.SecurityDesc))
                {
                    ParseCharArrayField(DataBlock[DataBlockCount].SecurityDesc);
                }
                else if (IsTag[tagLength](Tag.MarketDataIncrementalRefresh.MDUpdateAction))
                {
                    if (DataBlockCount > 0)
                    {
                        if (DataBlock[DataBlockCount].MDEntryType == Value.MDEntryType.Trade)
                        {
                            decoder.OnTradeParsed(DataBlock[DataBlockCount]);
                        }
                        else
                        {
                            decoder.OnQuoteParsed(DataBlock[DataBlockCount]);
                        }
                    }

                    DataBlockCount++;

                    // Set all values which don't always get read in to "null" here
                    DataBlock[DataBlockCount].MDEntrySize               = Value.NullEnumerations.IntEnum;
                    DataBlock[DataBlockCount].TradingSessionID          = Value.NullEnumerations.IntEnum;
                    DataBlock[DataBlockCount].MDPriceLevel              = Value.NullEnumerations.IntEnum;
                    DataBlock[DataBlockCount].QuoteCondition            = Value.NullEnumerations.Char;
                    DataBlock[DataBlockCount].NumberOfOrders            = Value.NullEnumerations.IntEnum;
                    DataBlock[DataBlockCount].NetChgPrevDay             = Value.NullEnumerations.IntValue;
                    DataBlock[DataBlockCount].TickDirection             = Value.NullEnumerations.IntEnum;
                    DataBlock[DataBlockCount].OpenCloseSettleFlag       = Value.NullEnumerations.IntEnum;
                    DataBlock[DataBlockCount].SettlDate                 = Value.NullEnumerations.DateTime;
                    DataBlock[DataBlockCount].TradeCondition            = Value.NullEnumerations.Char;
                    DataBlock[DataBlockCount].TradeVolume               = Value.NullEnumerations.IntEnum;
                    DataBlock[DataBlockCount].MDQuoteType               = Value.NullEnumerations.IntEnum;
                    DataBlock[DataBlockCount].FixingBracket.Contents[0] = Value.NullEnumerations.Char;
                    DataBlock[DataBlockCount].AggressorSide             = Value.NullEnumerations.IntEnum;
                    DataBlock[DataBlockCount].MatchEventIndicator       = Value.NullEnumerations.IntEnum;

                    DataBlock[DataBlockCount].MDUpdateAction = ParseIntField();
                }
                else if (IsTag[tagLength](Tag.MarketDataIncrementalRefresh.MDEntryTime))
                {
                    DataBlock[DataBlockCount].MDEntryTime = ParseTimeWithMsField();
                }
                else if (IsTag[tagLength](Tag.MarketDataIncrementalRefresh.NumberOfOrders))
                {
                    DataBlock[DataBlockCount].NumberOfOrders = ParseIntField();
                }
                else if (IsTag[tagLength](Tag.MarketDataIncrementalRefresh.TradingSessionID))
                {
                    DataBlock[DataBlockCount].TradingSessionID = ParseIntField();
                }
                else if (IsTag[tagLength](Tag.MarketDataIncrementalRefresh.NoMDEntries))
                {
                    NoMDEntries = ParseIntField();
                }
                else if (IsTag[tagLength](Tag.MarketDataIncrementalRefresh.OpenCloseSettleFlag))
                {
                    DataBlock[DataBlockCount].OpenCloseSettleFlag = ParseIntField();
                }
                else if (IsTag[tagLength](Tag.MarketDataIncrementalRefresh.TradeCondition))
                {
                    DataBlock[DataBlockCount].TradeCondition = ParseCharField();
                }
                else if (IsTag[tagLength](Tag.MarketDataIncrementalRefresh.TickDirection))
                {
                    DataBlock[DataBlockCount].TickDirection = ParseIntField();
                }
                else if (IsTag[tagLength](Tag.MarketDataIncrementalRefresh.NetChgPrevDay))
                {
                    DataBlock[DataBlockCount].NetChgPrevDay = ParseNegativeIntField();
                }
            }
            else if (tagLength == 4)
            {
                if (IsTag[tagLength](Tag.MarketDataIncrementalRefresh.MDPriceLevel))
                {
                    DataBlock[DataBlockCount].MDPriceLevel = ParseIntField();
                }
                else if (IsTag[tagLength](Tag.MarketDataIncrementalRefresh.MDQuoteType))
                {
                    DataBlock[DataBlockCount].MDQuoteType = ParseIntField();
                }
                else if (IsTag[tagLength](Tag.MarketDataIncrementalRefresh.TradeVolume))
                {
                    DataBlock[DataBlockCount].TradeVolume = ParseIntField();
                }
                else if (IsTag[tagLength](Tag.MarketDataIncrementalRefresh.FixingBracket))
                {
                    // The documentation doesn't show what format the FixingBracket value comes in, so
                    // I'm not sure what to do here.  Below this Exception is what I *think* may be correct,
                    // but I'm not sure.
                    throw new NotImplementedException("Tag 'Fixing Bracket' not yet implemented.");

                    ParseCharArrayField(DataBlock[DataBlockCount].FixingBracket);
                }
                else if (IsTag[tagLength](Tag.MarketDataIncrementalRefresh.AggressorSide))
                {
                    DataBlock[DataBlockCount].AggressorSide = ParseIntField();
                }
                else if (IsTag[tagLength](Tag.MarketDataIncrementalRefresh.MatchEventIndicator))
                {
                    DataBlock[DataBlockCount].MatchEventIndicator = ParseIntField();
                }
            }
        }
Пример #10
0
        private bool HasParsedHeader()
        {
            int tagLength = tag.Length;

            if (tagLength == 2)
            {
                if (IsTag[tagLength](Tag.Header.PossDupFlag))
                {
                    PossDupFlag = ParseCharField();

                    return(true);
                }
                else if (IsTag[tagLength](Tag.Trailer.CheckSum))
                {
                    trailer.CheckSum = ParseIntField();

                    return(false);
                }
                else
                {
                    decoder.ProcessUpdate(value);

                    return(true);
                }
            }
            else if (tagLength == 3)
            {
                if (IsTag[tagLength](Tag.Header.LastMsgSeqNumProcessed))
                {
                    LastMsgSeqNumProcessed = ParseIntField();

                    return(true);
                }
                else
                {
                    decoder.ProcessUpdate(value);

                    return(true);
                }
            }
            else if (tagLength == 4)
            {
                if (IsTag[tagLength](Tag.Header.MDSecurityTradingStatus))
                {
                    MDSecurityTradingStatus = ParseIntField();

                    return(true);
                }
                else
                {
                    decoder.ProcessUpdate(value);

                    return(true);
                }
            }
            else
            {
                decoder.ProcessUpdate(value);

                return(true);
            }
        }