コード例 #1
0
        public static Quarter Create(string ticker, uint fiscalYear, uint fiscalQuarter, PropertyDictionary properties, PropertyDescriptionDictionary descriptions)
        {
            JpTickerValidator.Validate(ticker);
            var period = FiscalQuarterPeriod.Create(fiscalYear, fiscalQuarter);

            return(new Quarter(ticker, period, properties, descriptions));
        }
        public void GetHashCodeTest()
        {
            var hashCode = FiscalQuarterPeriod.Create(2018, 1).GetHashCode();

            Assert.AreEqual((2018, 1).GetHashCode(), hashCode);
            Assert.AreNotEqual((2018, 2).GetHashCode(), hashCode);
        }
コード例 #3
0
        public void GetQuarterTest()
        {
            var client    = new BuffettCodeApiV2Client(mockApiCore);
            var parameter = TickerQuarterParameter.Create("6501", FiscalQuarterPeriod.Create(2019, 4));

            Assert.IsNotNull(client.GetQuarter(parameter, false, true, false));
        }
        public void CreateTest()
        {
            var ticker        = "1234";
            var latestQuarter = FiscalQuarterPeriod.Create(2020, 2);

            // latest
            Assert.AreEqual(TickerDayParameter.Create(ticker, LatestDayPeriod.GetInstance()), TickerPeriodParameterCreator.Create(ticker, "latest", null));

            // day
            Assert.AreEqual(TickerDayParameter.Create(ticker,
                                                      DayPeriod.Create(2020, 1, 1)), TickerPeriodParameterCreator.Create(ticker, "2020-01-01", null));


            // LYLQ
            Assert.AreEqual(TickerQuarterParameter.Create(ticker, RelativeFiscalQuarterPeriod.Create(0, 0)), TickerPeriodParameterCreator.Create(ticker, "LYLQ", null));

            Assert.AreEqual(TickerQuarterParameter.Create(ticker, RelativeFiscalQuarterPeriod.Create(1, 0)), TickerPeriodParameterCreator.Create(ticker, "LY-1LQ", null));
            Assert.AreEqual(TickerQuarterParameter.Create(ticker, RelativeFiscalQuarterPeriod.Create(0, 2)), TickerPeriodParameterCreator.Create(ticker, "LYLQ-2", null));
            Assert.AreEqual(TickerQuarterParameter.Create(ticker, RelativeFiscalQuarterPeriod.Create(1, 2)), TickerPeriodParameterCreator.Create(ticker, "LY-1LQ-2", null));

            // Quarter
            Assert.AreEqual(TickerQuarterParameter.Create(ticker, FiscalQuarterPeriod.Create(2020, 1)), TickerPeriodParameterCreator.Create(ticker, "2020Q1", null));
            Assert.AreEqual(TickerQuarterParameter.Create(ticker, "2019", "LQ-1", FiscalQuarterPeriod.Create(2019, 1)), TickerPeriodParameterCreator.Create(ticker, "2019LQ-1", latestQuarter));
            Assert.AreEqual(TickerQuarterParameter.Create(ticker, "2019", "LQ-2", FiscalQuarterPeriod.Create(2018, 4)), TickerPeriodParameterCreator.Create(ticker, "2019LQ-2", latestQuarter));
            Assert.AreEqual(TickerQuarterParameter.Create(ticker, "LY-2", "4", FiscalQuarterPeriod.Create(2018, 4)), TickerPeriodParameterCreator.Create(ticker, "LY-2Q4", latestQuarter));

            // others
            Assert.ThrowsException <ValidationError>(() => TickerPeriodParameterCreator.Create(ticker, "dummy", null));
        }
 public void BeforeTest()
 {
     Assert.AreEqual(FiscalQuarterPeriod.Create(2020, 3), FiscalQuarterPeriod.Create(2021, 1).Before(0, 2));
     Assert.AreEqual(FiscalQuarterPeriod.Create(2020, 3), FiscalQuarterPeriod.Create(2022, 3).Before(1, 4));
     Assert.AreEqual(FiscalQuarterPeriod.Create(2020, 2), FiscalQuarterPeriod.Create(2022, 3).Before(1, 5));
     Assert.AreEqual(FiscalQuarterPeriod.Create(2020, 1), FiscalQuarterPeriod.Create(2021, 3).Before(1, 2));
     Assert.AreEqual(FiscalQuarterPeriod.Create(2020, 1), FiscalQuarterPeriod.Create(2021, 3).Before(0, 6));
 }
        public void GetPeriodTest()
        {
            var ticker = "1234";
            var period = FiscalQuarterPeriod.Create(2020, 1);

            Assert.AreEqual(period, TickerQuarterParameter.Create(ticker, period).GetPeriod());
            Assert.AreEqual(period, TickerQuarterParameter.Create(ticker, "LY", "LQ", period).GetPeriod());
        }
