コード例 #1
0
ファイル: SsqTests.cs プロジェクト: LelandGrunt/FFE
        public void SsqXPathTest(Parser parser, Provider provider)
        {
            Ssq ssq = new Ssq(provider.Url.OriginalString,
                              xPath: provider.XPath,
                              parser: parser,
                              stockIdentifierPlaceholder: provider.StockIdentifierPlaceholder,
                              locale: provider.Locale,
                              udfName: provider.UdfName);
            object actual = ssq.Q(provider.IsinTickerWkn);

            Assert.IsType <decimal>(actual);
        }
コード例 #2
0
ファイル: SsqTests.cs プロジェクト: LelandGrunt/FFE
        public void SsqRegExTest(Parser parser, Provider provider)
        {
            Ssq ssq = new Ssq(provider.Url.OriginalString,
                              regExPattern: provider.RegExPattern,
                              regExGroupName: provider.RegExGroupName,
                              regExMatchIndex: provider.RegExMatchIndex,
                              parser: parser,
                              stockIdentifierPlaceholder: provider.StockIdentifierPlaceholder,
                              locale: provider.Locale,
                              udfName: provider.UdfName);
            object actual = ssq.Q(provider.IsinTickerWkn);

            Assert.IsType <decimal>(actual);
        }
コード例 #3
0
ファイル: SsqDelegate.cs プロジェクト: LelandGrunt/FFE
        public static IEnumerable <SsqExcelFunction> GetSsqExcelFunctions(SsqJson ssqJson)
        {
            List <SsqExcelFunction> ssqExcelFunctions = null;

            try
            {
                ssqExcelFunctions = new List <SsqExcelFunction>();

                foreach (KeyValuePair <string, UserDefinedFunction> udf in GetUserDefinedFunctions(ssqJson))
                {
                    UserDefinedFunction userDefinedFunction = udf.Value;
                    QueryInformation    queryInformation    = userDefinedFunction.QueryInformation;
                    QueryParameter      queryParameter      = userDefinedFunction.QueryParameter;

                    Delegate excelFunction = new Func <string, object>(wkn_isin_ticker =>
                    {
                        object value;

                        try
                        {
                            Ssq ssq = new Ssq(queryParameter,
                                              udf.Key);

                            value = ssq.TryQ(wkn_isin_ticker);
                        }
                        catch (Exception ex)
                        {
                            log.Error(ex.Message);
                            return(ExcelError.ExcelErrorGettingData);
                        }

                        return(value);
                    });

                    ExcelFunctionAttribute excelFunctionAttribute = new ExcelFunctionAttribute
                    {
                        Name        = queryInformation.Name,
                        Description = queryInformation.Description + "\n" +
                                      "Author: " + queryInformation.Author + " (" + queryInformation.AuthorEmail + ")\n" +
                                      "Version " + queryInformation.Version + " of " + queryInformation.VersionDate + ", Provider: " + queryInformation.Provider,
                        Category     = "FFE",
                        IsThreadSafe = true,
                        HelpTopic    = !String.IsNullOrEmpty(queryInformation.HelpTopic) ? queryInformation.HelpTopic : null
                    };

                    ExcelArgumentAttribute excelArgumentAttribute = new ExcelArgumentAttribute {
                        Name = queryInformation.ExcelArgNameStockIdentifier, Description = queryInformation.ExcelArgDescStockIdentifier
                    };

                    ssqExcelFunctions.Add(new SsqExcelFunction(queryInformation.Name, excelFunction, excelFunctionAttribute, excelArgumentAttribute));

                    log.Debug("Created SSQ Excel function: {@SsqExcelFunction}", queryInformation.Name);
                }
            }
            catch (Exception ex)
            {
                log.Error("Exception while creating SSQ Excel functions. {@ExceptionMessage}", ex.Message);

                throw;
            }

            return(ssqExcelFunctions);
        }
コード例 #4
0
        public void SSQ_JEQ_Test_Attribute_XPath_RegEx(string isin)
        {
            object actual = new Ssq(typeof(SsqWebClientTests)).TryQ(isin);

            Assert.IsType <decimal>(actual);
        }
コード例 #5
0
ファイル: SsqHttpClientTests.cs プロジェクト: LelandGrunt/FFE
        public void SSQ_JEQ_Test_Attribute_RegEx(string isin)
        {
            object actual = new Ssq(typeof(SsqAngleSharpTests)).TryQ(isin);

            Assert.IsType <decimal>(actual);
        }
コード例 #6
0
ファイル: SsqTests.cs プロジェクト: LelandGrunt/FFE
        public void SsqAttributeXPathRegExTest(string isin)
        {
            object actual = new Ssq(typeof(SsqTests)).Q(isin);

            Assert.IsType <decimal>(actual);
        }