public String[] RowDataArray()
        {
            var    columns          = new List <string>();
            String DateFormatString = @"{0:d}";

            columns.Add(ServiceId);
            columns.Add(RimMbrNum);
            columns.Add(Cardholder);
            columns.Add(Pan);
            columns.Add(TranType);
            columns.Add((!SettlementDate.Equals(new DateTime(1, 1, 1)) ? String.Format(DateFormatString, SettlementDate) : String.Empty).ToString());
            columns.Add(TerminalId);
            columns.Add(FromAccount);
            columns.Add(TranCode);
            columns.Add(NetworkAmount);
            columns.Add(NetworkCDInd);
            columns.Add(PhoenixAmount);
            columns.Add(PhoenixCDInd);
            columns.Add((!TranDT.Equals(new DateTime(1, 1, 1)) ? String.Format(DateFormatString, TranDT) : String.Empty).ToString());
            columns.Add(PtId);
            columns.Add(ToAccount);
            columns.Add(SourceRefNumber);
            columns.Add(DeviceLocation);
            columns.Add(SourceSeqNum);

            return(columns.ToArray());
        }
        public virtual RequestBuilder BuildRequest(string root)
        {
#if netcore
            CultureInfo originalCulture = CultureInfo.CurrentCulture;
            CultureInfo.CurrentCulture = new CultureInfo("en-US");
#else
            CultureInfo originalCulture = System.Threading.Thread.CurrentThread.CurrentCulture;
            Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
#endif

            var builder = new RequestBuilder(root);
            builder.AddElement("settlement-date", SettlementDate.ToString("d"));

#if netcore
            CultureInfo.CurrentCulture = originalCulture;
#else
            Thread.CurrentThread.CurrentCulture = originalCulture;
#endif

            if (GroupByCustomField != null)
            {
                builder.AddElement("group-by-custom-field", GroupByCustomField);
            }
            return(builder);
        }
        public override int GetHashCode()
        {
            unchecked
            {
                var hash = 17;
                hash = hash * 29 + RequestId != null?RequestId.GetHashCode() : 0;

                hash = hash * 29 + Symbol.GetHashCode();
                hash = hash * 29 + ExchangeId.GetHashCode();
                hash = hash * 29 + SecurityType.GetHashCode();
                hash = hash * 29 + (Last.HasValue ? Last.GetHashCode() : 0);
                hash = hash * 29 + (TradeSize.HasValue ? TradeSize.GetHashCode() : 0);
                hash = hash * 29 + (TradedMarket.HasValue ? TradedMarket.GetHashCode() : 0);
                hash = hash * 29 + (TradeDate.HasValue ? TradeDate.GetHashCode() : 0);
                hash = hash * 29 + (TradeTime.HasValue ? TradeTime.GetHashCode() : 0);
                hash = hash * 29 + (Open.HasValue ? Open.GetHashCode() : 0);
                hash = hash * 29 + (High.HasValue ? High.GetHashCode() : 0);
                hash = hash * 29 + (Low.HasValue ? Low.GetHashCode() : 0);
                hash = hash * 29 + (Close.HasValue ? Close.GetHashCode() : 0);
                hash = hash * 29 + (Bid.HasValue ? Bid.GetHashCode() : 0);
                hash = hash * 29 + (BidMarket.HasValue ? BidMarket.GetHashCode() : 0);
                hash = hash * 29 + (BidSize.HasValue ? BidSize.GetHashCode() : 0);
                hash = hash * 29 + (Ask.HasValue ? Ask.GetHashCode() : 0);
                hash = hash * 29 + (AskMarket.HasValue ? AskMarket.GetHashCode() : 0);
                hash = hash * 29 + (AskSize.HasValue ? AskSize.GetHashCode() : 0);
                hash = hash * 29 + (Volume.HasValue ? Volume.GetHashCode() : 0);
                hash = hash * 29 + (PDayVolume.HasValue ? PDayVolume.GetHashCode() : 0);
                hash = hash * 29 + (UpVolume.HasValue ? UpVolume.GetHashCode() : 0);
                hash = hash * 29 + (DownVolume.HasValue ? DownVolume.GetHashCode() : 0);
                hash = hash * 29 + (NeutralVolume.HasValue ? NeutralVolume.GetHashCode() : 0);
                hash = hash * 29 + (TradeCount.HasValue ? TradeCount.GetHashCode() : 0);
                hash = hash * 29 + (UpTrades.HasValue ? UpTrades.GetHashCode() : 0);
                hash = hash * 29 + (DownTrades.HasValue ? DownTrades.GetHashCode() : 0);
                hash = hash * 29 + (NeutralTrades.HasValue ? NeutralTrades.GetHashCode() : 0);
                hash = hash * 29 + (VWAP.HasValue ? VWAP.GetHashCode() : 0);
                hash = hash * 29 + (MutualDiv.HasValue ? MutualDiv.GetHashCode() : 0);
                hash = hash * 29 + (SevenDayYield.HasValue ? SevenDayYield.GetHashCode() : 0);
                hash = hash * 29 + (OpenInterest.HasValue ? OpenInterest.GetHashCode() : 0);
                hash = hash * 29 + (Settlement.HasValue ? Settlement.GetHashCode() : 0);
                hash = hash * 29 + (SettlementDate.HasValue ? SettlementDate.GetHashCode() : 0);
                hash = hash * 29 + (ExpirationDate.HasValue ? ExpirationDate.GetHashCode() : 0);
                hash = hash * 29 + (Strike.HasValue ? Strike.GetHashCode() : 0);
                return(hash);
            }
        }
        public virtual RequestBuilder BuildRequest(String root)
        {
            CultureInfo originalCulture = Thread.CurrentThread.CurrentCulture;

            Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");

            var builder = new RequestBuilder(root);

            builder.AddElement("settlement-date", SettlementDate.ToShortDateString());

            Thread.CurrentThread.CurrentCulture = originalCulture;

            if (GroupByCustomField != null)
            {
                builder.AddElement("group-by-custom-field", GroupByCustomField);
            }
            return(builder);
        }