コード例 #7
0
        public void GetQuarterRangeTest()
        {
            var client    = new BuffettCodeApiV2Client(mockApiCore);
            var from      = FiscalQuarterPeriod.Create(2019, 4);
            var to        = FiscalQuarterPeriod.Create(2019, 4);
            var parameter = TickerPeriodRangeParameter.Create("6501", from, to);

            Assert.IsNotNull(client.GetQuarterRange(parameter, false, false));
        }
コード例 #8
0
        public void GetRangeTest()
        {
            var client = new BuffettCodeApiV2Client(mockApiCore);
            var ticker = "2345";
            var day    = DayPeriod.Create(2021, 2, 1);
            var fyFq   = FiscalQuarterPeriod.Create(2019, 4);

            Assert.IsNotNull(client.GetRange(DataTypeConfig.Quarter, TickerPeriodRangeParameter.Create(ticker, fyFq, fyFq), false, true, false));
            Assert.ThrowsException <NotSupportedDataTypeException>(() => client.GetRange(DataTypeConfig.Daily, TickerPeriodRangeParameter.Create(ticker, day, day), false, true, false));
        }
コード例 #9
0
        public void FixedTierRengeLengthTest()
        {
            var from  = FiscalQuarterPeriod.Create(2020, 1);
            var to    = FiscalQuarterPeriod.Create(2021, 2);
            var range = PeriodRange <FiscalQuarterPeriod> .Create(from, to);

            var supportedTierRange = new SupportedTierRange <FiscalQuarterPeriod>(range, null);

            Assert.AreEqual((uint)5, supportedTierRange.FixedTierRengeLength());
        }
コード例 #10
0
        public void CreateForFiscalQuarterPeriodTest()
        {
            var from    = FiscalQuarterPeriod.Create(2020, 1);
            var to      = FiscalQuarterPeriod.Create(2020, 2);
            var fqRange = PeriodRange <FiscalQuarterPeriod> .Create(from, to);

            Assert.AreEqual(from, fqRange.From);
            Assert.AreEqual(to, fqRange.To);
            Assert.ThrowsException <ValidationError>(() => PeriodRange <FiscalQuarterPeriod> .Create(to, from));
        }
