Feedback on Learning Materials

A few months ago I built some jupyter notebooks that demonstrated building a bond valuation simulation in 3 parts then aggregating the 3 parts into a final version incorporating the 3. I run a website called FinanceAndPython.com where I publish free courses for users to learn both finance and python which is where I planned to host the lessons when finished.

The pieces that I had built out were:

  1. A credit migration framework for bonds based on a simple markov chain.
  2. An interest rate model (Vasicek) for random stochastic interest rates.
  3. A deterministic model to simply account for getting bond payments given different coupon rates, face values, etc. This performs the same every time in its own insular module but is important when we begin to have the interest rate model for re-investment + credit migration model for defaults.
  4. A complete model with all three pieced together.

Right now I am trying to migrate my old notebooks to work with the newest version of cadCAD and was hoping to see if anyone wouldn’t mind giving feedback/checking to make sure my methodologies make sense. I started by creating two simple examples of building a first simulation with cadCAD using the vasicek interest model and then adding on to this by expanding to different model parameters tested within the simulation (which can be seen here: https://github.com/SeanMcOwen/FinanceAndPython.com/tree/master/cadCAD%20Bond%20Simulations). This next week I will be working on transitioning to the new library format and putting finishing touches on the 4 modules but would greatly appreciate a second set of eyes working with me to ensure I am implementing these simulations in the correct manner. The two notebooks I did tonight are very basic, but the other modules bring some more complexity and I also want to make sure that if I am posting this as a course that there are no improper usages passed on to users.

4 Likes

I finished up the baseline versions of the code in the github I linked (the actual lessons will go in to much more detail explaining things and the code will be cleaned up at that point). I have a few issues that may be simple mistakes that I was hoping someone might be able to give me advice on since I’m still learning how to use this library. I am on a mac working on jupyter notebooks which could be part of the issue, and these are the three issues:

  1. I can use single mode fine, but working with local mode for the executor causes an error (‘NoneType’ object is not iterable).
  2. If I try to run the executor a second time, with new configs or the same configs I get the following error: ValueError: Pool not running
    I looked into it, and it seems like some issue with pools either not being reset or closed, when I use pathos.helpers.shutdown() after each simulation I am able to run more than one in a given kernel. Is there a better way to be reseting the executor than this or mistake I am making that turns this into an issue.
  3. I have random variables in the simulation policies, but noticed that when I ran a 5 run simulation the first four runs had the exact same outputs and only the fifth had a different output. When I ran it with 6 to test this issue, the first 4 all still had the same values but now the last two runs were different from the first four, but the same as one and other. Am I incorrectly using random variables in these notebooks?

Sorry for all the questions, let me know if anyone has ideas. The github link has all the relevant notebooks. If these seem like library issues rather than issues with the code I wrote I can add the issues to the repository and make notebooks to replicate the errors.

3 Likes

Last update, the course is live! It can be found here and is totally free: https://financeandpython.com/courses/cadcad-bond-simulations/

3 Likes

I’m enjoying your basic finance course so far, thanks for making it. Would recommend.

2 Likes

Hi @SeanMcOwen, the material looks very complete.thank you for doing this.
Minor feedback: I’d increase the font. Had a hard time reading it and decided to zoom in the tab.

Best!

Hey @SeanMcOwen were you able to solve the ‘NoneType’ error? Getting same issue here.
Thanks