InvestimentosPy 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- investimentos/__init__.py +0 -0
- investimentos/investimentos.py +60 -0
- investimentospy-0.1.0.dist-info/METADATA +38 -0
- investimentospy-0.1.0.dist-info/RECORD +7 -0
- investimentospy-0.1.0.dist-info/WHEEL +5 -0
- investimentospy-0.1.0.dist-info/licenses/LICENSE +2 -0
- investimentospy-0.1.0.dist-info/top_level.txt +1 -0
|
File without changes
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
|
|
2
|
+
# investimentos.py
|
|
3
|
+
|
|
4
|
+
def calcular_retorno_investimento(valor_inicial, valor_final):
|
|
5
|
+
"""
|
|
6
|
+
Calcula o retorno de investimento.
|
|
7
|
+
|
|
8
|
+
Args:
|
|
9
|
+
valor_inicial (float): Valor inicial do investimento.
|
|
10
|
+
valor_final (float): Valor final do investimento.
|
|
11
|
+
|
|
12
|
+
Returns:
|
|
13
|
+
float: Retorno do investimento em porcentagem.
|
|
14
|
+
"""
|
|
15
|
+
retorno = (valor_final - valor_inicial) / valor_inicial * 100
|
|
16
|
+
return retorno
|
|
17
|
+
|
|
18
|
+
def calcular_juros_compostos(principal, taxa_juros_anual, periodos):
|
|
19
|
+
"""
|
|
20
|
+
Calcula o valor final de um investimento com juros compostos.
|
|
21
|
+
|
|
22
|
+
Args:
|
|
23
|
+
principal (float): Valor inicial investido.
|
|
24
|
+
taxa_juros_anual (float): Taxa de juros anual em porcentagem.
|
|
25
|
+
periodos (int): Número de períodos (anos).
|
|
26
|
+
|
|
27
|
+
Returns:
|
|
28
|
+
float: Valor final após o período com juros compostos.
|
|
29
|
+
"""
|
|
30
|
+
taxa_juros_decimal = taxa_juros_anual / 100
|
|
31
|
+
valor_final = principal * (1 + taxa_juros_decimal) ** periodos
|
|
32
|
+
return valor_final
|
|
33
|
+
|
|
34
|
+
def converter_taxa_anual_para_mensal(taxa_anual):
|
|
35
|
+
"""
|
|
36
|
+
Converte uma taxa de juros anual para mensal.
|
|
37
|
+
|
|
38
|
+
Args:
|
|
39
|
+
taxa_anual (float): Taxa de juros anual em porcentagem.
|
|
40
|
+
|
|
41
|
+
Returns:
|
|
42
|
+
float: Taxa de juros mensal em porcentagem.
|
|
43
|
+
"""
|
|
44
|
+
taxa_mensal = (1 + taxa_anual / 100) ** (1 / 12) - 1
|
|
45
|
+
return taxa_mensal * 100
|
|
46
|
+
|
|
47
|
+
def calcular_cagr(valor_inicial, valor_final, anos):
|
|
48
|
+
"""
|
|
49
|
+
Calcula a taxa de crescimento anual composta (CAGR).
|
|
50
|
+
|
|
51
|
+
Args:
|
|
52
|
+
valor_inicial (float): Valor inicial do investimento.
|
|
53
|
+
valor_final (float): Valor final do investimento.
|
|
54
|
+
anos (int): Número de anos.
|
|
55
|
+
|
|
56
|
+
Returns:
|
|
57
|
+
float: CAGR em porcentagem.
|
|
58
|
+
"""
|
|
59
|
+
cagr = ((valor_final / valor_inicial) ** (1 / anos) - 1) * 100
|
|
60
|
+
return cagr
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: InvestimentosPy
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Uma biblioteca para cálculos financeiros básicos
|
|
5
|
+
Author: Pedro R Rogala
|
|
6
|
+
Requires-Python: >=3.6
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Dynamic: author
|
|
10
|
+
Dynamic: description
|
|
11
|
+
Dynamic: description-content-type
|
|
12
|
+
Dynamic: license-file
|
|
13
|
+
Dynamic: requires-python
|
|
14
|
+
Dynamic: summary
|
|
15
|
+
|
|
16
|
+
# Meu Investimento
|
|
17
|
+
|
|
18
|
+
Uma biblioteca Python para cálculos de investimentos.
|
|
19
|
+
|
|
20
|
+
## Instalação
|
|
21
|
+
Você pode instalar a biblioteca via pip:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pip install meu_investimento
|
|
25
|
+
```
|
|
26
|
+
## Uso
|
|
27
|
+
```python
|
|
28
|
+
from investimentos import calcular_retorno_investimento, calcular_juros_compostos
|
|
29
|
+
|
|
30
|
+
valor_inicial = 1000
|
|
31
|
+
valor_final = 1500
|
|
32
|
+
|
|
33
|
+
retorno = calcular_retorno_investimento(valor_inicial, valor_final)
|
|
34
|
+
print(f"Retorno do investimento: {retorno:.2f}%")
|
|
35
|
+
|
|
36
|
+
valor_final_juros = calcular_juros_compostos(valor_inicial, 6, 5)
|
|
37
|
+
print(f"Valor final com juros compostos: R${valor_final_juros:.2f}")
|
|
38
|
+
```
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
investimentos/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
investimentos/investimentos.py,sha256=6a2hKeWqRwB36ewLHLuJ402hybsurICQ-Ubu7cQ-4u8,1709
|
|
3
|
+
investimentospy-0.1.0.dist-info/licenses/LICENSE,sha256=sZkkA-KI9MWVeBhlfcGqB2pPRrgRlGJ-BzffK90Mjvc,40
|
|
4
|
+
investimentospy-0.1.0.dist-info/METADATA,sha256=JEfpBIy4bR_u4epiakKfGwWXYll_nLbmrkMBFZGKriA,938
|
|
5
|
+
investimentospy-0.1.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
6
|
+
investimentospy-0.1.0.dist-info/top_level.txt,sha256=6V7RFJt2Ta4mfwnPHipaNsSccs3TmB_uGzRA2cT4jzM,14
|
|
7
|
+
investimentospy-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
investimentos
|