コード例 #11
0
        public void ToApiV2ParametersTest()
        {
            var ticker    = "1234";
            var from      = FiscalQuarterPeriod.Create(2020, 1);
            var to        = FiscalQuarterPeriod.Create(2020, 2);
            var parameter = TickerPeriodRangeParameter.Create(ticker, from, to).ToApiV2Parameters();

            Assert.AreEqual(ticker, parameter["tickers"]);
            Assert.AreEqual(from.ToString(), parameter["from"]);
            Assert.AreEqual(to.ToString(), parameter["to"]);
        }
        public void GetGapFiscalQuarterPeriodTest()
        {
            var fq2020Q1 = FiscalQuarterPeriod.Create(2020, 1);
            var fq2020Q2 = FiscalQuarterPeriod.Create(2020, 2);
            var fq2021Q1 = FiscalQuarterPeriod.Create(2021, 1);
            var fq2021Q4 = FiscalQuarterPeriod.Create(2021, 4);

            Assert.AreEqual(0, ComparablePeriodUtil.GetGap(fq2020Q1, fq2020Q1));
            Assert.AreEqual(1, ComparablePeriodUtil.GetGap(fq2020Q1, fq2020Q2));
            Assert.AreEqual(4, ComparablePeriodUtil.GetGap(fq2020Q1, fq2021Q1));
            Assert.AreEqual(7, ComparablePeriodUtil.GetGap(fq2020Q1, fq2021Q4));
        }
        public void EqualsTest()
        {
            var a = FiscalQuarterPeriod.Create(2018, 1);
            var b = FiscalQuarterPeriod.Create("2018", "1");
            var c = FiscalQuarterPeriod.Create(2018, 2);

            Assert.IsTrue(a.Equals(b));
            Assert.IsTrue(b.Equals(a));
            Assert.IsFalse(a.Equals(c));
            Assert.IsFalse(b.Equals(c));
            Assert.IsFalse(a.Equals(null));
        }
コード例 #14
0
 public static ITickerPeriodParameter Create(string ticker, string periodParam, FiscalQuarterPeriod latestFiscalQuarterPeriod)
 {
     if (periodParam.Equals("latest"))
     {
         return(TickerDayParameter.Create(ticker, LatestDayPeriod.GetInstance()));
     }
     else if (PeriodRegularExpressionConfig.DayRegex.IsMatch(periodParam))
     {
         return(TickerDayParameter.Create(ticker, DayPeriod.Parse(periodParam)));
     }
     else if (PeriodRegularExpressionConfig.FiscalQuarterRegex.IsMatch(periodParam))
     {
         var period = FiscalQuarterPeriod.Parse(periodParam);
         return(TickerQuarterParameter.Create(ticker, period));
     }
     else if (PeriodRegularExpressionConfig.RelativeFiscalQuarterRegex.IsMatch(periodParam))
     {
         var period = RelativeFiscalQuarterPeriod.Parse(periodParam);
         return(TickerQuarterParameter.Create(ticker, period));
     }
     else if (PeriodRegularExpressionConfig.BCodeUdfFiscalQuarterInputRegex.IsMatch(periodParam))
     {
         var match = PeriodRegularExpressionConfig.BCodeUdfFiscalQuarterInputRegex
                     .Match(periodParam);
         var fy = match.Groups["fiscalYear"].Value.Trim();
         var fq = match.Groups["fiscalQuarter"].Value.Trim();
         if (fy.Contains("LY"))
         {
             var prevYears = RelativeFiscalQuarterPeriod.ParseRelativeValue("years", match);
             if (prevYears > latestFiscalQuarterPeriod.Year)
             {
                 throw new ValidationError($"{prevYears} is bigger than {latestFiscalQuarterPeriod.Year}");
             }
             var fiscalQuarter = fq.Replace("Q", "");
             var period        = FiscalQuarterPeriod.Create(latestFiscalQuarterPeriod.Year - prevYears, uint.Parse(fiscalQuarter));
             return(TickerQuarterParameter.Create(ticker, fy, fiscalQuarter, period));
         }
         else if (fq.Contains("LQ"))
         {
             var prevQuarters = RelativeFiscalQuarterPeriod.ParseRelativeValue("quarters", match);
             var period       = FiscalQuarterPeriod.Create(uint.Parse(fy), latestFiscalQuarterPeriod.Quarter).Before(0, prevQuarters);
             return(TickerQuarterParameter.Create(ticker, fy, fq, period));
         }
         else
         {
             throw new ValidationError($"{periodParam} is not supported input format");
         }
     }
     else
     {
         throw new ValidationError($"{periodParam} is not supported input format");
     }
 }
