예제 #1
0
        public string GetAQRID(string securityName, string securityType)
        {
            string aqrID = string.Empty;

            securityName = StripInvalidCharacters(securityName);

            if (!string.IsNullOrEmpty(securityName) && !string.IsNullOrEmpty(securityType))
            {
                AQRIDLookUpData lookup = aqrIDLookups.Where(x => string.Compare(securityName, StripInvalidCharacters(x.SecurityName)) == 0 && string.Compare(securityType, x.SecurityType) == 0).FirstOrDefault();

                if (lookup != null)
                {
                    aqrID = lookup.AQRID;
                }
                else
                {
                    securityName = securityName.Replace("Future", "Futures");
                    lookup       = aqrIDLookups.Where(x => string.Compare(securityName, StripInvalidCharacters(x.SecurityName)) == 0 && string.Compare(securityType, x.SecurityType) == 0).FirstOrDefault();

                    if (lookup != null)
                    {
                        aqrID = lookup.AQRID;
                    }
                }
            }

            return(aqrID);
        }
예제 #2
0
        private AQRIDLookUpData GetMatchingAccountByNameAndSecurityType(string securityName, string securityType)
        {
            AQRIDLookUpData lookup = null;

            lookup = aqrIDLookups.Where(x => string.Compare(x.SecurityType, securityType, true) == 0 && IsNameMatchByAlgorithm(x.SecurityName, securityName)).FirstOrDefault();
            return(lookup);
        }
예제 #3
0
        public string GetAQRID(string securityName)
        {
            string aqrID = string.Empty;

            if (!string.IsNullOrEmpty(securityName))
            {
                AQRIDLookUpData lookup = aqrIDLookups.Where(x => string.Compare(securityName, x.SecurityName) == 0).FirstOrDefault();
                if (lookup != null)
                {
                    aqrID = lookup.AQRID;
                }
            }

            return(aqrID);
        }
예제 #4
0
        public DateTime GetMaturityDateBySecurityName(string securityName)
        {
            DateTime maturityDate = DateTime.MinValue;

            if (!string.IsNullOrEmpty(securityName))
            {
                AQRIDLookUpData lookup = aqrIDLookups.Where(x => string.Compare(securityName, x.SecurityName, true) == 0).FirstOrDefault();
                if (lookup != null)
                {
                    maturityDate = lookup.MaturityDate;
                }
            }

            return(maturityDate);
        }
예제 #5
0
        public string GetSecurityNameByType(string securityType)
        {
            string securityName = string.Empty;

            if (!string.IsNullOrEmpty(securityType))
            {
                AQRIDLookUpData lookup = aqrIDLookups.Where(x => string.Compare(securityType, x.SecurityType) == 0).FirstOrDefault();
                if (lookup != null)
                {
                    securityName = lookup.SecurityName;
                }
            }

            return(securityName);
        }
예제 #6
0
        public string GetSecurityName(string securityType, DateTime maturityDate)
        {
            string securityName = string.Empty;

            if (!string.IsNullOrEmpty(securityType) && maturityDate > DateTime.MinValue)
            {
                AQRIDLookUpData lookup = aqrIDLookups.Where(x => string.Compare(StripInvalidCharacters(securityType), StripInvalidCharacters(x.SecurityType)) == 0 && x.MaturityDate == maturityDate).FirstOrDefault();
                if (lookup != null)
                {
                    securityName  = lookup.SecurityName;
                    selectedIndex = aqrIDLookups.IndexOf(lookup);
                }
            }

            return(securityName);
        }
예제 #7
0
        public string GetSecurityNameByMatch(string securityAlias, DateTime maturityDate)
        {
            string foundName = string.Empty;

            if (!string.IsNullOrEmpty(securityAlias))
            {
                AQRIDLookUpData        matchedLookup  = null;
                List <AQRIDLookUpData> matchedLookups = aqrIDLookups.Where(x => StripInvalidCharacters(x.SecurityName.ToLower()).Contains(StripInvalidCharacters(securityAlias.ToLower()))).ToList();

                if (matchedLookups != null && matchedLookups.Count > 0)
                {
                    matchedLookup = matchedLookups.OrderBy(x => (maturityDate - x.MaturityDate).Duration()).First();
                    foundName     = matchedLookup.SecurityName;
                }
            }

            return(foundName);
        }