simple-financial-tool-as 1.0.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.
- simple_financial_tool_as-1.0.0/PKG-INFO +6 -0
- simple_financial_tool_as-1.0.0/mypackage/__init__.py +0 -0
- simple_financial_tool_as-1.0.0/mypackage/calculator.py +38 -0
- simple_financial_tool_as-1.0.0/pyproject.toml +15 -0
- simple_financial_tool_as-1.0.0/setup.cfg +4 -0
- simple_financial_tool_as-1.0.0/simple_financial_tool_as.egg-info/PKG-INFO +6 -0
- simple_financial_tool_as-1.0.0/simple_financial_tool_as.egg-info/SOURCES.txt +7 -0
- simple_financial_tool_as-1.0.0/simple_financial_tool_as.egg-info/dependency_links.txt +1 -0
- simple_financial_tool_as-1.0.0/simple_financial_tool_as.egg-info/top_level.txt +1 -0
|
File without changes
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"""Simple Financial Tool: funzioni di base per l'analisi finanziaria."""
|
|
2
|
+
|
|
3
|
+
import math
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def simple_return(p_start, p_end):
|
|
7
|
+
"""Rendimento semplice tra due prezzi."""
|
|
8
|
+
return p_end / p_start - 1
|
|
9
|
+
|
|
10
|
+
def log_return(p_start, p_end):
|
|
11
|
+
"""Rendimento logaritmico tra due prezzi."""
|
|
12
|
+
return math.log(p_end / p_start)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def cagr(p_start, p_end, years):
|
|
16
|
+
"""Tasso di crescita annuo composto."""
|
|
17
|
+
return (p_end / p_start) ** (1 / years) - 1
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def future_value(capital, rate, years):
|
|
21
|
+
"""Valore futuro di un capitale con capitalizzazione annua composta."""
|
|
22
|
+
return capital * (1 + rate) ** years
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def present_value(amount, rate, years):
|
|
26
|
+
"""Valore attuale di un importo futuro."""
|
|
27
|
+
return amount / (1 + rate) ** years
|
|
28
|
+
|
|
29
|
+
def annual_volatility(daily_returns, days=252):
|
|
30
|
+
"""Volatilità annualizzata da una lista di rendimenti giornalieri."""
|
|
31
|
+
n = len(daily_returns)
|
|
32
|
+
if n < 2:
|
|
33
|
+
raise ValueError("Servono almeno 2 rendimenti")
|
|
34
|
+
mean = sum(daily_returns) / n
|
|
35
|
+
var = sum((r - mean) ** 2 for r in daily_returns) / (n - 1)
|
|
36
|
+
return math.sqrt(var) * math.sqrt(days)
|
|
37
|
+
|
|
38
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "simple-financial-tool-as"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "Simple Financial Tool"
|
|
9
|
+
authors = [{ name = "Giuseppe Giardino" }]
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
dependencies = []
|
|
12
|
+
|
|
13
|
+
[tool.setuptools]
|
|
14
|
+
packages = ["mypackage"]
|
|
15
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
mypackage
|