Code Monkey home page Code Monkey logo

black_litterman's Introduction

black_litterman

Black_Litterman_main

This is the main file for the code. Within is the initialization of 3 different scenario's values.

Each scenario varies the following values:

  • Weights
  • Classes
  • Confidence
  • Manager Projections

The risk aversion remains constant at 3. There are 3 output files, each with the optimized values calculated in the Black-Litterman (BL) model.

Black_Litterman_simple

This is another main file, only with one scenario. All the outputs and functions are the same. Created to allow ease of use and simpler exchange of variables in solving for a single optimal portfolio.

Functions

fBL_read

This is the function that reads the return data excel file. Raw returns and T-bill returns (for the risk free rate) are taken as vectors. It then calculates the excess returns, and the covariance of the excess returns. The latter is output since it is necessary for many of the BL calculations.

fBL_market

This is a simple function that calculates the variance, std. dev., expected returns and Sharpe ratio of the excess returns using the market asset weights prior to the BL optimization.

The inputs are:

  • Initial weights
  • Covariance of the assets returns
  • Risk aversion

The outputs are vectors of:

  • Variance
  • Std. Dev.
  • Expected Returns
  • Sharpe Ratio

fBL_calc

This is the function for calculating the Black-Litterman values.

The inputs required are:

  • Confidence in initial weights
  • Confidence in manager's assumptions
  • P matrix
  • Q vector
  • Covariance of the assets returns
  • Initial weights
  • Risk aversion

The outputs of the function are:

  • Posterior returns
  • Posterior covariance matrix
  • Optimal constrained portfolio weights
  • Vectors of Variance, Std. Dev., Expected Returns and Sharpe Ratio

fBL_excel

This function automates the writing of the output excel file. The values are output into a series of sheets in an order so that any number of assets and manager's views can be taken and still be formatted correctly.

The output file has the following sheets:

  • Sheet 1 - header of file
  • Returns and Weights
  • Manager Views
  • Posterior Returns Covariance
  • Metrics - Variance, Std. Dev. Expected Returns and Sharpe Ratio

black_litterman's People

Contributors

austingriffith94 avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.