semvec/pypi-packages huggingface dataset:
pyCorpFin 0.1.0
Corporate Finance calculations library with AI agent integration
License: MIT
Requires Python: >=3.7
Keywords: finance, corporate finance, IRR, NPV, XIRR, ai-agents, langchain

# pyCorpFin

A Python library for corporate finance calculations with built-in AI agent integration for LangChain, LangGraph, and other agentic frameworks.

## Features

- **Core Finance Functions**: NPV, IRR, MIRR, XIRR, EMI calculations
- **AI Agent Ready**: Pre-built tools for LangChain and LangGraph
- **Zero Dependencies**: Core library works without external packages
- **Pure Python**: No compiled extensions required

## Installation

### Basic Installation
```bash
pip install pyCorpFin
```

### With LangChain Support
```bash
pip install pyCorpFin[langchain]
```

### With LangGraph Support
```bash
pip install pyCorpFin[langgraph]
```

### With All AI Features
```bash
pip install pyCorpFin[all]
```

## Quick Start

### Direct Usage
```python
from pyCorpFin import IRR, calculate_xirr
from datetime import datetime

# Calculate IRR
cashflows = [-1000, 300, 400, 500]
irr = IRR(cashflows)
print(f"IRR: {irr:.2%}")

# Calculate XIRR
dates = [datetime(2023, 1, 1), datetime(2023, 6, 1), 
         datetime(2023, 12, 1), datetime(2024, 6, 1)]
xirr = calculate_xirr(cashflows, dates)
print(f"XIRR: {xirr:.2%}")
```

### With LangChain
```python
from pyCorpFin.tools import get_langchain_tools
from langchain.agents import initialize_agent, AgentType
from langchain_openai import ChatOpenAI

# Get finance tools
tools = get_langchain_tools()

# Create agent
llm = ChatOpenAI(temperature=0)
agent = initialize_agent(
    tools, 
    llm, 
    agent=AgentType.STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION,
    verbose=True
)

# Use the agent
result = agent.run(
    "Calculate the IRR for an investment of $10,000 that returns "
    "$3,000 per year for 4 years"
)
```

### With LangGraph
```python
from langgraph.prebuilt import create_react_agent
from pyCorpFin.tools import get_langchain_tools
from langchain_openai import ChatOpenAI

tools = get_langchain_tools()
model = ChatOpenAI(model="gpt-4")

agent = create_react_agent(model, tools)

response = agent.invoke({
    "messages": [("user", "What's the EMI on a $100,000 loan at 8% for 20 years?")]
})
```

## API Reference

### Core Functions

- `IRR(cashflows, guess=0.1)` - Internal Rate of Return
- `calculate_mirr(cashflows, finance_rate, reinvest_rate)` - Modified IRR
- `calculate_xirr(cashflows, dates, guess=0.1)` - Extended IRR
- `presentValue(cf, r, n)` - Present Value
- `futureValue(cf, r, n)` - Future Value
- `emi(PV, r, n)` - Equated Monthly Installment

## License

MIT License
networkdiagram 1.9.5
A Python library for creating, calculating, and visualizing CPM/PERT Network Diagrams.
License: MIT

# NetworkDiagram
        
        A lightweight Python library for creating Project Network Diagrams (CPM/PERT), calculating paths, and visualizing activity dependencies using NetworkX and Matplotlib.
        
        ![Python Version](https://img.shields.io/badge/python-3.8%2B-blue)
        ![License](https://img.shields.io/badge/license-MIT-green)
        
        ## Features
        
        - **Easy Node Management**: Add activities with durations and string-based predecessor lists (e.g., `"A,B"`).
        - **Automatic Pathfinding**: Detects all probable paths from Start to End.
        - **Visualisation**: Generates directed graphs with arrows and duration labels using `matplotlib`.
        - **CPM Ready**: Built on a node structure supporting Probable Paths, Critical Path.
        
        # Publisher
        - **Name**: Kathan Majithia
        - **Contact**: kathanmajithia@gmail.com
        
        ## Dependencies
        
        To use the visualization features, you must have the following libraries installed:
        
        * **networkx** (for graph theory and structure)
        * **matplotlib** (for plotting the diagram)
        
        ## Installation
        pip install networkdiagram
        
        ```bash
        
        from networkdiagram import CriticalPathMethod
        
        cpm = CriticalPathMethod()
        
        activities = ['A','B','C','D']
        durations = [2,5,4,2]
        predecessors = ['-','A','B','B,C']
        
        cpm.add_activities_relations(activities,durations,predecessors)