So I have a problem I need to solve and no idea how to approach it.
Its a verbal problem without any specific numbers given except for those below. So it is up to me to determine how to structure the problem and solve it.
In a nutshell the goal is that I need a way to find the optimal mix of sources of liquidity that minimize interest expense but also adheres to the restrictions below.
I know its not much to go on but maybe this example will help understand the problem.
Ex. Say I have a time series of future cash flows for the next 120 days. Some days are positive cash in the bank and other days I go negative. I don't want to go negative as the interest of overdrawing the bank account is 4% so I can borrow money from the following sources of liquidity cheaper than I can from overdrawing the bank account.
Source 1: 1.5% for any amount of $ but has a 30 day maturity
Source 2: 0.8% for up to $250 mil from 1 day up to 270 days maturity
Source 3: Libor rate + spread (ex. 1.25%) for any amount of $ but has a 90 day maturity
Restriction 1: Cannot have more than $250 mil maturing on any single day
Restriction 2: Cannot borrow more than 3 times a week from any single source
With that said this problem is clearly a time series. I can solve this easily for any single day. But for a 120 days of cashflows and with the restrictions on # of borrowings per week and amount of $ maturing per day are making me pull my hair out.
I can take future cash needs into account, find the days that will be negative and borrow the $ needed to stay above $0 without caring much about minimizing interest expense. But how do I borrow money such that I minimize interest expense in the long run by using a mixture of the 3 sources listed above and also keep track of the 2 restrictions listed above and also any funding needs to repay the amounts borrowed in the future.
Any ideas on how I can tackle such a problem?
I have python experience so I can code an algorithm if needed but don't know how to start. I'm thinking of doing some sort of a random walk algorithm and try and brute force a solution over thousands of iterations and settling on a random solution that results in the least interest expense over said iterations but that sounds computationally expensive. There must be a mathematical way of modelling this right?