FinanceRoutines.jl

Financial data routines for Julia
Log | Files | Refs | README | LICENSE

FF5.jl (1210B)


      1 @testset "Importing Fama-French 5 factors and Momentum" begin
      2 
      3     import Dates
      4 
      5     # FF5 monthly
      6     df_FF5_monthly = import_FF5(frequency=:monthly)
      7     @test names(df_FF5_monthly) == ["datem", "mktrf", "smb", "hml", "rmw", "cma", "rf"]
      8     @test nrow(df_FF5_monthly) >= (Dates.year(Dates.today()) - 1963 - 1) * 12
      9 
     10     # FF5 annual
     11     df_FF5_annual = import_FF5(frequency=:annual)
     12     @test names(df_FF5_annual) == ["datey", "mktrf", "smb", "hml", "rmw", "cma", "rf"]
     13     @test nrow(df_FF5_annual) >= Dates.year(Dates.today()) - 1963 - 2
     14 
     15     # FF5 daily
     16     df_FF5_daily = import_FF5(frequency=:daily)
     17     @test names(df_FF5_daily) == ["date", "mktrf", "smb", "hml", "rmw", "cma", "rf"]
     18     @test nrow(df_FF5_daily) >= 15_000
     19 
     20     # Momentum monthly
     21     df_mom_monthly = import_FF_momentum(frequency=:monthly)
     22     @test "mom" in names(df_mom_monthly)
     23     @test nrow(df_mom_monthly) > 1000
     24 
     25     # Momentum annual
     26     df_mom_annual = import_FF_momentum(frequency=:annual)
     27     @test "mom" in names(df_mom_annual)
     28     @test nrow(df_mom_annual) > 90
     29 
     30     # Momentum daily
     31     df_mom_daily = import_FF_momentum(frequency=:daily)
     32     @test "mom" in names(df_mom_daily)
     33     @test nrow(df_mom_daily) > 24_000
     34 
     35 end