Skip to main content

fin-infra

Financial data infrastructure for fintech apps.

PyPI CI Python License

Overview

Banking, investments, market data, credit scores, and financial calculations in one toolkit.

Key Features

  • Banking - Plaid/Teller integration, accounts, transactions
  • Investments - Holdings, portfolio data, real P/L with cost basis
  • Market Data - Stocks, crypto, forex quotes and history
  • Credit - Credit scores and monitoring
  • Analytics - Cash flow, savings rate, spending insights
  • Cashflows - NPV, IRR, loan amortization calculations

Why fin-infra?

Building a fintech app means integrating Plaid, pulling market data, calculating portfolio returns, categorizing transactions... and doing it all securely.

fin-infra gives you production-ready financial infrastructure:

from fin_infra.banking import easy_banking
from fin_infra.markets import easy_market

# Connect to banks via Plaid
banking = easy_banking()
accounts = await banking.get_accounts(access_token)
transactions = await banking.get_transactions(account_id)

# Get market data
market = easy_market()
quote = market.quote("AAPL")

Quick Install

pip install fin-infra

What's Included

Feature What You Get One-liner
Banking Plaid/Teller integration, accounts, transactions easy_banking()
Investments Holdings, portfolio data, real P/L with cost basis easy_investments()
Market Data Stocks, crypto, forex quotes and history easy_market()
Credit Credit scores and monitoring easy_credit()
Analytics Cash flow, savings rate, spending insights Built-in
Budgets Multi-type budget tracking with templates Scaffold included
Goals Financial goal tracking with milestones Scaffold included
Cashflows NPV, IRR, loan amortization calculations npv(), irr()

30-Second Examples

Connect Bank Accounts

from fin_infra.banking import easy_banking

banking = easy_banking(provider="plaid")

# Get linked accounts
accounts = await banking.get_accounts(access_token)
for acc in accounts:
    print(f"{acc.name}: ${acc.balance}")

# Get transactions
transactions = await banking.get_transactions(account_id)

Portfolio Holdings with Real P/L

from fin_infra.investments import easy_investments

investments = easy_investments(provider="plaid")

# Get holdings with cost basis
holdings = await investments.get_holdings(access_token)
for h in holdings:
    print(f"{h.symbol}: {h.quantity} shares, P/L: ${h.unrealized_gain}")

# Asset allocation
allocation = await investments.get_allocation(access_token)
print(allocation)  # {"stocks": 60, "bonds": 30, "cash": 10}

Real-Time Market Data

from fin_infra.markets import easy_market, easy_crypto

# Stock quotes
market = easy_market()
quote = market.quote("AAPL")
print(f"AAPL: ${quote.price} ({quote.change_percent}%)")

# Crypto
crypto = easy_crypto()
btc = crypto.ticker("BTC/USDT")
print(f"BTC: ${btc.price}")

Credit Scores

from fin_infra.credit import easy_credit

credit = easy_credit()
score = await credit.get_credit_score(user_id)
print(f"Credit Score: {score.value} ({score.rating})")

Financial Calculations

from fin_infra.cashflows import npv, irr, loan_payment

# Net Present Value
cashflows = [-100000, 30000, 30000, 30000, 30000]
value = npv(rate=0.08, cashflows=cashflows)
print(f"NPV: ${value:,.2f}")

# Internal Rate of Return
rate = irr(cashflows)
print(f"IRR: {rate:.2%}")

# Loan payments
monthly = loan_payment(principal=250000, rate=0.065, years=30)
print(f"Monthly payment: ${monthly:,.2f}")

FastAPI Integration

Use with svc-infra for a complete backend:

from fastapi import FastAPI
from svc_infra.api.fastapi.ease import easy_service_app
from fin_infra.banking import add_banking
from fin_infra.investments import add_investments
from fin_infra.markets import add_market_data

# Create app with svc-infra (auth, database, etc.)
app = easy_service_app(name="FinanceAPI", release="1.0.0")

# Add financial capabilities
add_banking(app, provider="plaid")
add_investments(app, provider="plaid")
add_market_data(app, provider="alphavantage")

# Automatic endpoints:
# GET  /banking/accounts
# GET  /banking/transactions
# GET  /investments/holdings
# GET  /investments/allocation
# GET  /market/quote/{symbol}

Supported Providers

Category Providers
Banking Plaid, Teller
Investments Plaid
Market Data Alpha Vantage, Yahoo Finance
Crypto CoinGecko, Binance
Credit Experian

Scaffold Models

Generate production-ready models for your app:

# Generate budget models
fin-infra scaffold budgets --dest-dir app/models/ --include-tenant

# Generate goal tracking
fin-infra scaffold goals --dest-dir app/models/

# Generate net worth snapshots
fin-infra scaffold net-worth --dest-dir app/models/

What you get:

  • SQLAlchemy models with proper indexes
  • Pydantic schemas (Create, Read, Update)
  • Repository pattern with async CRUD
  • Type hints throughout

Wire CRUD in one call:

from svc_infra.api.fastapi.db.sql import add_sql_resources, SqlResource
from app.models.budgets import Budget

add_sql_resources(app, [
    SqlResource(
        model=Budget,
        prefix="/budgets",
        search_fields=["name", "description"],
    )
])
# Creates: POST, GET, PATCH, DELETE /budgets/*

