Solo Dev Builds One Rebalancing Engine to Handle Brazilian, US, and Crypto Markets
A solo developer building 'Balance', a portfolio rebalancing app, engineered a single core engine to support three distinct markets — Brazil's B3, US stocks, and cryptocurrency — rather than building separate systems for each. The app uses a single 'market' field on the Portfolio model to branch only where necessary, such as price sources (BRAPI, Yahoo Finance, Binance), currency symbols, tax rules, and quantity precision. Approximately 90% of the domain logic, including rebalancing math, deposit flows, and snapshots, remains fully shared across all three markets. A key technical challenge was decimal precision: crypto quantities require up to 8 decimal places, while stocks use whole numbers, solved by storing all values at maximum precision and rendering them differently in the UI. The design means adding a new market requires changes only at specific, isolated branch points, leaving the core rebalancing pipeline untouched.
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