Beispiel #5
0
        public override void FillData(string data)
        {
            string[] tempContainer = data.Split('\n');
            string[] tempSplit;
            string   tempFinder       = string.Empty;
            string   tempSecurityName = string.Empty;
            string   tempMaturityDate = string.Empty;
            double   tempMultiplier   = 0;
            int      dateTimeIndex    = 0;
            DateTime tempContentDate;

            Texts = tempContainer.ToList();



            lookup.LoadLookUpTables();
            aqrIDLookUp.LoadLookUpTables();

            for (int i = 0; i < Texts.Count; i++)
            {
                if (DateTime.TryParse(Texts[i], out tempContentDate))
                {
                    dateTimeIndex = i > 0 ? i : 0;
                    ContentDate   = tempContentDate;
                    break;
                }
            }


            // COUNTERPARTY - HARDCODED FOR NOW
            CounterParty = "JPM";

            // FUND is the line after the letter date
            Fund = Texts[dateTimeIndex + 1];
            Fund = lookup.GetFundShortName(Fund);

            try
            {
                // CP REF
                tempFinder = Texts.Where(x => x.Contains(JPM_CPREF_REFERENCE)).FirstOrDefault();
                if (!string.IsNullOrEmpty(tempFinder))
                {
                    tempSplit = tempFinder.Split(':');
                    CPRef     = tempSplit.Last().Trim();
                }

                // FUND
                //tempFinder = Texts.Where(x => x.Contains(FUND_REFERENCE)).FirstOrDefault();
                //if (!string.IsNullOrEmpty(tempFinder))
                //{
                //    tempSplit = tempFinder.Split(':');
                //    Fund = tempSplit.Last();
                //}


                // TRANSACTION TYPE
                TransactionType = "Open"; // always open

                // SECURITY NAME
                // Dropdown (Index:   Swiss market Index) We determine the date based on the Valuation date which is also available in the General Terms under Valuation Date at the end of the paragraph, page 2.

                // TRADE DATE
                tempFinder = Texts.Where(x => x.Contains(JPM_TRADE_DATE_REFERENCE)).FirstOrDefault();
                if (!string.IsNullOrEmpty(tempFinder))
                {
                    tempSplit = tempFinder.Split(':');
                    TradeDate = DateTime.Parse(tempSplit.Last());
                }

                // SETTLEMENT DATE
                int daysToAdd = 0;
                SettlementDate = TradeDate;
                while (daysToAdd < 3)
                {
                    SettlementDate = SettlementDate.AddDays(1);
                    if (SettlementDate.DayOfWeek != DayOfWeek.Saturday && SettlementDate.DayOfWeek != DayOfWeek.Sunday)
                    {
                        daysToAdd++;
                    }
                }
                //SettlementDate = TradeDate.AddDays(3);
                //if (SettlementDate.DayOfWeek == DayOfWeek.Sunday || SettlementDate.DayOfWeek == DayOfWeek.Saturday)
                //{
                //    while (SettlementDate.DayOfWeek == DayOfWeek.Saturday || SettlementDate.DayOfWeek == DayOfWeek.Sunday)
                //    {
                //        SettlementDate = SettlementDate.AddDays(1);
                //    }
                //}

                // MATURITY DATE
                // Valuation date - at the end of the paragraph with this format : 19 December 2014


                // TERMINATION DATE
                tempFinder = Texts.Where(x => x.Contains(TERMINATION_DATE_REFERENCE)).FirstOrDefault();
                if (!string.IsNullOrEmpty(tempFinder))
                {
                    tempSplit = tempFinder.Split(':');
                    if (string.Compare(tempSplit.Last(), JPM_TERMINATION_DATE_CASH_SETTLEMENT_PAYMENT_DATE_REFERENCE) == 0)
                    {
                        MaturityDate = SettlementDate;
                    }
                    else
                    {
                        MaturityDate = DateTime.Parse(tempSplit.Last());
                    }
                }

                // MULTIPLIER
                tempFinder = Texts.Where(x => x.Contains(JPM_MULTIPLIER_REFERENCE)).FirstOrDefault();
                if (!string.IsNullOrEmpty(tempFinder))
                {
                    if (tempFinder.ToLower().Contains("deal"))
                    {
                        tempFinder = tempFinder.ToLower().Split(new string[] { "deal" }, StringSplitOptions.RemoveEmptyEntries).First();
                    }
                    tempSplit = tempFinder.Split(':');
                    double.TryParse(tempSplit.Last(), out tempMultiplier);
                    Multiplier = tempMultiplier;
                }
                //lookup.GetMultiplier(tempFund);

                // PRICE
                try
                {
                    tempFinder = Texts.Where(x => x.Contains(JPM_FORWARD_PRICE)).FirstOrDefault();
                    if (!string.IsNullOrEmpty(tempFinder))
                    {
                        tempSplit = tempFinder.Split(':');
                        string[] priceSplit = tempSplit[1].Split(' ');
                        string   price      = string.Empty;

                        if (!string.IsNullOrEmpty(priceSplit.First()))
                        {
                            price = priceSplit.First().Split(new string[] { "Deal" }, StringSplitOptions.RemoveEmptyEntries).First();
                        }
                        else
                        {
                            price = priceSplit[1].Split(new string[] { "Deal" }, StringSplitOptions.RemoveEmptyEntries).First();
                        }
                        Price = Double.Parse(price);
                    }
                    else
                    {
                        // Initial price
                        tempFinder = Texts.Where(x => x.Contains(JPM_HANGSENG_INITIAL_PRICE)).FirstOrDefault();
                        if (!string.IsNullOrEmpty(tempFinder))
                        {
                            tempSplit = tempFinder.Split(':');
                            string[] priceSplit = tempSplit[1].Split(' ');
                            //string price = string.Empty;

                            //if (!string.IsNullOrEmpty(priceSplit.First()))
                            //{
                            //    price = priceSplit.First().Split(new string[] { "Deal" }, StringSplitOptions.RemoveEmptyEntries).First();
                            //}
                            //else
                            //{
                            //    price = priceSplit[1].Split(new string[] { "Deal" }, StringSplitOptions.RemoveEmptyEntries).First();
                            //}
                            double price_temp = 0;
                            foreach (string tempPrice in priceSplit)
                            {
                                double.TryParse(tempPrice, out price_temp);
                                if (price_temp > 0)
                                {
                                    break;
                                }
                            }
                            Price = price_temp;
                            //Price = Double.Parse(price);
                        }
                    }
                }
                finally
                { }


                // LOCAL CURRENCY
                tempFinder = Texts.Where(x => x.Trim().Contains(JPM_SETTLEMENT_CURRENCY)).FirstOrDefault();
                if (!string.IsNullOrEmpty(tempFinder))
                {
                    //tempSplit = tempFinder.Split(new string[] { ": " }, StringSplitOptions.None);
                    //LocalCurrency = tempSplit.Last();
                    //if (LocalCurrency.Length > 3)
                    //{
                    //    tempSplit = LocalCurrency.Split(' ');
                    //    LocalCCY = tempSplit.First();
                    //}
                    tempSplit     = tempFinder.Split(':');
                    LocalCurrency = tempSplit.Last().Trim();
                    LocalCurrency = StripInvalidCharacters(LocalCurrency);

                    tempFinder = GetTextBaseOnReference(JPM_EQUITY_NOTIONAL_AMOUNT);
                    if (!string.IsNullOrEmpty(tempFinder))
                    {
                        tempSplit = tempFinder.Split(':');
                        if (tempSplit != null && tempSplit.Count() > 0)
                        {
                            string tempCurrency = tempSplit.Last();
                            tempSplit = tempCurrency.Split(' ');


                            if (tempSplit != null && tempSplit.Count() > 0)
                            {
                                tempCurrency = StripInvalidCharacters(tempSplit.First() != string.Empty ? tempSplit.First() : tempSplit[1]);

                                if (string.Compare(tempCurrency.ToLower(), LocalCurrency.ToLower()) != 0)
                                {
                                    LocalCurrency = tempCurrency;
                                }
                            }
                        }
                    }
                }

                // SELLER
                tempFinder = Texts.Where(x => x.Contains(JPM_SELLER)).FirstOrDefault();
                if (!string.IsNullOrEmpty(tempFinder))
                {
                    tempSplit = tempFinder.Split(':');
                    Seller    = tempSplit.Last().Trim();

                    // hard code for now
                    if (string.Compare(StripInvalidCharacters(Seller), "JPMorgan") == 0)
                    {
                        Seller = "JPM";
                    }
                    else if (string.Compare(StripInvalidCharacters(Seller), "Counterparty") == 0)
                    {
                        Seller = Fund;
                    }
                }
                else
                {
                    tempFinder = Texts.Where(x => x.Contains(JPM_EQUITY_AMOUNT_PAYER)).FirstOrDefault();
                    if (!string.IsNullOrEmpty(tempFinder))
                    {
                        tempSplit = tempFinder.Split(':');
                        Seller    = tempSplit.Last().Trim();
                        // hard code for now
                        if (string.Compare(StripInvalidCharacters(Seller), "JPMorgan") == 0)
                        {
                            Seller = "JPM";
                        }
                        else if (string.Compare(StripInvalidCharacters(Seller), "Counterparty") == 0)
                        {
                            Seller = Fund;
                        }
                    }
                }

                // BUYER
                // NOTE: Buyer is always the opposite of seller
                if (string.Compare(Seller, "JPM") == 0)
                {
                    Buyer = Fund;
                }
                else
                {
                    Buyer = "JPM";
                }

                // MATURITY DATE
                tempFinder = Texts.Where(x => x.Contains(JPM_VALUATION_DATE_EXPECTED_TO_BE)).FirstOrDefault();
                if (!string.IsNullOrEmpty(tempFinder))
                {
                    Regex    regex           = new Regex(@"\d{2}\s\w+\s\d{4}");
                    Match    match           = regex.Match(tempFinder);
                    DateTime tempPlaceHolder = DateTime.MinValue;

                    if (match.Success)
                    {
                        DateTime.TryParse(match.Value, out tempPlaceHolder);
                        if (tempPlaceHolder != DateTime.MinValue)
                        {
                            MaturityDate = tempPlaceHolder;
                        }
                    }
                }

                // SECURITY NAME
                tempFinder = Texts.Where(x => x.Replace(" ", "").Contains(JPM_SECURITY_NAME_REFERENCE)).FirstOrDefault();
                if (!string.IsNullOrEmpty(tempFinder))
                {
                    tempSplit        = tempFinder.Split(':');
                    tempSecurityName = tempSplit.Last();

                    if (!string.IsNullOrEmpty(tempSecurityName))
                    {
                        if (tempSecurityName.ToLower().Contains("hang seng"))
                        {
                            if (string.Compare(tempSecurityName.Trim(), "Hang Seng China Enterprises Index", true) == 0)
                            {
                                tempSecurityName = "HSCEI China Index";
                            }
                        }
                        else if (tempSecurityName.ToLower().Contains("taiex index"))
                        {
                            tempSecurityName = "TAIEX Futures Swap";
                        }

                        SecurityName = aqrIDLookUp.GetSecurityNameByMatch(tempSecurityName, MaturityDate);
                    }
                }

                // SECURITY TYPE
                SecurityType = aqrIDLookUp.GetSecurityType(SecurityName);

                // MULTIPLIER
                tempSecurityName = SecurityName.Split(' ').First();
                tempMultiplier   = lookup.GetMultiplier(tempSecurityName, SecurityType);
                if (tempMultiplier == 0)
                {
                }

                // QUANTIY
                tempFinder = Texts.Where(x => x.Contains(JPM_NUMBER_OF_UNITS)).FirstOrDefault();
                if (!string.IsNullOrEmpty(tempFinder))
                {
                    tempSplit     = tempFinder.Split(':');
                    NumberOfUnits = Double.Parse(tempSplit.Last());
                }

                if (NumberOfUnits > 0)
                {
                    Quantity = NumberOfUnits / tempMultiplier;
                }
                else
                {
                    Quantity = Multiplier / tempMultiplier;
                }

                // Multiplier
                Multiplier = tempMultiplier;

                // NOTIONAL
                Notional = Quantity * Price * Multiplier;

                // AQR ID
                AQRID = aqrIDLookUp.GetAQRID(SecurityName, SecurityType);

                //Always zero unless otherwise stated in the contract
                FixedRate = 0;
                //Always zero unless otherwise stated in the contract
                FloatRate = 0;
                //Always zero unless otherwise stated in the contract
                SettledCash     = 0;
                SettledCurrency = LocalCurrency;
                Spread          = 0;
                Status          = ConfirmsData.RunStatus.Success;
            }
            catch (Exception ex)
            {
                Status = ConfirmsData.RunStatus.Failed;
            }
        }
