Code Monkey home page Code Monkey logo

allokation's Introduction

Welcome to Allokation ๐Ÿ‘‹

GitHub release (latest by date) GitHub

A python package that gets stocks prices from yahoo finance and calculates how much of each stocks you must buy to have almost equal distribution between the stocks you want in your portfolio

***Disclaimer***

NO FINANCIAL ADVISE - This library DO NOT offer financial advises, it just calculates the amount of stocks you will need to buy based on stocks that YOU WILL INFORM and the market price of the day for these stocks, given by yahoo finance.

Requires

  • python >= 3.x

Install

  • install via pip
pip install allokation

Usage

  • It's quite simple to use this package, you just need to import the function allocate_money, pass a list of tickers you want and the available money you have to invest. If you want, you can also pass a list of the percentages of each stocks you want in your portfolio. This list of percentages must have the same length of the tickers.

  • It will return a dict containing the allocations you must need and the total money you must need to have this portfolio (This total will be less or equal than the available money you informed to the allocate_money function). For each stock, it will be returned the price that was used to calculate the portfolio, the amount of stocks you will need to buy, the total money you need to buy this amount of this stock and the percentage that this stock represents in your portfolio. For example:

{
    'allocations': {
        'B3SA3': {
            'price': 58.33,
            'amount': 3.0,
            'total': 174.99,
            'percentage': 18.14420803782506
        },
        'BBDC4': {
            'price': 21.97,
            'amount': 9.0,
            'total': 197.73,
            'percentage': 20.50205300485256
        },
        'MGLU3': {
            'price': 88.77,
            'amount': 2.0,
            'total': 177.54,
            'percentage': 18.408610177927088
        },
        'PETR4': {
            'price': 22.92,
            'amount': 9.0,
            'total': 206.28000000000003,
            'percentage': 21.388577827547596
        },
        'VVAR3': {
            'price': 18.9,
            'amount': 11.0,
            'total': 207.89999999999998,
            'percentage': 21.556550951847704
        }
    },
    'total_value': 964.4399999999999
}

Example

Check out the example available in example/example.py to see it in action.

Development Guide

Getting the project

  • clone this repository
git clone [email protected]:capaci/allokation.git
  • install dependencies
pip install -r requirements.txt
pip install -r requirements-tests.txt

Run tests

  • Unit tests
pytest tests/
  • Coverage
coverage run -m pytest tests/
coverage report
  • Linter
flake8

Author

๐Ÿ‘ค Rafael Capaci

Show your support

Give a โญ๏ธ if this project helped you!


This README was generated with โค๏ธ by readme-md-generator

allokation's People

Contributors

capaci avatar

Watchers

 avatar  avatar

Forkers

coole123

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.