Configuration

# Banking (Plaid)
PLAID_CLIENT_ID=your_client_id
PLAID_SECRET=your_secret
PLAID_ENV=sandbox  # or development, production

# Market Data
ALPHAVANTAGE_API_KEY=your_api_key

# Credit (Experian)
EXPERIAN_CLIENT_ID=your_client_id
EXPERIAN_CLIENT_SECRET=your_secret

Documentation

Module Description
Data Integration
Banking Account aggregation, transactions
Investments Holdings, portfolio, P/L
Market Data Stocks, crypto, forex
Credit Credit scores and reports
Analytics
Analytics Cash flow, savings rate, insights
Net Worth Net worth tracking
Cashflows NPV, IRR, loan calculations
Features
Budgets Budget management
Goals Financial goal tracking
Insights AI-powered insights
Categorization Transaction categorization
Infrastructure
Persistence Scaffold workflow
API Guide Building fintech APIs
Compliance GLBA, FCRA, PCI-DSS

Architecture

fin-infra is the financial data layer. Use with svc-infra for backend infrastructure:

Your App
    |
    +-- fin-infra (financial data)
    |       Banking, investments, market data, credit
    |
    +-- svc-infra (backend infrastructure)
            Auth, database, API framework, jobs, billing

This separation keeps financial logic clean and portable.

Running Examples

git clone https://github.com/nfraxlab/fin-infra.git
cd fin-infra
poetry install

# Market data (no auth needed)
poetry run python -c "
from fin_infra.markets import easy_market
market = easy_market()
print(market.quote('AAPL'))
"

# Run all tests
poetry run pytest -q

Related Packages

fin-infra is part of the nfrax infrastructure suite:

Package Purpose
fin-infra Financial infrastructure (banking, portfolio, insights)
svc-infra Backend infrastructure (auth, billing, jobs, webhooks)
ai-infra AI/LLM infrastructure (agents, tools, RAG, MCP)

License

MIT License - use it for anything.


Metadata

Release files for fin-infra 0.13.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fin-infra 0.13.0
File Size Uploaded
fin_infra-0.13.0.tar.gz 352.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fin-infra 0.13.0
File Interpreter ABI Platform
fin_infra-0.13.0-py3-none-any.whl Python 3 none any Details

Total release size: 803.6 kB

Release files / fin_infra-0.13.0.tar.gz

Download URL fin_infra-0.13.0.tar.gz
Size 352.3 kB
Tags Source
SHA-256 checksum
How to use checksums
cc601b3e2068ecbadf4c7616e167a6a586ce2f93a5d35ee6707bf0db2dc28e9c
BLAKE2b-256 checksum
How to use checksums
8f69ed8ba7375beb8a91ce8aa4fae13f48fe2a697b70193f26d2601902740f76
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / fin_infra-0.13.0-py3-none-any.whl

Download URL fin_infra-0.13.0-py3-none-any.whl
Size 451.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6dd9cbb9b57e8d50d46050aae627f82f6ece529af22283be6186a9f2bcb2e84f
BLAKE2b-256 checksum
How to use checksums
0a6cb0eeb64c21816be6c92c276e7ba05447fd434e63fa6bb8e25b5660f3c2d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Release history Release notifications | RSS feed

This release

0.13.0 This release

2 release files

0.11.0

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.92

2 release files

0.1.91

2 release files

0.1.90

2 release files

0.1.89

2 release files

0.1.88

2 release files

0.1.87

2 release files

0.1.86

2 release files

0.1.85

2 release files

0.1.84

2 release files

0.1.83

2 release files

0.1.82

2 release files

0.1.81

2 release files

0.1.80

2 release files

0.1.79

2 release files

0.1.78

2 release files

0.1.77

2 release files

0.1.76

2 release files

0.1.75

2 release files

0.1.74

2 release files

0.1.73

2 release files

0.1.72

2 release files

0.1.71

2 release files

0.1.70

2 release files

0.1.69

2 release files

0.1.68

2 release files

0.1.67

2 release files

0.1.66

2 release files

0.1.65

2 release files

0.1.64

2 release files

0.1.63

2 release files

0.1.62

2 release files

0.1.61

2 release files

0.1.60

2 release files

0.1.59

2 release files

0.1.58

2 release files

0.1.57

2 release files

0.1.56

2 release files

0.1.55

2 release files

0.1.54

2 release files

0.1.51

2 release files

0.1.50

2 release files

0.1.49

2 release files

0.1.48

2 release files

0.1.47

2 release files

0.1.46

2 release files

0.1.45

2 release files

0.1.44

2 release files

0.1.43

2 release files

0.1.42

2 release files

0.1.41

2 release files

0.1.40

2 release files

0.1.39

2 release files

0.1.38

2 release files

0.1.37

2 release files

0.1.36

2 release files

0.1.35

2 release files

0.1.34

2 release files

0.1.33

2 release files

0.1.32

2 release files

0.1.31

2 release files

0.1.30

2 release files

0.1.29

2 release files

0.1.28

2 release files

0.1.27

2 release files

0.1.26

2 release files

0.1.25

2 release files

0.1.24

2 release files

0.1.23

2 release files

0.1.22

2 release files

0.1.21

2 release files

0.1.20

2 release files

0.1.19

2 release files

0.1.9

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page