public async Task DFII10_Test()
    {
        //
        // FAILS - runs out of threads
        //
        string             symbol       = "DFII10";
        DateTime           endDate      = new DateTime(2020, 12, 31);
        List <Vintage>     vintageDates = (await FredClient.GetVintageDates(symbol, null)).Where(x => x.VintageDate <= endDate).ToList();
        List <Observation> sparse       = (await FredClient.GetObservations(symbol, vintageDates.Select(x => x.VintageDate).ToList()))
                                          .Where(x => x.ObsDate <= endDate).ToList();

        Assert.AreEqual(1662, vintageDates.Count);
        Assert.AreEqual(4503, sparse.Count);

        // Group sparse observations into vintages
        var vintages = sparse.GroupBy(x => x.VintageDate).ToList();

        Assert.AreEqual(1662, vintages.Count);

        // Make sure we did not wind up with more vintage dates than was in our original list of vintage dates.
        var missingInVintageDates = vintages.Where(v => !vintageDates.Any(vd => vd.VintageDate == v.Key)).ToList();

        Assert.AreEqual(0, missingInVintageDates.Count);

        // Make sure every date in the original list is included in the output
        var missingInVintages = vintageDates.Where(vd => !vintages.Any(v => v.Key == vd.VintageDate)).ToList();

        Assert.AreEqual(0, missingInVintages.Count);
    }
Exemple #2
0
    public async Task GetObservationsTest2()
    {
        List <Observation> data = await FredClient.GetObservations("GNPCA", new DateTime(2020, 1, 1), new DateTime(2020, 12, 31));

        Assert.IsNotNull(data);

        data = await FredClient.GetObservations(DOES_NOT_EXIST, new DateTime(2020, 1, 1), new DateTime(2020, 12, 31));

        Assert.IsNull(data);
    }
Exemple #3
0
    public async Task GetObservationsTest()
    {
        List <Observation> data = await FredClient.GetObservations("GNPCA");

        Assert.IsNotNull(data);

        data = await FredClient.GetObservations(DOES_NOT_EXIST);

        Assert.IsNull(data);
    }
    public async Task ObservationTest()
    {
        Observation data = (await FredClient.GetObservations("GNPCA")).FirstOrDefault();

        Assert.IsNotNull(data);
        Assert.IsFalse(String.IsNullOrEmpty(data.Symbol));
        Assert.IsFalse(String.IsNullOrEmpty(data.Value));
        Assert.AreNotEqual(DateTime.MinValue, data.ObsDate);
        Assert.AreNotEqual(DateTime.MinValue, data.VintageDate);
    }
    public async Task NROU_Test()
    {
        string             symbol   = "NROU";
        DateTime           endDate  = new DateTime(2021, 3, 6);
        List <Vintage>     vintages = (await FredClient.GetVintageDates(symbol, null)).Where(x => x.VintageDate <= endDate).ToList();
        List <Observation> obs      = (await FredClient.GetObservations(symbol, vintages.Select(x => x.VintageDate).ToList()))
                                      .Where(x => x.ObsDate <= endDate).ToList();

        Assert.AreEqual(18, vintages.Count);
        Assert.AreEqual(2205, obs.Count);
    }
    public async Task CPIAUCSL_Test()
    {
        string             symbol       = "CPIAUCSL";
        DateTime           endDate      = new DateTime(2021, 3, 6);
        List <Vintage>     vintageDates = (await FredClient.GetVintageDates(symbol, null)).Where(x => x.VintageDate <= endDate).ToList();
        List <Observation> sparse       = (await FredClient.GetObservations(symbol, vintageDates.Select(x => x.VintageDate).ToList()))
                                          .Where(x => x.ObsDate <= endDate).ToList();

        Assert.AreEqual(600, vintageDates.Count);
        Assert.AreEqual(2737, sparse.Count);

        // Group sparse observations into vintages
        var vintages = sparse.GroupBy(x => x.VintageDate).ToList();

        // Make sure we did not wind up with more vintage dates than was in our original list of vintage dates.
        var missingInVintageDates = vintages.Where(v => !vintageDates.Any(vd => vd.VintageDate == v.Key)).ToList();

        // Make sure every date in the original list is included in the output
        var missingInVintages = vintageDates.Where(vd => !vintages.Any(v => v.Key == vd.VintageDate)).ToList();
    }
Exemple #7
0
    public async Task GetObservationsTest3()
    {
        List <DateTime> vintateDates = new List <DateTime>(10)
        {
            new DateTime(2020, 1, 1),
            new DateTime(2020, 1, 1),
            new DateTime(2020, 1, 1),
            new DateTime(2020, 1, 1),
            new DateTime(2020, 1, 1),
            new DateTime(2020, 1, 1),
            new DateTime(2020, 1, 1),
            new DateTime(2020, 1, 1),
            new DateTime(2020, 1, 1),
            new DateTime(2020, 1, 1)
        };
        List <Observation> data = await FredClient.GetObservations("GNPCA", vintateDates);

        Assert.IsNotNull(data);

        data = await FredClient.GetObservations(DOES_NOT_EXIST, vintateDates);

        Assert.IsNull(data);
    }