Skip to content

Commit

Permalink
Small fix and updated documentation from running on OSX (#1)
Browse files Browse the repository at this point in the history
* Made code run on Unix systems.  Removed Windows-specific directory slash.

* Updated README.md for my experience installing on OSX

* Added file describing my install experience on OSX
  • Loading branch information
mdnahas authored and as4456 committed Jul 30, 2017
1 parent 5077c8f commit 4d21882
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 6 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ All the yield curve data files (i.e A_Country_All_Data_Bloomberg.xlsm) for the r
For initial reproduction of results, sample data files (i.e A_Country_All_Data_Bloomberg.xls) for the respective countries have been provided till November 2015.

Instructions for generating the results
1. Generation of Yield curve data: data_read.py script generates the spliced yield curve dataset (Govt. data spliced with the OIS data after a specific date) for a respective country (Line 61 in the code) in monthly, weekly and daily csv formats.
2. Generation of Shadow rate and other results: AAA_RUN_KANSM2_Est_LB.py script generates the results in a csv format as in the “Comparison of international monetary policy measures” for a respective country (Line 27) in the desired frequency (Line 28).
0. Install pip (E.g., on Unix run "sudo easy_install pip")
1. Install libraries. (E.g. run "pip install openpyxl")
2. Run "python data\_read.py" This generates yield curve data. The script generates the spliced yield curve dataset (Govt. data spliced with the OIS data after a specific date) for a respective country (Line 61 in the code) in monthly, weekly and daily csv formats.
3. Run "python AAA\_RUN\_KANSM2\_Est\_LB.py" This generates the shadow rate and other results. The script generates the results in a csv format as in the “Comparison of international monetary policy measures” for a respective country (Line 27) in the desired frequency (Line 28).
Please Note: Currently the code uses given parameters (FinalNaturalParameters_Country.dat) but you have the option (Line 23) of estimating it from the whole dataset, although the code running time becomes slower and needs to be optimized further.
8 changes: 4 additions & 4 deletions data_read.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ def filter_data(a,index,dim):

Country='UK'# US, EA, JP, UK.
CurveType='OIS'
PathName=os.getcwd()+'\\'
ExcelName=PathName+'A_'+Country+'_All_Data_Bloomberg.xlsx'
PathName=os.getcwd()
ExcelName=os.path.join(PathName, 'A_'+Country+'_All_Data_Bloomberg.xlsx')
if CurveType is 'OIS':
ExcelSheetName='D. Live OIS data'
if CurveType is 'Govt':
Expand Down Expand Up @@ -140,7 +140,7 @@ def filter_data(a,index,dim):

#GOVT
if Country is 'EA':
wbG=openpyxl.load_workbook(PathName+'A_GE_All_Data_Bloomberg.xlsx')
wbG=openpyxl.load_workbook(os.path.join(PathName, 'A_GE_All_Data_Bloomberg.xlsx'))
sheet=wbG.get_sheet_by_name('D. Live Govt data')
datenumG = [[] for i in range(len(datelist))]
values_dataG=[[] for i in range(len(datelist))]
Expand Down Expand Up @@ -182,7 +182,7 @@ def filter_data(a,index,dim):
post_euro_ge_index=filter_data(common_datenumG,index_to_del,1)
post_euro_ge_vlues=filter_data(values_dataG,index_to_del,len(values_dataG))

wbF=openpyxl.load_workbook(PathName+'A_FR_All_Data_Bloomberg.xlsx')
wbF=openpyxl.load_workbook(os.path.join(PathName, 'A_FR_All_Data_Bloomberg.xlsx'))
sheet=wbG.get_sheet_by_name('D. Live Govt data')
datenumF = [[] for i in range(len(datelist))]
values_dataF=[[] for i in range(len(datelist))]
Expand Down
35 changes: 35 additions & 0 deletions install_log__OSX__2017_Jun_20.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# This is the log of the commands run by Michael Nahas
# when I installed on 2017 Jun 19.
# on OSX 10.10.5 Yosemite

# May need pip. Installed in /usr/local/bin/pip
# sudo easy_install pip

# Tried to run this. It hit an exception, so I skipped it.
#pip install --upgrade pip

# needed library
# I added --user flag when I had permissions error.
pip install openpyxl

# Had to remove Windows-specific directory slash \\ so that it worked on Unix.
python data_read.py

# That command created these files:
# UK_Daily.csv
# UK_Monthly. csv
# UK_Weekly.csv

python ./AAA_RUN_KANSM2_Est_LB.py

# That command opened a number of graphs
# It created files:
# EMS_Monthly.jpg
# ETZ_Monthly.jpg
# SSR_Monthly.jpg
# UK_GSW_Govt_rL_Est_30.000000_KANSM2_Monthly_IEKF_E-5.000000_Final_2017_06_19_15_59_39_final.csv
# plot.pdf

# Seemed to only run the UK data, not all countries.
#
# Unfortunately, ran out of time to play with the code right now. Leaving this here.

0 comments on commit 4d21882

Please sign in to comment.