Skip to content

pgvetrivel/returns_calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 

Repository files navigation

ReturnsCalculator

ReturnsCalculator is a Python package designed to simplify the calculation of various financial returns for assets. It provides methods to compute metrics like Compound Annual Growth Rate (CAGR), Absolute Return, Calendar Year Return, Financial Year Return, and Monthly Return from your financial data. This package is ideal for analysts, portfolio managers, or anyone working with time-series financial data.

Key Features:

CAGR Calculation: Easily compute the compound annual growth rate for assets over a period.
Absolute Return: Calculate the total return on an asset from the beginning to the end of a period.
Calendar Year and Financial Year Returns: Analyze returns on an annual or financial year basis.
Monthly Returns: Break down asset performance month by month.

Installation:

You can install the package directly from GitHub:

pip install git+https://github.com/pgvetrivel/returns_calculator.git

Usage Example:

import pandas as pd
from returnscalculator import calculator

# Example DataFrame
df = pd.DataFrame({
    'asset': ['Asset1', 'Asset1', 'Asset2', 'Asset2'],
    'date': pd.to_datetime(['2020-01-01', '2021-01-01', '2020-01-01', '2021-01-01']),
    'price': [100, 120, 200, 220]
})

# Instantiate the ReturnsCalculator
calculatordf = calculator.ReturnsCalculator(df, 'asset', 'date', 'price')

# Calculate CAGR
cagr_df = calculatordf.cagr()
print(cagr_df)

About

Calculation of various financial returns for assets.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages