Part 1: Julia Coding Test
Instructions: Please write two Julia functions to complete the two questions listed below.
These questions are commonly encountered in the operations of the CRI Validation Team.
You are required to finish these two functions in two days (48 hours). We think it is sufficient
for a Julia beginner. Please send back your original Julia code in .jl file.
Question 1:
Assume there are some daily folders like below under D:\. Each folder contains the PD
(probability of default) data for different companies on the corresponding date. For example,
under 20200923_cali_20200910, the mat file starting with “pd_” contains the PD data on
20200923. Please read PD data from 20200901 to 20200924. For each trading day in this
period, find all the companies whose PD changes by more than 5% from the previous
trading day. Save the company id, current Date, current PD, previous Date, benchmark
PD, percentage PD change into a csv file named “PD_extreme_change_yyymmdd.csv”
into the corresponding folder. We assume that all the daily folders have the same folder
structure.
Below is the PD variable in pd_xx.mat, the columns’ headers are company id, year, month,
day, and PD respectively. Read all the files beginning with “pd_” under the corresponding
A sample mat file is attached in the email.
Output CSV file should be like below format:
Useful functions (not all the listed functions should be used, just for reference):
readir(find all files under specific path),
glob(find the file with specific format),
matread(read mat file),
CSV.write(save to csv file)
The sample data we offer contains two folders each with 2 PD files, but your function needs to
be able to read all the daily folders beginning with “202009” and all the PD files under the
corresponding folder.
Question 2:
Please write a Julia function named value_Comparison.
The aim is to compare two excel worksheets that contain both numeric numbers and strings.
The result should be empty if the two arrays are identical. Otherwise, it will return a dictionary
containing the information of the rows only appearing in 1st CSV and rows only appearing in
2nd CSV, and the columns containing different values.
Use CreditEvents_202201.xlsx as a sample input.