DEV Community

allratestoday
allratestoday

Posted on

Month-End Forex Revaluation for Every Client: A Script for Indian CA Firms

If your firm closes books for 30 exporters and importers, month-end means 30 copies of the same job: list every open foreign-currency debtor, creditor, EEFC balance and loan, look up the closing rate, work out the revaluation and post a journal. It's mechanical, and mechanical work is where mistakes creep in: the wrong date when the month ends on a weekend, one client on an SBI card rate and another on RBI, a JPY balance read per 100.

Here's a small script that does it the same way for every client.

The rules it follows

  • Which items. Monetary items only: debtors, creditors, advances to be settled in cash, foreign-currency bank balances, loans. Non-monetary items (inventory, fixed assets, advances for goods) stay at the historical rate.
  • Which rate. The closing rate on the reporting date. AS 11 and Ind AS 21 both require it, and ICDS VI applies the same principle for income tax computation. Most firms use the FBIL reference rate listed by the RBI because it's official, published daily and easy to evidence. Whatever you pick, use the same source for every client and every month.
  • Which date. The last day of the period. When the RBI doesn't publish that day (a weekend or a holiday), use the last rate published on or before it. 31 October 2026 was a Saturday, so October's closing rate is Friday 30 October: USD 95.2492, EUR 106.5451.
  • Where the difference goes. To P&L as exchange gain or loss, except where the client has elected otherwise for long-term items under AS 11 (paragraph 46/46A). Flag those clients; the script shouldn't guess.

Input: one CSV across all clients

Export the open foreign-currency balances from Tally, Zoho Books or the client's ERP into a single file:

client,ledger,type,ccy,fc_amount,carrying_inr
Apex Textiles,Walmart Inc (debtor),monetary,USD,20000,1919854.00
Apex Textiles,Huber GmbH (creditor),monetary,EUR,-15000,-1616824.50
Kaveri Foods,EEFC USD,monetary,USD,8000,766841.60
Kaveri Foods,Advance for machinery,non-monetary,USD,5000,477000.00
Enter fullscreen mode Exit fullscreen mode

carrying_inr is the rupee value in the books today: the original booking, or last month's revaluation.

The script

import csv, datetime as dt, requests

API = "https://allratestoday.com/api/v1/central-bank/rbi"
H = {"Authorization": "Bearer art_live_your_key"}

def closing_rates(period_end):
    """RBI/FBIL table in force on the period end; on a weekend/holiday, the last one before it."""
    r = requests.get(f"{API}/{period_end}", headers=H, timeout=30)
    r.raise_for_status()
    t = r.json()
    rates = {row["base"]: row["value"] for row in t["rates"] if row["quote"] == "INR"}
    return rates, t["rate_date"]

def revalue(path, period_end):
    rates, rate_date = closing_rates(period_end)
    out = []
    for row in csv.DictReader(open(path)):
        if row["type"] != "monetary":
            continue                                   # non-monetary: historical rate, no entry
        fc, carrying = float(row["fc_amount"]), float(row["carrying_inr"])
        closing_inr = round(fc * rates[row["ccy"]], 2)
        diff = round(closing_inr - carrying, 2)
        if diff:
            out.append({**row, "rate": rates[row["ccy"]], "rate_date": rate_date,
                        "closing_inr": closing_inr,
                        "entry": "gain" if diff > 0 else "loss", "amount": abs(diff)})
    return out

for e in revalue("open_fc_balances.csv", "2026-10-31"):
    print(f'{e["client"]:14} {e["ledger"]:24} {e["ccy"]} {e["rate"]} ({e["rate_date"]}) '
          f'{e["entry"]} {e["amount"]:,.2f}')
Enter fullscreen mode Exit fullscreen mode

Run against October 2026:

Apex Textiles  Walmart Inc (debtor)     USD 95.2492 (2026-10-30) loss 14,870.00
Apex Textiles  Huber GmbH (creditor)    EUR 106.5451 (2026-10-30) gain 18,648.00
Kaveri Foods   EEFC USD                 USD 95.2492 (2026-10-30) loss 4,848.00
Enter fullscreen mode Exit fullscreen mode

The debtor was booked on 1 October at 95.9927 and the rupee strengthened, so the USD asset lost value. The EUR creditor was booked on 5 October at 107.7883, so the liability fell and became a gain. The machinery advance is non-monetary and wasn't touched.

Turning it into vouchers

Write out to one CSV per client, in the format your client's software imports (a Tally XML voucher, or a Zoho Books journal import file). Keep rate, rate_date and the source name in the narration:

Forex revaluation Oct-26 @ USD 95.2492 (FBIL/RBI ref. rate 30-10-2026)
Enter fullscreen mode Exit fullscreen mode

Auditors and tax auditors get the rate, its date and the source in the voucher itself, and can check them against the RBI's published table.

Things that bite at scale

  • Per-100 currencies. The RBI table quotes JPY per 100 yen, and IDR per 10,000. The API returns everything per 1 unit; if you key rates in by hand, check this.
  • Currencies the RBI doesn't list. The reference rate covers USD, EUR, GBP and JPY (plus a few in the RBI's own table). For a SGD or AUD balance, pick and document a fallback, for example SBI's TT mid-rate or a cross through USD, and apply it to every client.
  • Year-end. The same script runs on 31 March. The 2025-26 year closed on a holiday, so the closing rate was 30 March 2026 (USD 94.6543). Check the date before you post 31 March journals.
  • Reversals. If the firm's practice is to reverse revaluations on day one of the next month, carrying_inr becomes the original booking every month. If not, it's last month's closing value. Pick one per client and keep it.

Links

RBI/FBIL reference rates are the official rates; the client names above are made up. Revaluation policy, the AS 11 para 46A election and ICDS treatment are for the engagement team to decide; this is a tool, not an opinion.

Top comments (0)