SShortSingh.
Back to feed

Developer builds Django service to automate Brazil's complex variable income tax rules

0
·1 views

A developer building Balance, a portfolio rebalancing app, created a Django service called IRReportService to automate Brazil's variable income tax calculations for stocks, FIIs, and ETFs. The system applies different tax rates — 15% for stocks and equity ETFs, 20% for FIIs — while handling the R$20,000 monthly exemption that applies only to common stocks, a rule many investors misunderstand. To identify always-taxable assets like FIIs and ETFs, the service uses a B3 ticker convention heuristic, flagging tickers ending in '11'. Average acquisition cost is recalculated by reprocessing all transactions chronologically, since sales reduce quantity but do not alter the average cost — a subtle point that causes errors in naive implementations. The final report aggregates monthly gains, loss carryovers, and year-end positions into a formatted Excel file intended to assist with Brazil's annual income tax declaration.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

Python Prototype Explores Cost-Aware Bug Investigation Policies for AI Coding

A developer has released v0.1.0 of 'bug-cause-inference-game,' a small Python prototype designed to explore cost-aware bug investigation in AI-assisted coding workflows. The tool works on synthetic bug cases, updating probability estimates across five cause categories and selecting the next investigation action from a defined set of eight options based on cost and information value. Rather than acting as a production debugger or automated repair tool, the prototype benchmarks policies — including random, greedy, and information-gain-per-cost approaches — to evaluate how efficiently a system can identify likely bug causes under budget constraints. The project draws from probabilistic debugging and Bayesian fault diagnosis, aiming to help developers decide what evidence to collect next rather than generating confident but potentially misleading explanations. The authors explicitly note the tool's limitations, stating it is not a fault-localization engine, LLM benchmark, or formal game-theoretic debugger, with that boundary being a deliberate design choice.

0
ProgrammingDEV Community ·

Developer builds AI spec-review tool after his own project spiraled into technical debt

A software developer shared how his excitement-driven approach to building a multiplayer guitar tab app led to significant technical debt despite using GitHub's Spec Kit for spec-driven development. Over ten days, he generated sixteen feature specs that grew inconsistent, contradicted each other, and drifted from the actual codebase as features were added without a clear documentation standard. Problems included mismatched data contracts, an unresolved tempo-change conflict across four files, untestable success criteria, and a 927-line entry file that needed a full refactor. The developer concluded that Spec Kit functioned correctly, but the real failure was his own lack of upfront decision-making before generating artifacts. In response, he built a personal tooling layer to enforce discipline earlier in the process, before inconsistencies have a chance to accumulate.

0
ProgrammingDEV Community ·

Knowledge-Memory-Management v0.0.2 Adds Unified Ingestion and Portable Agent Paths

Version 0.0.2 of the Knowledge-and-Memory-Management library introduces a unified ingestion pipeline that supports web, video, and article sources through a single interface. The release also overhauls memory management with a two-tier system that automatically consolidates short-term interactions into a persistent long-term vector store using cosine similarity to avoid duplication. A key portability improvement replaces all hardcoded file paths with a single environment variable, $AGENT_HOME, enabling the entire knowledge and memory subsystem to run consistently across local, CI, and containerized environments. In benchmark testing, the collector processed a 10-minute video into 15 chunks while achieving 92% recall on key concepts. The update is aimed at developers building context-aware AI agents who need reproducible, environment-agnostic configurations.

0
ProgrammingDEV Community ·

Randomized Experiment Failed Not Due to Coin Bias But Missing Data Infrastructure

A team ran a cryptographically fair randomized experiment to establish causal claims about a system change, assigning tasks to two arms via a provably unbiased coin flip. Weeks into the experiment, an audit revealed the results could never be analyzed — not because the randomizer was flawed, but because the assignment log never recorded which task each coin flip was tied to. Without a join key linking each draw to the unit assigned and its outcome, the experiment's data existed in two unconnected piles with no way to pair them. The authors identify three non-randomizer requirements for a valid experiment: a join key recorded at the moment of assignment, a safeguard against selective re-drawing, and a pre-experiment power calculation. The core lesson is that verifying the coin covers only a fraction of what makes a randomized experiment work — the rest is unglamorous but critical data bookkeeping.