Companies A and B have been offered the following rates per annum on a $20 million 5-year loan:
Fixed Rate
Floating Rate
Company A
5%
SOFR+0.1%
Company B
6.4%
SOFR+0.6%
Company A requires a floating-rate loan; company B requires a fixed-rate loan. Design a swap that will net a bank, acting as intermediary, 0.1% per annum and that will appear equally attractive to both companies.
Bank gain: 0.1%
A: floating rate loan
B: fixed rate loan
Let be:
Known parameters:
\(r_{f_{A}}\): the fixed interest rate of a loan for Company A;
\(s_{A}\): the spread of credit in floating rate for company A;
\(s_B\): the spread of credit in floating rate for company B;
\(G_{bank}\): Bank profit
\(G_A\): Company A profit
\(G_B\): Company B profit
Variables:
\(r_{f_{Bk-A}}\): the fixed interest rate the bank agrees to pay to company A;
\(s_{A-Bk}\) the spread of credit company A gives to the bank on floating rate;
\(r_{f_{B-Bk}}\): the fixed interest rate company B pays to the bank;
\(s_{Bk-B}\): the spread of credit the bank pays to company B on floating rate;
Companies X and Y have been offered the following rates per annum on a $5 million 10-year investment:
Fixed Rate
Floating Rate
Company X
8.0%
LIBOR
Company Y
8.8%
LIBOR
Company X requires a fixed-rate investment; company Y requires a floating-rate investment. Design a swap that will net a bank, acting as intermediary, 0.2% per annum and will appear equally attractive to X and Y.
Company X wishes to borrow U.S. dollars at a fixed rate of interest. Company Y wishes to borrow Japanese yen at a fixed rate of interest. The amounts required by the two companies are roughly the same at the current exchange rate. The companies have been quoted the following interest rates, which have been adjusted for the impact of taxes:
Yen
Dollars
Company X
5.0%
9.6%
Company Y
6.5%
10.0%
Design a swap that will net a bank, acting as intermediary, 50 basis points per annum. Make the swap equally attractive to the two companies and ensure that all foreign exchange risk is assumed by the bank.
Bank gain: 0.5%
X: fixed rate loan in dollars
Y: fixed rate loan in yen
Equal gain for X and Y: ((6.5-5)-(10-9.6)-0.5)/2=0.3%
Finding solutions
class VarArraySolutionPrinter(cp_model.CpSolverSolutionCallback):"""Print intermediate solutions."""def__init__(self, variables, max_dec_digits): cp_model.CpSolverSolutionCallback.__init__(self)self.__variables = variablesself.max_dec_digits = max_dec_digitsself.__solution_count =0self.solutions = []def on_solution_callback(self):self.__solution_count +=1# for v in self.__variables:# print(f"{v}={self.Value(v)/self.max_dec_digits:.2f}", end=" ")# print()self.solutions.append({v.Name(): self.Value(v)/self.max_dec_digits for v inself.__variables})@propertydef solution_count(self):returnself.__solution_countdef search_for_all_solutions_sample_sat( rfDollar_A, rfDollar_B, rfYen_A, rfYen_B, G_B, G_A, G_bank):"""Showcases calling the solver to search for all solutions."""# Creates the model. model = cp_model.CpModel() max_dec_digits =10**max([len(x) for x in [str(rate).split(".")[-1] for rate in [rfDollar_A, rfDollar_B, rfYen_A, rfYen_B]]]) rates_upper_bound =int(max_dec_digits*max(rfDollar_A, rfDollar_B, rfYen_A, rfYen_B))# Define the variables r_f_Dollar_A_Bk = model.NewIntVar(0, rates_upper_bound, 'r_f_Dollar_A_Bk') r_f_Yen_Bk_A = model.NewIntVar(0, rates_upper_bound, 'r_f_Yen_Bk_A') r_f_Dollar_Bk_B = model.NewIntVar(0, rates_upper_bound, 'r_f_Dollar_Bk_B') r_f_Yen_B_Bk = model.NewIntVar(0, rates_upper_bound, 'r_f_Yen_B_Bk') # Define the constraints model.Add(int(max_dec_digits*(rfDollar_B)) - r_f_Dollar_Bk_B - r_f_Yen_B_Bk+int(max_dec_digits*rfYen_B) ==int(max_dec_digits*G_B)) model.Add(int(max_dec_digits*rfDollar_A) - r_f_Dollar_A_Bk -int(max_dec_digits*(rfYen_A))+ r_f_Yen_Bk_A==int(max_dec_digits*G_A)) model.Add(r_f_Dollar_A_Bk - r_f_Dollar_Bk_B + r_f_Yen_B_Bk - r_f_Yen_Bk_A ==int(max_dec_digits*G_bank)) model.Add(r_f_Dollar_Bk_B >= r_f_Dollar_A_Bk) model.Add(r_f_Yen_Bk_A <= r_f_Yen_B_Bk) model.Add(r_f_Dollar_A_Bk <=int(max_dec_digits*rfDollar_A)) model.Add(r_f_Dollar_Bk_B <=int(max_dec_digits*rfDollar_B)) model.Add(r_f_Yen_B_Bk <=int(max_dec_digits*rfYen_B)) model.Add(r_f_Yen_Bk_A <=int(max_dec_digits*rfYen_A)) solver = cp_model.CpSolver() solution_printer = VarArraySolutionPrinter([r_f_Dollar_A_Bk, r_f_Yen_Bk_A, r_f_Dollar_Bk_B, r_f_Yen_B_Bk], max_dec_digits)# Enumerate all solutions. solver.parameters.enumerate_all_solutions =True# Solve. status = solver.Solve(model, solution_printer)print(f"Status = {solver.StatusName(status)}")print(f"Number of solutions found: {solution_printer.solution_count}")return solution_printer.solutionssolutions = search_for_all_solutions_sample_sat(9.6, 10, 5, 6.5, 0.3, 0.3, 0.5)