コード例 #15
0
        public void IncludesTest()
        {
            var from  = FiscalQuarterPeriod.Create(2020, 1);
            var to    = FiscalQuarterPeriod.Create(2020, 3);
            var range = PeriodRange <FiscalQuarterPeriod> .Create(from, to);

            Assert.IsTrue(range.Includes(from));
            Assert.IsTrue(range.Includes(FiscalQuarterPeriod.Create(2020, 2)));
            Assert.IsTrue(range.Includes(to));
            Assert.IsFalse(range.Includes(FiscalQuarterPeriod.Create(2020, 4)));
            Assert.IsFalse(range.Includes(FiscalQuarterPeriod.Create(2019, 4)));
        }
コード例 #16
0
        public void GetHashCodeTest()
        {
            var a = CreateQuarter(ticker, period, properties, descriptions);
            var b = CreateQuarter(ticker, period, properties, descriptions);
            var c = CreateQuarter(ticker, period, null, null);
            var d = CreateQuarter("2345", period, properties, descriptions);
            var e = CreateQuarter(ticker, FiscalQuarterPeriod.Create(2000, 1), properties, descriptions);

            Assert.AreEqual(a, b);
            Assert.AreNotEqual(a, c);
            Assert.AreNotEqual(a, d);
            Assert.AreNotEqual(a, e);
        }
コード例 #17
0
        public void GetTest()
        {
            var ticker = "2345";
            var client = new BuffettCodeApiV2Client(mockApiCore);
            var day    = TickerDayParameter.Create(ticker, DayPeriod.Create(2021, 2, 1));
            var fyFq   = TickerQuarterParameter.Create(ticker, FiscalQuarterPeriod.Create(2019, 4));
            var empty  = TickerEmptyPeriodParameter.Create(ticker, Snapshot.GetInstance());

            Assert.IsNotNull(client.Get(DataTypeConfig.Indicator, empty, false, true, false));
            Assert.IsNotNull(client.Get(DataTypeConfig.Quarter, fyFq, false, true, false));
            Assert.IsNotNull(client.Get(DataTypeConfig.Company, empty, false, true, false));
            Assert.ThrowsException <NotSupportedDataTypeException>(() => client.Get(DataTypeConfig.Daily, day, false, true, false));
        }
        public void GetGapTest()
        {
            // quarter
            var fq2020Q1 = FiscalQuarterPeriod.Create(2020, 1);
            var fq2020Q2 = FiscalQuarterPeriod.Create(2020, 2);

            Assert.AreEqual(1, ComparablePeriodUtil.GetGap(fq2020Q1, (IPeriod)fq2020Q2));

            // day
            var day20200101 = DayPeriod.Create(2020, 1, 1);
            var day20200102 = DayPeriod.Create(2020, 1, 2);

            Assert.AreEqual(1, ComparablePeriodUtil.GetGap(day20200101, (IPeriod)day20200102));
        }
コード例 #19
0
        public void SortByPeriodTest()
        {
            var a = CreateQuarter(ticker, FiscalQuarterPeriod.Create(2021, 3), null, null);
            var b = CreateQuarter(ticker, FiscalQuarterPeriod.Create(2021, 4), null, null);
            var c = CreateQuarter(ticker, FiscalQuarterPeriod.Create(2018, 1), null, null);

            var list = new List <Quarter> {
                a, b, c
            };
            var sorted = list.OrderBy(q => q.Period).ToList();

            Assert.AreEqual(FiscalQuarterPeriod.Create(2018, 1), sorted[0].Period);
            Assert.AreEqual(FiscalQuarterPeriod.Create(2021, 3), sorted[1].Period);
            Assert.AreEqual(FiscalQuarterPeriod.Create(2021, 4), sorted[2].Period);
        }
