Welcome to Allokation 👋
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_moneyfunction). For each stock, it will be returned thepricethat was used to calculate the portfolio, theamountof stocks you will need to buy, thetotalmoney you need to buy this amount of this stock and thepercentagethat 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 git@github.com: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
- Website: capaci.dev
- Twitter: @capacirafael
- Github: @capaci
- LinkedIn: @rafaelcapaci
Show your support
Give a ⭐️ if this project helped you!
This README was generated with ❤️ by readme-md-generator
Metadata
Release files for allokation 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| allokation-0.1.0.tar.gz | 4.3 kB | Without provenance | Details for allokation-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| allokation-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for allokation-0.1.0-py3-none-any.whl |
Total release size: 9.4 kB
Release files / allokation-0.1.0.tar.gz
| Download URL | allokation-0.1.0.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2d80e8a7a08efa0fa660ad36b3bee6cf8d1e2e2b05479c09c5f81a7dfdcdabe1
|
|
BLAKE2b-256 checksum How to use checksums |
d887227162144473be0366334e82135ffeb6bc8ecd9ec7312200ce83665059e5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.2
|
Release files / allokation-0.1.0-py3-none-any.whl
| Download URL | allokation-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
77a69f91343d4746c3e4ece1c242d89dfeb2246bd5b0161c94afdd5c80acad4e
|
|
BLAKE2b-256 checksum How to use checksums |
e03be3f2265db06b01c489995d890a0d1359228eb439ae0a88c4bf7ac1b92ac2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.2
|
Security for allokation 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.