FinanceRoutines.jl (2656B)
1 module FinanceRoutines 2 3 4 # -------------------------------------------------------------------------------------------------- 5 import BazerData: tlag 6 import CSV 7 import DataFrames: AbstractDataFrame, AsTable, DataFrame, DataFrameRow, ByRow, combine, groupby, ncol, nrow, 8 passmissing, Not, rename!, select, select!, subset, subset!, transform!, leftjoin, unique, disallowmissing! 9 import DataPipes: @p 10 import Dates: Dates, Date, Day, Month, year 11 import Decimals: Decimal 12 import Downloads 13 import FlexiJoins 14 using FlexiJoins: by_key, by_pred 15 import GLM: coef, lm 16 import IntervalSets:(..) 17 import LibPQ: LibPQ.execute, LibPQ.Connection 18 import LinearAlgebra: qr 19 import Missings: Missings, missing, disallowmissing 20 import PeriodicalDates: MonthlyDate 21 import Roots 22 import Statistics: mean 23 import Tables: columntable 24 import WeakRefStrings: String3, String7, String15 25 import ZipFile 26 # import ZipFile: ZipFile.Reader 27 28 # -------------------------------------------------------------------------------------------------- 29 30 31 # -------------------------------------------------------------------------------------------------- 32 # Import functions 33 include("Utilities.jl") 34 include("betas.jl") 35 include("ImportFamaFrench.jl") 36 include("GSW.jl") 37 include("BondPricing.jl") 38 include("ImportCRSP.jl") 39 include("ImportComp.jl") 40 include("Merge_CRSP_Comp.jl") 41 include("PortfolioUtils.jl") 42 include("Diagnostics.jl") 43 include("EventStudy.jl") 44 # -------------------------------------------------------------------------------------------------- 45 46 47 # -------------------------------------------------------------------------------------------------- 48 # List of exported functions 49 50 # Yields on Treasuries 51 export import_gsw_parameters # basic data import function 52 export GSWParameters # the GSW type of yield curve calculations 53 export gsw_yield, gsw_price, gsw_forward_rate, gsw_yield_curve, gsw_price_curve, 54 gsw_return, gsw_excess_return 55 56 # Fama-French data 57 export import_FF3, import_FF5, import_FF_momentum 58 59 # WRDS 60 # -- CRSP 61 export import_MSF, import_MSF_v2 # import Monthly Stock File 62 export import_DSF, import_DSF_v2 # import Daily Stock File 63 export build_MSF, build_MSF! # clean Monthly Stock File 64 # -- Funda 65 export import_Funda 66 export build_Funda!, build_Funda 67 # -- Link 68 export import_ccm_link 69 export link_Funda 70 export link_MSF 71 72 # More practical functions 73 export calculate_rolling_betas 74 export calculate_portfolio_returns 75 export diagnose 76 export event_study 77 # -------------------------------------------------------------------------------------------------- 78 79 80 # -------------------------------------------------------------------------------------------------- 81 end