Skip to content

Commit fe46e8a

Browse files
committed
Add disclaimer and improve instructions on how to use the package in README
1 parent e8da056 commit fe46e8a

File tree

1 file changed

+67
-4
lines changed

1 file changed

+67
-4
lines changed

README.md

Lines changed: 67 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,15 @@
33
![Version](https://img.shields.io/badge/version-0.0.1-blue.svg?cacheSeconds=2592000)
44
![License](https://img.shields.io/badge/License-MIT-yellow.svg)
55

6-
> A python package that gets stocks prices from yahoo and calculates how much of each stocks you must buy to have almost equal distribution between the stocks you want in your portfolio
6+
> A python package that gets stocks prices from [yahoo finance](https://finance.yahoo.com/) and calculates how much of each stocks you must buy to have almost equal distribution between the stocks you want in your portfolio
7+
8+
## ** Disclaimer **
9+
10+
**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](https://finance.yahoo.com/).
711

812
## Requires
913

10-
python >= 3.x
14+
- python >= 3.x
1115

1216
## Install
1317

@@ -25,12 +29,71 @@ pip install -r requirements.txt
2529

2630
## Usage
2731

28-
Check the example available in [`example/example.py`](./example/example.py)
32+
- 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.
33+
34+
- 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:
35+
36+
```python
37+
{
38+
'allocations': {
39+
'B3SA3': {
40+
'price': 58.33,
41+
'amount': 3.0,
42+
'total': 174.99,
43+
'percentage': 18.14420803782506
44+
},
45+
'BBDC4': {
46+
'price': 21.97,
47+
'amount': 9.0,
48+
'total': 197.73,
49+
'percentage': 20.50205300485256
50+
},
51+
'MGLU3': {
52+
'price': 88.77,
53+
'amount': 2.0,
54+
'total': 177.54,
55+
'percentage': 18.408610177927088
56+
},
57+
'PETR4': {
58+
'price': 22.92,
59+
'amount': 9.0,
60+
'total': 206.28000000000003,
61+
'percentage': 21.388577827547596
62+
},
63+
'VVAR3': {
64+
'price': 18.9,
65+
'amount': 11.0,
66+
'total': 207.89999999999998,
67+
'percentage': 21.556550951847704
68+
}
69+
},
70+
'total_value': 964.4399999999999
71+
}
72+
```
73+
74+
### Example
75+
76+
Check out the example available in [`example/example.py`](./example/example.py) to see it in action.
2977

3078
## Run tests
3179

80+
- Unit tests
81+
82+
```sh
83+
pytest tests/
84+
```
85+
86+
- Coverage
87+
88+
```sh
89+
coverage run -m pytest tests/
90+
coverage report
91+
```
92+
93+
- Linter
94+
3295
```sh
33-
pytest
96+
flake8
3497
```
3598

3699
## Author

0 commit comments

Comments
 (0)