コード例 #20
0
        public void TotalGapTest()
        {
            // quarter
            var fromFqp = FiscalQuarterPeriod.Create(2020, 1);
            var toFqp   = FiscalQuarterPeriod.Create(2021, 2);

            Assert.AreEqual((uint)5, PeriodRange <FiscalQuarterPeriod> .Create(fromFqp, toFqp).TotalGap());


            // day
            var fromDay = DayPeriod.Create(2016, 1, 1);
            var toDay   = DayPeriod.Create(2016, 2, 1);

            Assert.AreEqual((uint)31, PeriodRange <DayPeriod> .Create(fromDay, toDay).TotalGap());
        }
        public void SortTest()
        {
            var a = FiscalQuarterPeriod.Create(2018, 2);
            var b = FiscalQuarterPeriod.Create(2019, 1);
            var c = FiscalQuarterPeriod.Create("2017", "1");
            var d = FiscalQuarterPeriod.Create(2018, 3);
            var sorted = new List <FiscalQuarterPeriod> {
                a, b, c, d
            }.OrderBy(_ => _).ToArray();

            Assert.AreEqual(c, sorted[0]);
            Assert.AreEqual(a, sorted[1]);
            Assert.AreEqual(d, sorted[2]);
            Assert.AreEqual(b, sorted[3]);
        }
        public void CompareToTest()
        {
            var a = FiscalQuarterPeriod.Create(2018, 2);
            var b = FiscalQuarterPeriod.Create(2019, 1);
            var c = FiscalQuarterPeriod.Create("2017", "1");
            var d = FiscalQuarterPeriod.Create(2018, 2);

            Assert.AreEqual(-1, a.CompareTo(b));
            Assert.AreEqual(1, a.CompareTo(c));
            Assert.AreEqual(0, a.CompareTo(d));
            Assert.AreEqual(1, b.CompareTo(c));
            Assert.AreEqual(1, b.CompareTo(d));
            // null given
            Assert.ThrowsException <ArgumentNullException>(() => a.CompareTo(null));
        }
        public void ToApiV2ParametersTest()
        {
            var ticker     = "1234";
            var parameter1 = TickerQuarterParameter.Create(ticker, FiscalQuarterPeriod.Create(2020, 1)).ToApiV2Parameters();

            Assert.AreEqual(ticker, parameter1["ticker"]);
            Assert.AreEqual("2020", parameter1["fy"]);
            Assert.AreEqual("1", parameter1["fq"]);

            var parameter2 = TickerQuarterParameter.Create(ticker, "LY", "LQ", FiscalQuarterPeriod.Create(2020, 1)).ToApiV2Parameters();

            Assert.AreEqual(ticker, parameter1["ticker"]);
            Assert.AreEqual("LY", parameter2["fy"]);
            Assert.AreEqual("LQ", parameter2["fq"]);
        }
コード例 #24
0
        public static FixedTierRange Parse(IEnumerable <JProperty> jProperties)
        {
            try
            {
                var properties    = jProperties.ToDictionary(p => p.Name, p => p.Value.ToString());
                var oldestQuarter = FiscalQuarterPeriod.Create(properties[PropertyNames.OldestFiscalYear].ToString(), properties[PropertyNames.OldestFiscalQuarter].ToString());
                var latestQuarter = FiscalQuarterPeriod.Create(properties[PropertyNames.LatestFiscalYear], properties[PropertyNames.LatestFiscalQuarter]);
                var oldestDate    = DayPeriod.Create(DateTime.Parse(properties[PropertyNames.OldestDate]));

                return(new FixedTierRange(oldestQuarter, latestQuarter, oldestDate));
            }
            catch (Exception e)
            {
                throw new ApiResponseParserException($"parse {PropertyNames.FixedTierRange} failed", e);
            }
        }
