You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> 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/).
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.
0 commit comments