Beispiel #6
0
        public override void FillData(string data)
        {
            lookup.LoadLookUpTables();
            aqrIDLookUp.LoadLookUpTables();

            string[] tempContainer = data.Split('\n');
            string[] tempSplit;
            string   tempFinder       = string.Empty;
            string   tempSecurityName = string.Empty;
            string   tempMaturityDate = string.Empty;
            string   tempFund         = string.Empty;
            string   tempFixedPrice   = string.Empty;
            double   tempMultiplier   = 0;
            int      dateTimeIndex    = 0;
            DateTime tempContentDate;

            Texts = tempContainer.ToList();


            try
            {
                // Get the date reference
                tempFinder = GetTextBaseOnReference(ML_DATE);
                if (!string.IsNullOrEmpty(tempFinder))
                {
                    dateTimeIndex = Texts.IndexOf(tempFinder);

                    // FUND is the line after the letter date
                    while (string.IsNullOrEmpty(tempFund.Trim()))
                    {
                        tempFund = Texts[dateTimeIndex + 1];
                        dateTimeIndex++;
                    }
                    Fund = lookup.GetFundShortName(tempFund);
                }



                // TRADE ID / CP REF
                tempFinder = GetTextBaseOnReference(ML_TRADE_ID);
                if (!string.IsNullOrEmpty(tempFinder))
                {
                    tempSplit = tempFinder.Split(':');
                    regex     = new Regex(@"\d+");
                    Match match = regex.Match(tempSplit[1]);
                    if (match.Success)
                    {
                        CPRef = match.Value;
                    }
                }

                // TRANSACTION TYPE
                TransactionType = "Open";

                // SECURITY TYPE
                tempFinder = GetTextBaseOnReference(ML_COMMODITY);
                if (!string.IsNullOrEmpty(tempFinder))
                {
                    tempSplit        = tempFinder.Split(':');
                    tempSecurityName = tempSplit[1];

                    //if (string.Compare(tempSecurityName.Trim(), "SoyBean Meal", true) == 0)
                    if (tempSecurityName.Trim().Contains("SoyBean Meal"))
                    {
                        tempSecurityName = "Soy Meal";
                    }
                    else if (string.Compare(tempSecurityName.Trim(), ML_REFINED_PRODUCS) == 0)
                    {
                        tempFinder = GetTextBaseOnReference(ML_COMMODITY_REFERENCE_PRICE);
                        if (!string.IsNullOrEmpty(tempFinder))
                        {
                            tempSplit        = tempFinder.Split(':');
                            tempSecurityName = tempSplit.LastOrDefault();
                        }
                    }
                    KeyValuePair <string, string> kvp = lookup.GetSecurityValues(tempSecurityName);

                    tempSecurityName = kvp.Key;
                    SecurityType     = kvp.Value;
                }

                // MATURITY DATE
                tempFinder = GetTextBaseOnReference(ML_EXPIRY_DATE);
                if (string.IsNullOrEmpty(tempFinder))
                {
                    tempFinder = GetTextBaseOnReference(ML_TERMINIATION_DATE);
                }
                if (!string.IsNullOrEmpty(tempFinder))
                {
                    tempSplit = tempFinder.Split(':');
                    string dateToParse = tempSplit[1];

                    if (string.IsNullOrEmpty(dateToParse))
                    {
                        int dateIndex = Texts.IndexOf(tempFinder) + 2;
                        dateToParse = Texts[dateIndex];
                    }
                    DateTime tempPlaceHolder = DateTime.MinValue;
                    DateTime.TryParse(dateToParse, out tempPlaceHolder);

                    MaturityDate = tempPlaceHolder;
                }

                // SECURITY NAME

                // Special condition for Natural Gas
                if (string.Compare(tempSecurityName, "Natural Gas", true) == 0)
                {
                    //SecurityName = aqrIDLookUp.GetSecurityNameByMatch(tempSecurityName, MaturityDate);
                    SecurityName = aqrIDLookUp.GetSecurityNameByMonth(tempSecurityName, MaturityDate);

                    if (!string.IsNullOrEmpty(SecurityName))
                    {
                        MaturityDate = aqrIDLookUp.GetMaturityDateBySecurityName(SecurityName);
                    }
                }
                else
                {
                    // search using alias first
                    SecurityName = aqrIDLookUp.GetSecurityNameByAlias(SecurityType, tempSecurityName, MaturityDate);
                    //SecurityName =  aqrIDLookUp.GetSecurityName(SecurityType, MaturityDate);

                    if (string.IsNullOrEmpty(SecurityName))
                    {
                        SecurityName = aqrIDLookUp.GetSecurityNameByMatch(tempSecurityName, SecurityType, MaturityDate);
                    }
                }
                // AQR ID
                AQRID = aqrIDLookUp.GetAQRID(SecurityName, SecurityType);

                // MULTIPLIER
                Multiplier = lookup.GetMultiplier(tempSecurityName);

                if (Multiplier == 0)
                {
                    Multiplier = lookup.GetMultiplier(SecurityName);
                }

                // TRADE DATE
                tempFinder = GetTextBaseOnReference(ML_TRADE_DATE);
                if (!string.IsNullOrEmpty(tempFinder))
                {
                    tempSplit = tempFinder.Split(':');
                    DateTime tempPlaceHolder = DateTime.MinValue;
                    DateTime.TryParse(tempSplit[1], out tempPlaceHolder);

                    TradeDate = tempPlaceHolder;
                }

                // SETTLEMENT DATE
                int daysToAdd = 0;
                SettlementDate = TradeDate;
                while (daysToAdd < 3)
                {
                    SettlementDate = SettlementDate.AddDays(1);
                    if (SettlementDate.DayOfWeek != DayOfWeek.Saturday && SettlementDate.DayOfWeek != DayOfWeek.Sunday)
                    {
                        daysToAdd++;
                    }
                }

                // QUANTITY
                tempFinder = GetTextBaseOnReference(ML_TOTAL_NOTIONAL_QTY);
                if (string.IsNullOrEmpty(tempFinder))
                {
                    tempFinder = GetTextBaseOnReference(ML_VOLUME);
                }
                if (!string.IsNullOrEmpty(tempFinder))
                {
                    tempSplit = tempFinder.Split(':');
                    regex     = new Regex(@"\d+");

                    Match match = regex.Match(StripInvalidCharacters(tempSplit[1]));
                    if (match.Success)
                    {
                        Quantity = Convert.ToDouble(match.Value);
                        Quantity = Quantity / Multiplier;
                    }
                }

                // PRICE
                tempFinder = GetTextBaseOnReference(ML_FIXED_PRICE);
                if (!string.IsNullOrEmpty(tempFinder))
                {
                    tempSplit = tempFinder.Split(':');
                    Char[] tempChar = tempSplit[1].ToCharArray().Where(c => Char.IsDigit(c) || Char.IsPunctuation(c)).ToArray();
                    // temporary hard code unwanted characters to be removed
                    List <char> tempCharList = tempChar.ToList();
                    tempCharList.Remove('(');
                    tempCharList.Remove(')');

                    Price = Convert.ToDouble(new string(tempCharList.ToArray()));

                    if (lookup.SelectedIndex > -1)
                    {
                        string note = lookup.GetNote(lookup.SelectedIndex);
                        if (!string.IsNullOrEmpty(note) && string.Compare(note, ML_MOVE_2_DECIMAL_RIGHT) == 0)
                        {
                            Price = Price * 100;
                        }
                    }

                    // for local ccy
                    tempFixedPrice = tempSplit[1];
                }

                // LOCAL CCY
                tempFinder = GetTextBaseOnReference(ML_TRANSACTION_CURRENCY);
                if (!string.IsNullOrEmpty(tempFinder))
                {
                    tempSplit     = tempFinder.Split(':');
                    LocalCurrency = tempSplit.LastOrDefault();
                }
                else if (!string.IsNullOrEmpty(tempFixedPrice))
                {
                    tempSplit     = tempFixedPrice.TrimStart(' ').Split(' ');
                    LocalCurrency = tempSplit.FirstOrDefault();
                }

                // NOTIONAL
                Notional = Quantity * Price * Multiplier;

                // BUYER
                tempFinder = GetTextBaseOnReference(ML_FIXED_PRICE_PAYOR);
                if (string.IsNullOrEmpty(tempFinder))
                {
                    tempFinder = GetTextBaseOnReference(ML_FIXED_PRICE_PAYER);
                }

                if (!string.IsNullOrEmpty(tempFinder))
                {
                    string tempBuyer = string.Empty;

                    tempSplit = tempFinder.Split(':');
                    tempBuyer = tempSplit.LastOrDefault();

                    if (string.Compare(tempBuyer, tempFund, true) == 0 || StripInvalidCharacters(tempFund).Contains(StripInvalidCharacters(tempBuyer)))
                    {
                        Buyer = Fund;
                    }
                    else
                    {
                        Buyer = "ML";
                    }
                }

                // SELLER
                tempFinder = GetTextBaseOnReference(ML_FLOATNG_PRICE_PAYOR);
                if (string.IsNullOrEmpty(tempFinder))
                {
                    tempFinder = GetTextBaseOnReference(ML_FLOATNG_PRICE_PAYER);
                }
                if (!string.IsNullOrEmpty(tempFinder))
                {
                    tempSplit = tempFinder.Split(':');
                    Seller    = tempSplit.LastOrDefault();
                    if (string.Compare(Seller.Trim(), ML_LONG_NAME, true) == 0)
                    {
                        Seller = "ML";
                    }
                    else
                    {
                        Seller = Fund;
                    }
                }

                FixedRate       = 0;
                FloatRate       = 0;
                SettledCash     = 0;
                SettledCurrency = LocalCurrency;
                Spread          = 0;

                CounterParty = "ML";
                Status       = RunStatus.Success;
            }
            catch (Exception ex)
            {
                Status = RunStatus.Failed;
                CoreLibrary.Logger.Instance.Error(this.GetType(), "Error in parsing document " + CPRef + Environment.NewLine + ex.Message);
            }
        }