コード例 #25
0
        public void SliceFiscalQuarterTest()
        {
            var from         = FiscalQuarterPeriod.Create(2016, 1);
            var to           = FiscalQuarterPeriod.Create(2020, 4);
            var quarterRange = PeriodRange <FiscalQuarterPeriod> .Create(from, to);

            // size = 1
            var chunks = PeriodRange <FiscalQuarterPeriod> .Slice(quarterRange, 1).ToArray();

            Assert.AreEqual(20, chunks.Length);
            Assert.AreEqual(from, chunks[0].From);
            Assert.AreEqual(from, chunks[0].To);
            Assert.AreEqual(from.Next(), chunks[1].From);
            Assert.AreEqual(to, chunks[19].From);
            Assert.AreEqual(to, chunks[19].To);
            for (uint i = 0; i < chunks.Length; i++)
            {
                Assert.AreEqual(0, ComparablePeriodUtil.GetGap(chunks[i].From, chunks[i].To));
            }

            // size = 2
            chunks = PeriodRange <FiscalQuarterPeriod> .Slice(quarterRange, 2).ToArray();

            Assert.AreEqual(10, chunks.Length);
            Assert.AreEqual(from, chunks[0].From);
            Assert.AreEqual(from.Next(), chunks[0].To);
            Assert.AreEqual(from.Next().Next(), chunks[1].From);
            Assert.AreEqual(to, chunks[9].To);
            for (uint i = 0; i < chunks.Length; i++)
            {
                Assert.AreEqual(1, ComparablePeriodUtil.GetGap(chunks[i].From, chunks[i].To));
            }

            // size = 3
            chunks = PeriodRange <FiscalQuarterPeriod> .Slice(quarterRange, 3).ToArray();

            Assert.AreEqual(7, chunks.Length);
            Assert.AreEqual(from, chunks[0].From);
            Assert.AreEqual(from.Next().Next(), chunks[0].To);
            Assert.AreEqual(from.Next().Next().Next(), chunks[1].From);
            Assert.AreEqual(to, chunks[6].To);
            for (uint i = 0; i < chunks.Length - 1; i++)
            {
                Assert.AreEqual(2, ComparablePeriodUtil.GetGap(chunks[i].From, chunks[i].To));
            }
            Assert.AreEqual(1, ComparablePeriodUtil.GetGap(chunks.Last().From, chunks.Last().To));
        }
        public void GetQuartersTest()
        {
            var ticker         = "6501";
            var from           = FiscalQuarterPeriod.Create(2020, 1);
            var to             = FiscalQuarterPeriod.Create(2020, 2);
            var outputSettings = CsvDownloadOutputSettings.Create(TabularOutputEncoding.SJIS, TabularOutputDestination.NewWorksheet);
            var parameters     = CsvDownloadParameters.Create(ticker, from, to, outputSettings);
            var quarters       = ApiResourceGetter.Create().GetQuarters(parameters).ToArray();
            var quarter2020Q1  = quarters[0];
            var quarter2020Q2  = quarters[1];

            Assert.AreEqual(2, quarters.Length);
            Assert.AreEqual(ticker, quarter2020Q1.Ticker);
            Assert.AreEqual(ticker, quarter2020Q2.Ticker);
            Assert.AreEqual(from, quarter2020Q1.Period);
            Assert.AreEqual(to, quarter2020Q2.Period);
        }
