Preface¶
DeepSeek Harness (DSH) extends agent capabilities through a plugin mechanism. Agents are prone to hallucinations when handling money-related calculations, such as compound interest, PMT formula calculations, and IRR calculations. The dsh-finance plugin addresses this issue by providing deterministic tool calls for purely arithmetic financial calculations.
Plugin Overview¶
Plugin Name: tyeclipse/dsh-finance
Maintainer: TYEclipse
Core Positioning: Money math toolbox for DeepSeek Harness (dsh). Provides features such as loan repayment, compound interest growth, interest rate conversion, cash flow analysis, retirement planning, and inflation adjustment. This plugin has zero runtime dependencies, is fully based on arithmetic operations, and does not involve network or file system access.
Core Features¶
The plugin provides the following tools:
- loan_payment: Fixed-rate loan payment calculation, with optional amortization schedule (limited to 360 rows) and monthly extra principal payments.
- compound_growth: Principal and future value calculations, supporting monthly contributions, with multiple compounding frequencies (daily, monthly, quarterly, semi-annual, annual, continuous).
- rate_convert: Conversion between nominal annual percentage rate (APR) and effective annual rate (EAR), supporting continuous compounding calculations.
- cashflow_analysis: Cash flow analysis, calculating NPV, IRR (using the bisection method), and simple/discounted payback periods. Handles cases with no sign changes or multiple sign changes.
- retirement_plan: Retirement planning, calculating depletion time under fixed withdrawals or sustainable monthly withdrawals.
- savings_goal: Savings target planning, calculating the number of months needed to reach the goal or the required monthly contribution.
- inflation_adjust: Inflation adjustment, calculating purchasing power changes and Fisher real rates of return.
Installation and Enabling¶
Install the plugin using the DeepSeek Harness Web Profile:
dsh plugin --profile web add github:TYEclipse/dsh-finance
After installation, you can verify whether the plugin layer is mounted using the following command:
dsh --profile web --dump-config | grep '=='
Typical Usage¶
The plugin supports calculations for the following typical scenarios:
-
Mortgage calculation:
- Input:
loan_payment { principal: 300000, annual_rate_percent: 4, months: 360 } - Output:
monthly_payment 1432.25, total_interest 215610, total_paid 515610
- Input:
-
Compound growth:
- Input:
compound_growth { principal: 1000, annual_rate_percent: 5, years: 10, compounding: "monthly", contribution_per_month: 100 } - Output:
future_value 17175.24 (contributions 13000, interest 4175.24)
- Input:
-
Interest rate conversion:
- Input:
rate_convert { rate_percent: 12, input_kind: "nominal", compounding: "monthly" } - Output:
output_rate_percent 12.682503 (effective EAR)
- Input:
-
IRR and NPV:
- Input:
cashflow_analysis { cash_flows: [-70000, 12000, 15000, 18000, 21000, 26000], discount_rate_percent: 8 } - Output:
npv 1390.96, irr_percent 8.663095, payback_periods 4.15
- Input:
-
Retirement planning:
- Input:
retirement_plan { principal: 1000000, annual_rate_percent: 4, monthly_withdrawal: 4000, years: 30 } - Output:
months_to_exhaust 538.42, withdrawal_rate_percent 4.8, lasts_horizon true
- Input:
-
Savings goal:
- Input:
savings_goal { target_amount: 50000, current_savings: 10000, annual_rate_percent: 5, monthly_contribution: 500 } - Output:
months_to_goal 65, final_balance 50341.48
- Input:
-
Required monthly contribution:
- Input:
savings_goal { target_amount: 100000, current_savings: 20000, annual_rate_percent: 6, months: 240 } - Output:
required_monthly_contribution 73.15, projected_balance 100002.38
- Input:
-
Inflation adjustment:
- Input:
inflation_adjust { amount: 1000, annual_inflation_percent: 2.5, years: 10, nominal_rate_percent: 6 } - Output:
future_cost 1280.08, real_value 781.20, real_rate_percent 3.414634
- Input:
Details and Notes¶
- Zero dependencies: The plugin does not depend on any external runtime; it uses pure arithmetic operations, making it safe and fast.
- Precision handling: Amounts are rounded to the cent only at the output boundary; internal calculations retain high precision.
- Special scenarios: Supports zero-rate calculations, explicitly reports cash flow sign-change situations, and supports negative inflation (deflation) calculations.
- IRR calculation: Returns a result only when there is exactly one sign change in the cash flows and a root exists; otherwise, it returns a message indicating no sign changes or a non-unique root.
- Sustainable withdrawal: Calculates sustainable monthly withdrawals using a rounding method consistent with bank reconciliation.
Summary¶
dsh-finance is a financial calculation toolbox designed for the DSH plugin system. It addresses common hallucination issues of large models in money mathematics. By providing deterministic function calls, it helps developers build more reliable financial analysis agents.