import csv, random
from datetime import date, timedelta
random.seed(7)
rows=[]; start=date(2026,9,1)
accts=[f"A{n:04d}" for n in range(1,61)]
for d in range(60):
    day=start+timedelta(days=d)
    for a in accts:
        if random.random()<0.35:
            rows.append([day.isoformat(),a,random.choice(["Main","North","Online"]),random.choice(["deposit","withdrawal"]),round(random.uniform(20,900),2)])
# planted exceptions
rows.append(["2026-10-28","A0007","Main","withdrawal",9400.00])
rows.append(["2026-10-29","A0012","North","withdrawal",2500.00])
rows.append(["2026-10-29","A0012","North","withdrawal",2500.00])
rows.append(["2026-10-30","A0031","Online","deposit",8800.00])
rows.sort()
with open("transactions_sample.csv","w",newline="") as f:
    w=csv.writer(f); w.writerow(["date","account_id","channel","type","amount"]); w.writerows(rows)
print(len(rows),"rows")