コード例 #27
0
        public void SaveAndLoadTest()
        {
            var ticker         = "1234";
            var from           = FiscalQuarterPeriod.Create(2021, 1);
            var to             = FiscalQuarterPeriod.Create(2022, 1);
            var outputSettings = CsvDownloadOutputSettings.Create(TabularOutputEncoding.SJIS, TabularOutputDestination.NewWorksheet);
            var newParams      = CsvDownloadParameters.Create(ticker, from, to, outputSettings);

            CsvDownloadDefaultParametersHandler.Save(newParams);
            var loaded = CsvDownloadDefaultParametersHandler.Load();

            Assert.AreEqual(ticker, loaded.Ticker);
            Assert.AreEqual(from, loaded.Range.From);
            Assert.AreEqual(to, loaded.Range.To);
            Assert.AreEqual(TabularOutputEncoding.SJIS, loaded.OutputSettings.Encoding);
            Assert.AreEqual(TabularOutputDestination.NewWorksheet
                            , loaded.OutputSettings.Destination);
        }
        public void ParseBulkQuarter()
        {
            var json     = ApiGetResponseBodyParser.Parse(File.ReadAllText(@"TestData\ApiV3BulkQuarter.json"));
            var quarters = parser.ParseRange(DataTypeConfig.Quarter, json);

            Assert.AreEqual(4, quarters.Count);
            // check ticker, fy, fq
            Assert.AreEqual("6501", ((Quarter)quarters[0]).Ticker);
            Assert.AreEqual(FiscalQuarterPeriod.Create(2020, 1), quarters[0].GetPeriod());
            Assert.AreEqual("6501", ((Quarter)quarters[1]).Ticker);
            Assert.AreEqual(FiscalQuarterPeriod.Create(2020, 2), quarters[1].GetPeriod());
            Assert.AreEqual("6501", ((Quarter)quarters[2]).Ticker);
            Assert.AreEqual(FiscalQuarterPeriod.Create(2020, 3), quarters[2].GetPeriod());
            Assert.AreEqual("6501", ((Quarter)quarters[3]).Ticker);
            Assert.AreEqual(FiscalQuarterPeriod.Create(2020, 4), quarters[3].GetPeriod());

            // check value
            Assert.AreEqual(quarters[0].GetDescription("ceo_name").JpName, "代表者名");
            Assert.AreEqual(quarters[0].GetDescription("employee_num").Unit, "人");
            Assert.AreEqual(quarters[0].GetValue("company_name"), "株式会社日立製作所");
        }
        public void CreateGetQuarterRequestTest()
        {
            var  ticker        = "6591";
            uint fiscalYear    = 2019;
            uint fiscalQuarter = 3;
            var  parameter     = TickerQuarterParameter.Create(ticker, FiscalQuarterPeriod.Create(fiscalYear, fiscalQuarter));

            // use ondemand
            var request = BuffettCodeApiV3RequestCreator.CreateGetQuarterRequest(parameter, true);

            Assert.AreEqual(request.EndPoint, BuffettCodeApiV3Config.ENDPOINT_ONDEMAND_QUARTER);
            Assert.AreEqual(ticker, request.Parameters["ticker"]);
            Assert.AreEqual(fiscalYear.ToString(), request.Parameters["fy"]);
            Assert.AreEqual(fiscalQuarter.ToString(), request.Parameters["fq"]);

            // not use ondemand
            request = BuffettCodeApiV3RequestCreator.CreateGetQuarterRequest(parameter, false);
            Assert.AreEqual(request.EndPoint, BuffettCodeApiV3Config.ENDPOINT_QUARTER);
            Assert.AreEqual(ticker, request.Parameters["ticker"]);
            Assert.AreEqual(fiscalYear.ToString(), request.Parameters["fy"]);
            Assert.AreEqual(fiscalQuarter.ToString(), request.Parameters["fq"]);
        }
        public void EqualsTest()
        {
            var a = TickerQuarterParameter.Create("1234", FiscalQuarterPeriod.Create(2020, 1));
            var b = TickerQuarterParameter.Create("1234", FiscalQuarterPeriod.Parse("2020Q1"));
            var c = TickerQuarterParameter.Create("2345", FiscalQuarterPeriod.Create(2020, 1));
            var d = TickerQuarterParameter.Create("1234", FiscalQuarterPeriod.Create(2020, 2));
            var e = TickerQuarterParameter.Create("1234", RelativeFiscalQuarterPeriod.Create(1, 2));
            var f = TickerQuarterParameter.Create("1234", RelativeFiscalQuarterPeriod.Create(1, 2));
            var g = TickerQuarterParameter.Create("1234", RelativeFiscalQuarterPeriod.Create(1, 3));
            var i = TickerQuarterParameter.Create("2345", RelativeFiscalQuarterPeriod.Create(1, 2));
            var j = TickerQuarterParameter.Create("2345", "2019", "LQ-2", RelativeFiscalQuarterPeriod.Create(1, 2));

            Assert.AreEqual(a, b);
            Assert.AreNotEqual(a, c);
            Assert.AreNotEqual(a, d);
            Assert.AreNotEqual(a, e);
            Assert.AreEqual(e, f);
            Assert.AreNotEqual(e, g);
            Assert.AreNotEqual(e, i);
            Assert.AreNotEqual(e, g);
            Assert.AreNotEqual(e, j);
        }