crypto-balanced-portolio-builder
Balances your crypto portfolio using coinstats export
| Size | Folder | Inside |
|---|---|---|
| 2.5 MB | docs/ | 3 assets · 2 docs |
| 60.2 kB | (root) | 2 docs · 2 other files |
| Size | Path |
|---|---|
| 72 B | .gitignore |
| 1.1 kB | LICENSE |
| 7.2 kB | README.md |
| 51.8 kB | crypto_portfolio_capped_v4.html |
| 572 kB | docs/coinstats-export-mobile.jpg · binary |
| 1.1 MB | docs/coinstats-export-web.png · binary |
| 1 kB | docs/release-v1.0.0.md |
| 1.3 kB | docs/release-v1.0.1.md |
| 339 B | docs/sample-coinstats-balances.csv |
| 847 kB | docs/screenshot.png · binary |
Already bought this?
View your purchasesREADME
Crypto Portfolio by Market Cap
Build a market-cap-weighted crypto portfolio with per-asset caps, then get an exact buy/sell list to rebalance. Built with CoinStats users in mind, but any holdings CSV works.

Who this is for
CoinStats users who want to rebalance quickly. CoinStats tells you what you own, but not what to buy or sell to reach a target allocation. Export your Balances CSV, set a target, upload the file, and you get a per-coin BUY / SELL / HOLD list with exact units and dollar amounts. The export steps are documented below with screenshots.
Anyone who wants a market-cap-weighted portfolio. You don't need CoinStats, or any holdings file at all. Set a portfolio size, a number of coins and a maximum weight per coin, and the tool builds the allocation from live market data. If you track holdings somewhere else, any CSV with a Symbol column and an Amount column gives you the same rebalancing list.
Either way, the whole thing is one HTML file that runs in your browser. No accounts, no servers, no API keys, no install. Your holdings never leave your machine.
Quick start
- Download
crypto_portfolio_capped_v4.html. - Open it in any modern browser (double-click it).
- Set your inputs and click Build Portfolio. This fetches live market caps from CoinGecko and builds your target allocation.
- Optional: under Rebalance from CoinStats, upload your holdings CSV and click Compare Holdings.
- Read the Portfolio Adjustments Needed table, or click Download Adjustments CSV.
Want to try step 4 before exporting anything? Upload docs/sample-coinstats-balances.csv.
Exporting your balances from CoinStats
If you use CoinStats, this is the file to upload in step 4. CoinStats currently marks CSV export as a Premium feature.
Web (coinstats.app)
- Go to the Portfolio Tracker page and select the portfolio you want to rebalance.
- Open the Assets tab.
- Click the Export button (the download icon at the top right of the assets table).
- Choose Balances. Save the CSV file.

Mobile app (iOS / Android)
- Open the Portfolio tab and pick the portfolio you want to rebalance.
- Tap the three-dot button below the chart.
- Tap Portfolio Settings.
- Scroll down and tap Export Data.
- Choose Balances and save or share the CSV file, then get it onto the computer where you'll open the tool.

