Code Monkey home page Code Monkey logo

weight_calculator's Introduction

Portfolio weight calculator assignment

Author: Yaroslav Hovorunov
License: MIT

Calculates weights of base funds (assets) in portfolio(s). Supports graphs when base fund is included in root fund through complex path. Detects loops in data to prevent infinite loops or incorrect calculations.

Expects CSV file on input with the following format:

A,B,1000
A,C,2000
B,D,500
B,E,250
B,F,250
C,G,1000
C,H,1000

Each line like A,B,1000 means value of fund B in fund A is 1000. Optional 4th column can be used to include end market values of funds. Example:

A,B,1000,1009
A,C,2000,1994
B,D,500,505
B,E,250,253
B,F,250,251
C,G,1000,994
C,H,1000,1000

Returns csv data representing weights of each base fund in each root fund found. If end market values are provided, 4th column will contain weighted returns. Example of program return:

A,D,0.167,2.222
A,E,0.083,1.333
A,F,0.083,0.444
A,G,0.333,-3.000
A,H,0.333,0.000 

Usage:

weight_calculator.py [-h] [-v] data_file

positional arguments:
  data_file            A .csv file containing fund data to act on.

optional arguments:
  -h, --help           show this help message and exit
  -v, --verbose        increase log verbosity

weight_calculator's People

Contributors

govorunov avatar

Watchers

 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.