Quick Start =========== This guide will help you get started with the xfinance Python SDK. Basic Usage ----------- .. code-block:: python from xfinance_sdk import XFinanceClient from xfinance_sdk.models.request import CompoundInterestRequest from decimal import Decimal # Initialize client with API key client = XFinanceClient(api_key="your-api-key") # Create compound interest request request = CompoundInterestRequest( principal=Decimal("10000"), # $10,000 principal annual_rate=Decimal("0.05"), # 5% annual interest years=10, # 10 years compounding_frequency=12 # Monthly compounding ) # Calculate compound interest response = client.calculate_compound_interest(request) # Print results print(f"Principal: ${response.principal:,.2f}") print(f"Final amount: ${response.final_amount:,.2f}") print(f"Total interest: ${response.total_interest:,.2f}") Loan Calculation Example ------------------------ .. code-block:: python from xfinance_sdk.models.request import LoanCalculationRequest request = LoanCalculationRequest( loan_amount=Decimal("200000"), # $200,000 loan annual_rate=Decimal("0.035"), # 3.5% annual interest term_years=30 # 30-year term ) response = client.calculate_loan_payment(request) print(f"Monthly payment: ${response.monthly_payment:,.2f}") print(f"Total interest: ${response.total_interest:,.2f}") Investment Returns Example -------------------------- .. code-block:: python from xfinance_sdk.models.request import InvestmentReturnsRequest request = InvestmentReturnsRequest( initial_investment=Decimal("5000"), # $5,000 initial monthly_contribution=Decimal("500"), # $500 monthly expected_annual_return=Decimal("0.07"), # 7% annual return years=20 # 20 years ) response = client.calculate_investment_returns(request) print(f"Final value: ${response.final_value:,.2f}") print(f"Total contributions: ${response.total_contributions:,.2f}") Async Usage ----------- .. code-block:: python import asyncio from xfinance_sdk import AsyncXFinanceClient async def main(): client = AsyncXFinanceClient(api_key="your-api-key") response = await client.calculate_compound_interest(request) print(f"Async result: ${response.final_amount:,.2f}") await client.close() asyncio.run(main())