Steps and screenshots are from the CoinStats help article How to Export Transactions to CSV. If the CoinStats interface changes, that article is the source of truth.
Export Balances rather than Transaction History. The transaction export lists individual trades, not what you currently hold.
Using a CSV from somewhere else
The tool only needs two columns: Symbol and Amount (column names are matched case-insensitively, and an Amount or Total column both work). Extra columns are ignored. Multiple rows for the same symbol are summed, so a coin held on several exchanges or wallets is treated as one position. Exports from most other trackers and exchanges will work as-is or after renaming a header.
What the tool does
Builds a target allocation
- Pulls the top N coins by market cap from CoinGecko (live, paginated, deduplicated by symbol).
- Weights each coin by market cap, clips anything over your per-coin cap, and redistributes the excess proportionally until every dollar is allocated.
- Lets you pin specific coins to exact percentages with custom targets. Whatever remains is spread across the market-cap-weighted coins.
- Excludes stablecoins by default, plus a default exclusion list you can edit.
Compares it against your current holdings
- Every coin you hold or should hold gets an action: BUY, SELL or HOLD.
- Shows current units, target units, the delta, and the same in USD.
- Coins you hold that are not in the target get a SELL row so nothing is silently ignored.
- Summary chips: current value, target value, number of buys and sells, net adjustment.
Exports
- Target allocation as CSV or JSON, respecting the current sort order.
- Adjustments list as a separate CSV once you've compared holdings.
Interface
- Sortable results table with inline weight bars showing the cap and any clipped portion.
- Donut chart with hover highlighting synced to the legend.
- Dark, responsive, keyboard accessible. Coin names link to CoinGecko.
How the allocation maths works
- Fetch the top N coins by market cap from CoinGecko.
- Compute baseline weights as
coin market cap / total market cap. - Apply the per-coin cap and redistribute clipped weight proportionally until fully allocated.
- Subtract any custom targets first; the rest of the portfolio is allocated by market cap.
- Convert weights to target USD and target units using your portfolio value.
- If you uploaded holdings, compare target units against what you hold to produce the buy/sell list.
Development
- Stack: HTML + CSS + vanilla JS, no dependencies
- Single file: edit crypto_portfolio_capped_v4.html directly
- Testing: open the file in a browser; there is no build
Notes & limitations
- Uses CoinGecko's free public API for market data. Rate limits (HTTP 429) are handled with retry/backoff, but heavy refreshing will still get throttled.
- Prices come from CoinGecko, not from your holdings export, so values can differ slightly from what your tracker shows.
- All calculations are client-side. Verify the numbers before you trade on them.
- Not financial advice.
Privacy
100% client-side. The only network request the page makes is to CoinGecko's public API for market data. Your portfolio size, holdings CSV, and allocations never leave your machine.
Attribution
- Market data from the CoinGecko Public API
- CoinStats export screenshots from the CoinStats Help Center. CoinStats is a trademark of its owner; this project is not affiliated with or endorsed by CoinStats.
License
MIT — free to use, modify, and distribute, including commercially.
Security scan report
Scanned by X402 Git, OSV (opens in a new tab) and Socket (opens in a new tab) — passed on all three. Findings from X402 Git are listed below.
- secrets
- none found
- X402 Git
- size limits
- within caps
- X402 Git
- known malware
- no dependency manifests to check
- OSV
- known vulnerabilities
- no dependency manifests to check
- OSV
- dependency behaviour
- no dependency manifests to check
- Socket
- instruction smuggling
- none found
- X402 Git
- what it can do
- listed below
- X402 Git
What this can do
- Tools
- none
- Runs
- nothing
- Talks to
- api.coingecko.com
- www.coingecko.com
- Reads
- no environment variables
- At install
- nothing runs
- Links to
- coingecko.com
- help.coinstats.app
- img.shields.io
Findings (2)
- LOWcrypto_portfolio_capped_v4.html — Talks to api.coingecko.com
- LOWcrypto_portfolio_capped_v4.html — Talks to www.coingecko.com
Releases 2
v1.0.12026-09-16
Repositioning and documentation release. No changes to the allocation or rebalancing maths.
Getting started: download
crypto_portfolio_capped_v4.htmlbelow and open it in any modern browser.- CoinStats front and centre. The README and in-app copy now explain that the tool is built for CoinStats users who want to rebalance quickly, while still working for anyone with a Symbol/Amount holdings CSV or no holdings file at all.
- Step-by-step CoinStats export guide for web and mobile, with screenshots from the CoinStats Help Center, plus a sample Balances CSV (
docs/sample-coinstats-balances.csv) to try the rebalancing flow without exporting anything. - New demo screenshot showing the full flow: target allocation, donut chart and the buy/sell adjustments table.
- Holdings panel renamed to "Rebalance from CoinStats" with the export path shown inline.
- White-labelling removed. The branding config object, footer and related docs are gone; the title and version are plain text.
- Third-party branding removed from the README, HTML and LICENSE.
Notes
Uses CoinGecko's free public API; rate limits are handled with retry/backoff but heavy refreshing will still get throttled. All calculations are client-side. Verify before trading. Not financial advice.
v1.0.02026-09-01
First packaged release of Crypto Portfolio by Market Cap.
A single-file, client-side tool that builds a market-cap-weighted crypto portfolio with per-asset caps. Live CoinGecko data, buy/sell rebalancing against your current holdings, CSV/JSON export. No accounts, no servers, no API keys, no build step.
Getting started: download
crypto_portfolio_capped_v4.htmlbelow and open it in any modern browser.What's in this release
- MIT licensed — free to use, modify and distribute, including commercially.
- White-label ready — every brand-facing string lives in a single
APPobject at the top of the script block. Change the name, version, brand and footer in one place; setbrandNameto an empty string to hide the footer. Colors are CSS custom properties in:root. - Metadata — proper page title, meta description, Open Graph tags and an inline SVG favicon, all embedded so the file stays genuinely standalone.
- Rewritten README with a screenshot of the running app and white-labelling docs.
Notes
Uses CoinGecko's free public API; rate limits are handled with retry/backoff but heavy refreshing will still get throttled. All calculations are client-side — verify before trading. Not financial advice.