My problem is how to built an algorithm for this framework. Here, different from the lecture, there are two more endogenous states, once q_d depends also to the FOC constraints. The idea is to built a toy model for the selective default framework. We assume fully discrimination of creditors from the government.

Thatâ€™s a tough one. I would have to see all the equations, and even then maybe spend a bit more time trying to nut it out than I actually have available :-).

Is the idea that the govt will initially borrow from domestic lenders, up to the point where it becomes cheaper to borrow from overseas? (Risk averse domestic lenders demand higher returns as government debt increases?)

Iâ€™m not really an expert in this area. Do you have any thoughts @cc7768?

The first idea is that both borrowing markets are available in the first period, with standard default costs for each jurisdiction: exclusion from the respective borrowing market and output costs. The idea is that, for each case of default (selectively or not), the stream of output is affected, i.e., yË†j < y, where j={domestic default, foreign default, total default} and y the output for the repayment case. So far, I am not considering the situation that the government initially borrow from domestic lenders and later from international ones. The markets work simultaneously, at least in the first period. But your point is valid, it should work for the algorithm that I am intended to built.

In the future the goal is to include inflation in the model, assuming domestic bonds as nominal, but for the toy model, letâ€™s first keep it simple.

My problem here is more related to the algorithm itself. In the lecture, it was simpler to guess the pricing function, since it only depends to the exogenous risk-free rate. In my adaptation, since we have one more bond (domestic) depending from the FOCs, until now I could not think in a solution.

Iâ€™m a bit in the same boat as John â€“ My bandwidth is quite limited right now so this isnâ€™t as detailed of a response as I wish I could give.

I havenâ€™t worked with one of these models in awhile, but, if I remember correctly, I think the way that others have dealt with multiple assets in this type of a framework is basically to guess a price (function) for one asset then guess the price (function) for the other asset and iterate on the second price (function) given a guess for the first. You can then hypothetically iterate on both prices (functions).

A paper that uses multiple assets in an Arellano-esque sovereign debt framework (that you may already be familiar withâ€¦) is Arellano Ramanarayanan 2010 (see, https://www.dallasfed.org/-/media/documents/institute/wpapers/2008/0019.pdf). In their model itâ€™s short-term and long-term debt but maybe a similar algorithm could work? I donâ€™t remember if they prove that this procedure converges to a particular equilibrium â€“ It may be more of a â€ścross your fingers and pray to the Python gods that your algorithm finds an equilibriumâ€ť approach (which, in many cases, I have no objections to). Their algorithm may be a useful starting point for your own algorithm.