Beispiel #1
0
        /// <summary>
        /// ieMap[0] is TICK_PRICE (1)
        /// </summary>
        public static bool Parser_TICK_PRICE(byte[] data, System.Collections.Generic.List<Utils.IEIndex> ieMap, out MessageIfc message, out int ieCount)
        {
            bool res = false;
            message = null;
            Utils.IEIndex ieIndex;
            ieCount = 6;
            do
            {
                if (ieMap.Count < ieCount)
                {
                    System.Console.Out.WriteLine ("Not enough ies. Expected "+ieCount+", actual "+ieMap.Count);
                    break;
                }

                // get version
                string ieStr;
                int version;
                int id;
                TickType tickType;
                double price;
                int size;

                ieIndex = ieMap[1];
                res = Utils.GetIEValueInt (data, 0, ieIndex.firstByte, ieIndex.lastByte, out version, out ieStr);
                if (!res) {
                    System.Console.Out.WriteLine ("Failed to parse version (" + ieStr + ")");
                    break;
                }

                ieIndex = ieMap[2];
                res = Utils.GetIEValueInt (data, 0, ieIndex.firstByte, ieIndex.lastByte, out id, out ieStr);
                if (!res) {
                    System.Console.Out.WriteLine ("Failed to parse id (" + ieStr + ")");
                    break;
                }

                ieIndex = ieMap[3];
                int tickTypeValue;
                res = Utils.GetIEValueInt (data, 0, ieIndex.firstByte, ieIndex.lastByte, out tickTypeValue, out ieStr);
                if (!res) {
                    System.Console.Out.WriteLine ("Failed to parse tickType (" + ieStr + ")");
                    break;
                }
                tickType = getTickType(tickTypeValue);

                ieIndex = ieMap[4];
                res = Utils.GetIEValueDouble (data, 0, ieIndex.firstByte, ieIndex.lastByte, out price, out ieStr);
                if (!res) {
                    System.Console.Out.WriteLine ("Failed to parse price (" + ieStr + ")");
                    break;
                }

                ieIndex = ieMap[5];
                res = Utils.GetIEValueInt (data, 0, ieIndex.firstByte, ieIndex.lastByte, out size, out ieStr);
                if (!res) {
                    System.Console.Out.WriteLine ("Failed to parse tickType (" + ieStr + ")");
                    break;
                }

                message = new Message_TickPrice(id, tickType, price, size);

                res = true;
            }
            while (false);

            return res;
        }
Beispiel #2
0
		/// <summary>
		/// ieMap[0] is TICK_PRICE (1)
		/// </summary>
		public static bool Parser_TICK_PRICE (byte[] data, System.Collections.Generic.List<Utils.IEIndex> ieMap, out MessageIfc message, out int ieCount)
		{
			bool res = false;
			message = null;
			Utils.IEIndex ieIndex;
			ieCount = 6;
			do
			{
				if (ieMap.Count < ieCount)
				{
					System.Console.Out.WriteLine ("Not enough ies. Expected "+ieCount+", actual "+ieMap.Count);
					break;
				}
				
				// get version
				string ieStr;
				int version; 
				int id; 
				TickType tickType;
				double price;
				int size;
				
				ieIndex = ieMap[1];
				res = Utils.GetIEValueInt (data, 0, ieIndex.firstByte, ieIndex.lastByte, out version, out ieStr);
				if (!res) {
					System.Console.Out.WriteLine ("Failed to parse version (" + ieStr + ")");
					break;
				}
				
				ieIndex = ieMap[2];
				res = Utils.GetIEValueInt (data, 0, ieIndex.firstByte, ieIndex.lastByte, out id, out ieStr);
				if (!res) {
					System.Console.Out.WriteLine ("Failed to parse id (" + ieStr + ")");
					break;
				}
				
				ieIndex = ieMap[3];
				int tickTypeValue;
				res = Utils.GetIEValueInt (data, 0, ieIndex.firstByte, ieIndex.lastByte, out tickTypeValue, out ieStr);
				if (!res) {
					System.Console.Out.WriteLine ("Failed to parse tickType (" + ieStr + ")");
					break;
				}
				tickType = getTickType(tickTypeValue);
				
				ieIndex = ieMap[4];
				res = Utils.GetIEValueDouble (data, 0, ieIndex.firstByte, ieIndex.lastByte, out price, out ieStr);
				if (!res) {
					System.Console.Out.WriteLine ("Failed to parse price (" + ieStr + ")");
					break;
				}
				
				ieIndex = ieMap[5];
				res = Utils.GetIEValueInt (data, 0, ieIndex.firstByte, ieIndex.lastByte, out size, out ieStr);
				if (!res) {
					System.Console.Out.WriteLine ("Failed to parse tickType (" + ieStr + ")");
					break;
				}
				
				message = new Message_TickPrice(id, tickType, price, size);
				
				res = true;
			}
			while (false);
			
			return res;
		}