cvxgrp / robust_bond_portfolio

Robust Bond Portfolio Construction via Convex-Concave Saddle Point Optimization
10 stars 0 forks source link

New Experiment - Data Component #2

Closed andrewcz closed 7 months ago

andrewcz commented 1 year ago

Hi ! amazing paper! @phschiele

If I wanted to try the algorithm on another set of bonds, how would construct the dataset?

Thank you. Andrew

phschiele commented 1 year ago

Hi @andrewcz! Thanks a lot! First, you need to create the cashflow matrix C, which is n x T, where n is the number of bonds and T the number of periods. For example, if one period is six months, and you have a bond with 3% semi annual coupon, $100 principal, and two years to maturity, you would have

C = np.array([[3,3,3,103]])

If instead the payment was annual, you'd have

C = np.array([[0,3,0,103]])

Combine as many bonds as you want for the cash flow matrix.

Now, you need to define the uncertainty sets for the yields and spreads. In the tests, you can find how to set up such an uncertainty set for the trivial case where a maximum element exists. The example shows a more realistic example with a confidence ellipsoid based on historic data. We outline other methods in the paper. Let us know if you have further questions!

andrewcz commented 1 year ago

Thank you @phschiele you are a legend!

A couple of questions.

In the repository, there are 10 separate csv files. Which CSVs were generated by the code and which were imported?

For clarification, the model generates the optimal weights of a bond portfolio? How do I find the weights?

Thank you in advance for your help. Best, Andrew

phschiele commented 1 year ago

Hi @andrewcz ! Yes, there are 10 different files that all serve as inputs for the optimization. We did not export the weights, but they are returned here. So if you change this to

weights = portfolio_construction(...)

you should get a dataframe of the optimal weights.

andrewcz commented 1 year ago

Hi @phschiele, cheers for notes above!

Just in terms of defining the data sets, does the datasets represent the following -

C.csv - cash flow matrix of bonds described above. F.csv - not sure mean_spreads.csv - the average of the spread of the yield curve. (?) mean_yields.csv - the average of the yields. (?) mu_joint.csv - not sure p.csv - not sure s_nominal.csv - not sure sigma_joint_inverse.csv - inverse of the covariance matrix(?) target_weights.csv - already calculated optimal weights (?) y_nominal.csv - not sure

Apologies in advance if I have missed something in the paper or the repository.

Best, Andrew

phschiele commented 1 year ago

Hi @andrewcz, please find my added explanations below. Let me know if you need further information

C.csv - cash flow matrix of bonds described above. F.csv - Sorry, this was renamed to $Z$ in the paper (section 7.2). It's the linear map that interpolates the yield curve and maps the spreads to the bonds. mean_spreads.csv - the average of the spread of the yield curve. -> correct mean_yields.csv - the average of the yields. -> correct mu_joint.csv - the historical mean ($\mu^{\text{hist}}$ in 7.2 in the paper) p.csv - the current prices of the bonds, computed as their cash flows discounted by the corresponding yields and spreads s_nominal.csv - the most recent spreads sigma_joint_inverse.csv - inverse of the covariance matrix -> correct target_weights.csv - The weights as given in the benchmark, the AGGG fund. y_nominal.csv - the most recent yield curve

andrewcz commented 1 year ago

Hi @phschiele thank you! much appreciated for the information above.

I will have a closer look at try and run the experiment. My only other question is where do you get the data from and would i be able to find some different data to try the experiment.

Cheers, Andrew

phschiele commented 7 months ago

Hi @andrewcz, just saw there was still a last open question here. You can construct a cashflow matrix from any source, e.g., you can look up interesting bonds and their maturities and coupons at many financial websites, but I'm sure you already found what you needed back then.

andrewcz commented 7 months ago

Thank you sir! Have a great week!

On Sun, 28 Apr 2024 at 7:05 AM, Philipp Schiele @.***> wrote:

Hi @andrewcz https://github.com/andrewcz, just saw there was still a last open question here. You can construct a cashflow matrix from any source, e.g., you can look up interesting bonds and their maturities and coupons at many financial websites, but I'm sure you already found what you needed back then.

— Reply to this email directly, view it on GitHub https://github.com/cvxgrp/robust_bond_portfolio/issues/2#issuecomment-2081182511, or unsubscribe https://github.com/notifications/unsubscribe-auth/AARQUDZZLKD7SSUSHPTCAKTY7QHLHAVCNFSM6AAAAAAVIK7FJSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBRGE4DENJRGE . You are receiving this because you were mentioned.Message ID: @.***>