{"id":"depreciation-schedule","version":"1.0.0","description":"Straight-line, sum-of-years-digits, declining-balance and Excel DB depreciation schedule that ends at salvage.","supported_operations":["depreciation schedule straight line","double declining balance depreciation","sum of the years digits depreciation table","Excel DB fixed declining balance schedule","asset book value by year","depreciation with switch to straight line","Excel SLN SYD DDB VDB equivalent","fixed asset depreciation table with salvage value","לוח פחת לנכס קבוע עם ערך גרט"],"unsupported_operations":["MACRS and other tax depreciation tables","units-of-production, half-year and mid-quarter conventions","loan or debt amortization (use loan-amortization-schedule)","impairment, component depreciation and date-based calendars"],"semantics":["cost > 0 and 0 <= salvage <= cost are decimal strings (up to 20 integer and 20 fractional digits, no sign); both must have at most scale fractional digits, else invalid_input, so the ledger lives on the 10^-scale grid. life is a JSON integer of periods from 1; life above 600 is limit_exceeded (checked before other work except string bytes). method is required: straight-line, sum-of-years-digits, declining-balance or fixed-declining-balance.","Optional fields and their meaning when omitted: factor (declining-balance only, 0 < factor <= 10) defaults to \"2\"; switch_to_straight_line (declining-balance only) defaults to false; first_year_months (fixed-declining-balance only, 1 to 12) defaults to 12. Supplying one of them for another method is invalid_input. scale defaults to 2, rate_scale to 6 (both 0 to 12) and rounding to half-up (half away from zero; also half-even, half-down, up, down, ceiling, floor).","Exact schedule with C = cost, S = salvage, n = life, D = C - S, bv_k the exact book value after period k and A_k = C - bv_k the exact accumulated depreciation. straight-line: A_k = D*k/n. sum-of-years-digits (Excel SYD): A_k = D*k*(2n - k + 1)/(n*(n + 1)).","declining-balance (Excel DDB, and VDB when switching): with r = factor/n, period k depreciates min(dd, bv_(k-1) - S) with dd = bv_(k-1)*r, or max(dd, (bv_(k-1) - S)/(n - k + 1)) when switch_to_straight_line is true; never below salvage and never negative. Without the switch the book value may stay above salvage (for example S = 0).","fixed-declining-balance (Excel DB): rate3 = 1 - (S/C)^(1/n) rounded half-up to exactly 3 decimals regardless of rounding (determined exactly), and 1 when S = 0. With m = first_year_months there are n periods when m = 12 and n + 1 otherwise: period 1 is bv*rate3*m/12, periods 2 to n are bv*rate3, period n + 1 is bv_n*rate3*(12 - m)/12. Each period is capped at bv - S (Excel does not cap; a capped case is cost 1000, salvage 500, life 2: 207 instead of 207.151).","Rounding is cumulative: a_k = round(A_k) at scale, depreciation_k = a_k - a_(k-1), accumulated_k = a_k and book_value_k = C - a_k. No depreciation is negative, the book value never falls below salvage, and a schedule that reaches salvage ends exactly there (1000 over 3 periods gives 333.33, 333.34, 333.33). This deliberately differs from rounding each period and correcting the last one.","rows has one entry per period; total_depreciation and ending_book_value repeat the last row. rate is null for straight-line and sum-of-years-digits, factor/n for declining-balance and rate3 for fixed-declining-balance, rounded once to rate_scale (the computation uses the exact value). Exact BigInt arithmetic; outputs never contain -0.","Any string input over 64 UTF-8 bytes is limit_exceeded, checked before parsing; a lone surrogate is invalid_input.","Disclaimer: arithmetic calculation only; not financial, tax, legal, or investment advice."],"limits":{"max_string_bytes":64,"max_life":600},"pricing":{"status":"unpriced","charge_usd":null},"input_schema":{"type":"object","additionalProperties":false,"required":["cost","salvage","life","method"],"properties":{"cost":{"type":"string","pattern":"^(0|[1-9][0-9]{0,19})(\\.[0-9]{1,20})?$","maxLength":64},"salvage":{"type":"string","pattern":"^(0|[1-9][0-9]{0,19})(\\.[0-9]{1,20})?$","maxLength":64},"life":{"type":"integer","minimum":1},"method":{"type":"string","enum":["straight-line","sum-of-years-digits","declining-balance","fixed-declining-balance"]},"factor":{"type":"string","pattern":"^(0|[1-9][0-9]{0,19})(\\.[0-9]{1,20})?$","maxLength":64},"switch_to_straight_line":{"type":"boolean"},"first_year_months":{"type":"integer","minimum":1,"maximum":12},"scale":{"type":"integer","minimum":0,"maximum":12},"rate_scale":{"type":"integer","minimum":0,"maximum":12},"rounding":{"type":"string","enum":["half-up","half-even","half-down","up","down","ceiling","floor"]}}},"output_schema":{"type":"object","additionalProperties":false,"required":["rows","total_depreciation","ending_book_value","rate"],"properties":{"rows":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["period","depreciation","accumulated","book_value"],"properties":{"period":{"type":"integer","minimum":1,"maximum":601},"depreciation":{"type":"string","pattern":"^(0|[1-9][0-9]*)(\\.[0-9]+)?$"},"accumulated":{"type":"string","pattern":"^(0|[1-9][0-9]*)(\\.[0-9]+)?$"},"book_value":{"type":"string","pattern":"^(0|[1-9][0-9]*)(\\.[0-9]+)?$"}}},"minItems":1,"maxItems":601},"total_depreciation":{"type":"string","pattern":"^(0|[1-9][0-9]*)(\\.[0-9]+)?$"},"ending_book_value":{"type":"string","pattern":"^(0|[1-9][0-9]*)(\\.[0-9]+)?$"},"rate":{"type":["string","null"],"pattern":"^(0|[1-9][0-9]*)(\\.[0-9]+)?$"}}},"examples":[{"input":{"cost":"30000","salvage":"7500","life":10,"method":"straight-line"},"output":{"rows":[{"period":1,"depreciation":"2250.00","accumulated":"2250.00","book_value":"27750.00"},{"period":2,"depreciation":"2250.00","accumulated":"4500.00","book_value":"25500.00"},{"period":3,"depreciation":"2250.00","accumulated":"6750.00","book_value":"23250.00"},{"period":4,"depreciation":"2250.00","accumulated":"9000.00","book_value":"21000.00"},{"period":5,"depreciation":"2250.00","accumulated":"11250.00","book_value":"18750.00"},{"period":6,"depreciation":"2250.00","accumulated":"13500.00","book_value":"16500.00"},{"period":7,"depreciation":"2250.00","accumulated":"15750.00","book_value":"14250.00"},{"period":8,"depreciation":"2250.00","accumulated":"18000.00","book_value":"12000.00"},{"period":9,"depreciation":"2250.00","accumulated":"20250.00","book_value":"9750.00"},{"period":10,"depreciation":"2250.00","accumulated":"22500.00","book_value":"7500.00"}],"total_depreciation":"22500.00","ending_book_value":"7500.00","rate":null}},{"input":{"cost":"1000","salvage":"0","life":3,"method":"straight-line"},"output":{"rows":[{"period":1,"depreciation":"333.33","accumulated":"333.33","book_value":"666.67"},{"period":2,"depreciation":"333.34","accumulated":"666.67","book_value":"333.33"},{"period":3,"depreciation":"333.33","accumulated":"1000.00","book_value":"0.00"}],"total_depreciation":"1000.00","ending_book_value":"0.00","rate":null}},{"input":{"cost":"1000000","salvage":"100000","life":3,"method":"fixed-declining-balance","first_year_months":7,"rate_scale":3},"output":{"rows":[{"period":1,"depreciation":"312666.67","accumulated":"312666.67","book_value":"687333.33"},{"period":2,"depreciation":"368410.66","accumulated":"681077.33","book_value":"318922.67"},{"period":3,"depreciation":"170942.55","accumulated":"852019.88","book_value":"147980.12"},{"period":4,"depreciation":"33048.90","accumulated":"885068.78","book_value":"114931.22"}],"total_depreciation":"885068.78","ending_book_value":"114931.22","rate":"0.536"}}],"execute_url":"/v1/tools/depreciation-schedule/versions/1.0.0/execute"}