InvestimentosPy 0.1.0__tar.gz
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.
- investimentospy-0.1.0/InvestimentosPy.egg-info/PKG-INFO +38 -0
- investimentospy-0.1.0/InvestimentosPy.egg-info/SOURCES.txt +10 -0
- investimentospy-0.1.0/InvestimentosPy.egg-info/dependency_links.txt +1 -0
- investimentospy-0.1.0/InvestimentosPy.egg-info/top_level.txt +1 -0
- investimentospy-0.1.0/LICENSE +2 -0
- investimentospy-0.1.0/PKG-INFO +38 -0
- investimentospy-0.1.0/README.md +23 -0
- investimentospy-0.1.0/investimentos/__init__.py +0 -0
- investimentospy-0.1.0/investimentos/investimentos.py +60 -0
- investimentospy-0.1.0/setup.cfg +4 -0
- investimentospy-0.1.0/setup.py +12 -0
- investimentospy-0.1.0/tests/test_investimentos.py +12 -0
|
@@ -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,10 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
setup.py
|
|
4
|
+
InvestimentosPy.egg-info/PKG-INFO
|
|
5
|
+
InvestimentosPy.egg-info/SOURCES.txt
|
|
6
|
+
InvestimentosPy.egg-info/dependency_links.txt
|
|
7
|
+
InvestimentosPy.egg-info/top_level.txt
|
|
8
|
+
investimentos/__init__.py
|
|
9
|
+
investimentos/investimentos.py
|
|
10
|
+
tests/test_investimentos.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
investimentos
|
|
@@ -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,23 @@
|
|
|
1
|
+
# Meu Investimento
|
|
2
|
+
|
|
3
|
+
Uma biblioteca Python para cálculos de investimentos.
|
|
4
|
+
|
|
5
|
+
## Instalação
|
|
6
|
+
Você pode instalar a biblioteca via pip:
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
pip install meu_investimento
|
|
10
|
+
```
|
|
11
|
+
## Uso
|
|
12
|
+
```python
|
|
13
|
+
from investimentos import calcular_retorno_investimento, calcular_juros_compostos
|
|
14
|
+
|
|
15
|
+
valor_inicial = 1000
|
|
16
|
+
valor_final = 1500
|
|
17
|
+
|
|
18
|
+
retorno = calcular_retorno_investimento(valor_inicial, valor_final)
|
|
19
|
+
print(f"Retorno do investimento: {retorno:.2f}%")
|
|
20
|
+
|
|
21
|
+
valor_final_juros = calcular_juros_compostos(valor_inicial, 6, 5)
|
|
22
|
+
print(f"Valor final com juros compostos: R${valor_final_juros:.2f}")
|
|
23
|
+
```
|
|
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,12 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
|
|
3
|
+
setup(
|
|
4
|
+
name="InvestimentosPy", # ESCOLHA UM NOME ÚNICO AQUI
|
|
5
|
+
version="0.1.0",
|
|
6
|
+
author="Pedro R Rogala",
|
|
7
|
+
description="Uma biblioteca para cálculos financeiros básicos",
|
|
8
|
+
long_description=open('README.md').read(),
|
|
9
|
+
long_description_content_type='text/markdown',
|
|
10
|
+
packages=find_packages(),
|
|
11
|
+
python_requires=">=3.6",
|
|
12
|
+
)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
|
|
2
|
+
import unittest
|
|
3
|
+
from investimentos.investimentos import calcular_juros_compostos
|
|
4
|
+
|
|
5
|
+
class TestInvestimentos(unittest.TestCase):
|
|
6
|
+
def test_juros_compostos(self):
|
|
7
|
+
# R$ 1000 a 10% por 2 anos deve dar 1210
|
|
8
|
+
resultado = calcular_juros_compostos(1000, 0.10, 2)
|
|
9
|
+
self.assertEqual(resultado, 1210.0)
|
|
10
|
+
|
|
11
|
+
if __name__ == '__main__':
|
|
12
|
+
unittest.main()
|